New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc] Replace super(XXX, self) with super() in code examples #22314
Conversation
I can see your point, but I think that goes against new (3.x) users. Imagine having all classes in examples explicitly subclassing object so that Python 2 users can copy & paste. Perhaps I'm missing something, but it seems the same thing to me. Plus, the reason that "this is for Python 2 users to be able to copy & paste" isn't obvious to a Python 3 user that's reading the code, so she/he may get the wrong idea, and understand that in those cases it's necessary to do things that way. super() can be complex, so showing it as simple as it gets in the simple cases seems better to me. |
|
I agree with both of your comments, but since the logging-cookbook is versioned - wouldn't it be ok to update the Python 3 branches without backporting to the python 2.7 version? |
Yes, this shouldn't be backported to 2.7 |
|
OK, I don't feel that strongly about it, so I'm OK with making these changes in the logging cookbook. Not sure how authors of the other files affected feel - I think we should be consistent across all these files. |
|
@1st1 Could you talk a look at this when you have some time? :) |
|
I find it preferable to use the zero-argument form of super in Python 3.0 docs as there reference document in 3.0 and linked documents demonstrate that form only ( https://docs.python.org/3/library/functions.html#super)
+1 to this patch, and using |
|
Thanks @andresdelfino for the PR, and @orsenthil for merging it |
…ythonGH-22314) (cherry picked from commit 52cd6d5) Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
GH-25638 is a backport of this pull request to the 3.9 branch. |
|
GH-25639 is a backport of this pull request to the 3.8 branch. |
As it is documented, it can make one think passing args to super() in these cases is needed, which is misleading.