Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to call super(MyClass, self).__init__() without MyClass?

Tags:

python

syntax

I find this syntax astoundingly annoying. Every time I rename my class, I have to change this call for no apparent reason. Isn't there some __class__ magic variable or something I can use at least? Interested in answers for Python 2.5, but it doesn't hurt to know if later versions fixed this.

like image 241
mpen Avatar asked Dec 17 '22 01:12

mpen


1 Answers

As far as I know, this isn't possible in 2.5. However, in 3.0, this was changed so that you can simply call super().__init__().

like image 146
Justin Ardini Avatar answered Dec 19 '22 14:12

Justin Ardini