-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use more Pythonic super().__init__() instead of calling parent class directly #2198
Conversation
I'm not clear that super(Class, instance) is any more pythonic than the explicit parent call, at least in 2.x.
|
Take a look at Raymond Hettinger's article "Python’s super() considered super! ".
The MRO is still explicit. It is defined on the
I suppose that is subjective. As someone who uses |
The MRO of super() is controlled at runtime, the MRO of the explicit parent call is determined when the code is authored. Those are two different things. This is covered in super considered super. |
Yes please, this really should be merged. |
I'm still -1, given the ugly syntax required on 2.7 and the fact that a child can mess with a parent's method resolution order with super. |
@wiredfool that's exactly the point. When subclassing PIL classes, one expects those PIL classes to be calling super() appropriately. |
This was tagged as "Needs Rebase" by @radarhere , but was also rejected by @wiredfool. If I put in the work to rebase this will it be reconsidered for inclusion? |
If you don't feel inspired to rebase, then I wouldn't recommend doing so, particularly with an issue like this, where there is not a lot of nuance in the implementation. |
I think the tag was essentially a mechanical marking of all the PRs with merge errors. |
Certainly, but this is desired behaviour. Python is very flexible language and there should be a way to insert your class in the middle of MRO. Super allows this. |
I have no problem doing the work, I like contributing. So I feel plenty inspired. I just don't want to waste everyone's time (including my own) if it is known ahead of time that it will be rejected. FWIW, I still think using |
Rebased to latest master. |
Just to note - Python 2 is no longer supported in the next Pillow release. |
Updated to use the |
Any remaining objections to merging this, now the Python 2.7 ugliness has gone? |
No description provided.