I just noticed that PEP 8 has quite a few references to Python 2. Perhaps it's time to remove those. There are more and more folks that have never learned or used Python 2 -- having those notes in PEP 8 is just confusing. And for folks that are still maintaining Py 2 code -- it's probably too late for PEP 8 for those code bases anyway. If I make a PR, will it be considered? -CHB -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
Since PEP 8 is a "living document" that is occasionally updated, I think that's reasonable. Don't go overboard. I found 10 occurrences of the string "python 2" in the text. You might also want to strike the paragraph that links to reference [6]. On Tue, Aug 24, 2021 at 9:42 PM Christopher Barker <pythonchb@gmail.com> wrote:
I just noticed that PEP 8 has quite a few references to Python 2. Perhaps it's time to remove those.
There are more and more folks that have never learned or used Python 2 -- having those notes in PEP 8 is just confusing.
And for folks that are still maintaining Py 2 code -- it's probably too late for PEP 8 for those code bases anyway.
If I make a PR, will it be considered?
-CHB
-- Christopher Barker, PhD (Chris)
Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/MK7N36L3... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
On Tue, Aug 24, 2021 at 9:53 PM Guido van Rossum <guido@python.org> wrote:
Since PEP 8 is a "living document" that is occasionally updated, I think that's reasonable. Don't go overboard. I found 10 occurrences of the string "python 2" in the text. You might also want to strike the paragraph that links to reference [6].
will do -- hopefully I'll find some time for this tomorrow. -CHB
On Tue, Aug 24, 2021 at 9:42 PM Christopher Barker <pythonchb@gmail.com> wrote:
I just noticed that PEP 8 has quite a few references to Python 2. Perhaps it's time to remove those.
There are more and more folks that have never learned or used Python 2 -- having those notes in PEP 8 is just confusing.
And for folks that are still maintaining Py 2 code -- it's probably too late for PEP 8 for those code bases anyway.
If I make a PR, will it be considered?
-CHB
-- Christopher Barker, PhD (Chris)
Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/MK7N36L3... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
I think we’re better off removing them. 2.7 is completely unsupported by us. Why do you think they should still be kept? -- Eric
On Aug 25, 2021, at 1:32 PM, Mike Miller <python-dev@mgmiller.net> wrote:
How about moving Python 2 notes into a section at the bottom?
-Mike _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/76JIO4AF... Code of Conduct: http://python.org/psf/codeofconduct/
I suspect it's the same motivation that makes us comment out a block of code rather than deleting it, even though we know the VCS will let us retirive it whenever we want. If I'm wrong it won't be fatal. Or surprising ;-) Kind regards, Steve On Wed, Aug 25, 2021 at 8:53 PM Eric V. Smith <eric@trueblade.com> wrote:
I think we’re better off removing them. 2.7 is completely unsupported by us.
Why do you think they should still be kept?
-- Eric
On Aug 25, 2021, at 1:32 PM, Mike Miller <python-dev@mgmiller.net> wrote:
How about moving Python 2 notes into a section at the bottom?
-Mike _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/76JIO4AF... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/235UK4OX... Code of Conduct: http://python.org/psf/codeofconduct/
On 8/25/2021 6:48 PM, Steve Holden wrote:
I suspect it's the same motivation that makes us comment out a block of code rather than deleting it, even though we know the VCS will let us retirive it whenever we want. If I'm wrong it won't be fatal. Or surprising ;-)
Kind regards, Steve
On Wed, Aug 25, 2021 at 8:53 PM Eric V. Smith <eric@trueblade.com <mailto:eric@trueblade.com>> wrote:
I think we’re better off removing them. 2.7 is completely unsupported by us.
Why do you think they should still be kept?
-- Eric
> On Aug 25, 2021, at 1:32 PM, Mike Miller <python-dev@mgmiller.net <mailto:python-dev@mgmiller.net>> wrote: > > > How about moving Python 2 notes into a section at the bottom?
I initially thought of this also, for +- the reason Steve gives. But PEP 8 still specifically applies to the stdlib and we only edit 3.6+. So I agree with Eric. We could add (perhaps at the end of the first paragraph) something like "(Since the 2.x stdlib is frozen, all 2.x-specific guidelines were removed in Sept 2021.)" Anyone interested could then check git log for the last commit before then. And everyone would know that what follows is for 3.x. -- Terry Jan Reedy
I'm working on a PR now. It seems there is little support for keeping the python2 content in the docs, so I'm re-writing it as though it was never there. If someone wants to add a note about Python 2, of course that can be added later. Note that "moving the Python 2 content to a section at the end" is not all that straightforward, as it is pretty mixed in with the text at this point. But now a question -- the current text reads: "Code in the core Python distribution should always use UTF-8" and then: "In the standard library, non-default encodings should be used only for test purposes or when a comment or docstring needs to mention an author name that contains non-ASCII characters ..." I *think* that's a remnant of the Py2 ASCII encoding days -- but I wanted to make sure, a bit later on, it says: "The following policy is prescribed for the standard library ... In addition, string literals and comments must also be in ASCII." Is that still correct for string literals and comments? And what about docstrings? It seems to me that if we really are utf-8, then there is no need for those "textual" elements to be ASCII. e.g they can still contain non-ascii characters, and escaping those makes things less readable, not more. So I think that section should now read: """ Source File Encoding -------------------- Code in the core Python distribution should always use UTF-8, and should not have an encoding declaration. In the standard library, non-UTF-8 encodings should be used only for test purposes. The following policy is prescribed for the standard library (see PEP 3131): All identifiers in the Python standard library MUST use ASCII-only identifiers, and SHOULD use English words wherever feasible (in many cases, abbreviations and technical terms are used which aren't English). In comment and docstrings, authors whose names tht are not based on the Latin alphabet (latin-1, ISO/IEC 8859-1 character set) MUST provide a transliteration of their names in this character set. Open source projects with a global audience are encouraged to adopt a similar policy. """ But maybe we do want to keep comments, docstrings and literals as ASCII with escapes? -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
On 26.08.2021 06:07, Christopher Barker wrote:
I'm working on a PR now. It seems there is little support for keeping the python2 content in the docs, so I'm re-writing it as though it was never there. If someone wants to add a note about Python 2, of course that can be added later.
Note that "moving the Python 2 content to a section at the end" is not all that straightforward, as it is pretty mixed in with the text at this point.
But now a question -- the current text reads:
"Code in the core Python distribution should always use UTF-8"
and then:
"In the standard library, non-default encodings should be used only for test purposes or when a comment or docstring needs to mention an author name that contains non-ASCII characters ..."
I *think* that's a remnant of the Py2 ASCII encoding days -- but I wanted to make sure, a bit later on, it says:
"The following policy is prescribed for the standard library ... In addition, string literals and comments must also be in ASCII."
For Python 2 code we mandated ASCII for the stdlib, with some exceptions using the source code encoding for testing purposes or in case e.g. Martin von Löwis or Marc-André Lemburg wanted to put his name into the code without escaping part of it ;-) Note that Python 2 defaults to ASCII as source code encoding. With UTF-8 as standard source code encoding, this is no longer necessary. So the second quote can be changed to "In the standard library, non-default source code encodings should be used only for test purposes ...".
Is that still correct for string literals and comments? And what about docstrings?
It seems to me that if we really are utf-8, then there is no need for those "textual" elements to be ASCII. e.g they can still contain non-ascii characters, and escaping those makes things less readable, not more.
So I think that section should now read:
""" Source File Encoding --------------------
Code in the core Python distribution should always use UTF-8, and should not have an encoding declaration.
In the standard library, non-UTF-8 encodings should be used only for test purposes.
I think the above should be limited to Python code. In C or other source files you may well still need a source code encoding.
The following policy is prescribed for the standard library (see PEP 3131): All identifiers in the Python standard library MUST use ASCII-only identifiers, and SHOULD use English words wherever feasible (in many cases, abbreviations and technical terms are used which aren't English). In comment and docstrings, authors whose names tht are not based on the Latin alphabet (latin-1, ISO/IEC 8859-1 character set) MUST provide a transliteration of their names in this character set.
Open source projects with a global audience are encouraged to adopt a similar policy. """
But maybe we do want to keep comments, docstrings and literals as ASCII with escapes?
No need for the stdlib, since UTF-8 is widely accepted by now and why should people with non-ASCII names not be able to write their true name ? You may have noted that I rarely do... the reason is that in the past, the accent on the "e" caused me too many problems. Perhaps one of these days, I'll go back to adding it again :-) -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Aug 26 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/
Marc-Andre Lemburg writes:
On 26.08.2021 06:07, Christopher Barker wrote:
But now a question -- the current text reads:
"Code in the core Python distribution should always use UTF-8"
"The following policy is prescribed for the standard library ... In addition, string literals and comments must also be in ASCII."
Alex Martelli had a long, well-reasoned post about why Python's "official" language (specifically, identifiers and comments) should be English despite the strong preference for inclusion of our community. As long as that remains true, I think we should stick to ASCII as a lowest common denominator, with an exception for proper names and testing.
With UTF-8 as standard source code encoding, this is no longer necessary.
So the second quote can be changed to "In the standard library, non-default source code encodings should be used only for test purposes ...".
+1
I think the above should be limited to Python code. In C or other source files you may well still need a source code encoding.
True, but PEP 8 only does apply to Python. PEP 7 is the style guide for C.
No need for the stdlib, since UTF-8 is widely accepted by now and why should people with non-ASCII names not be able to write their true name ?
+1 While I proposed above that the stated policy should be "ASCII except for proper names", I also think "although practicality beats purity". I think such exceptions will be rare enough that "although practicality" can be left implicit. Steve
On 26. 08. 21 9:54, Marc-Andre Lemburg wrote:
On 26.08.2021 06:07, Christopher Barker wrote:
I'm working on a PR now. It seems there is little support for keeping the python2 content in the docs, so I'm re-writing it as though it was never there. If someone wants to add a note about Python 2, of course that can be added later.
Note that "moving the Python 2 content to a section at the end" is not all that straightforward, as it is pretty mixed in with the text at this point.
But now a question -- the current text reads:
"Code in the core Python distribution should always use UTF-8"
and then:
"In the standard library, non-default encodings should be used only for test purposes or when a comment or docstring needs to mention an author name that contains non-ASCII characters ..."
I *think* that's a remnant of the Py2 ASCII encoding days -- but I wanted to make sure, a bit later on, it says:
"The following policy is prescribed for the standard library ... In addition, string literals and comments must also be in ASCII."
For Python 2 code we mandated ASCII for the stdlib, with some exceptions using the source code encoding for testing purposes or in case e.g. Martin von Löwis or Marc-André Lemburg wanted to put his name into the code without escaping part of it ;-)
Note that Python 2 defaults to ASCII as source code encoding.
With UTF-8 as standard source code encoding, this is no longer necessary.
So the second quote can be changed to "In the standard library, non-default source code encodings should be used only for test purposes ...".
Is that still correct for string literals and comments? And what about docstrings?
It seems to me that if we really are utf-8, then there is no need for those "textual" elements to be ASCII. e.g they can still contain non-ascii characters, and escaping those makes things less readable, not more.
So I think that section should now read:
""" Source File Encoding --------------------
Code in the core Python distribution should always use UTF-8, and should not have an encoding declaration.
In the standard library, non-UTF-8 encodings should be used only for test purposes.
I think the above should be limited to Python code. In C or other source files you may well still need a source code encoding.
The following policy is prescribed for the standard library (see PEP 3131): All identifiers in the Python standard library MUST use ASCII-only identifiers, and SHOULD use English words wherever feasible (in many cases, abbreviations and technical terms are used which aren't English). In comment and docstrings, authors whose names tht are not based on the Latin alphabet (latin-1, ISO/IEC 8859-1 character set) MUST provide a transliteration of their names in this character set.
Open source projects with a global audience are encouraged to adopt a similar policy. """
But maybe we do want to keep comments, docstrings and literals as ASCII with escapes?
No need for the stdlib, since UTF-8 is widely accepted by now and why should people with non-ASCII names not be able to write their true name ?
You may have noted that I rarely do... the reason is that in the past, the accent on the "e" caused me too many problems. Perhaps one of these days, I'll go back to adding it again :-)
I would drop the weirdly specific "(latin-1, ISO/IEC 8859-1 character set)" note, and only keep "based on the Latin alphabet". The Ł in Łukasz's name is not in latin-1, and I don't think it needs different treatment than German or French names. (As opposed to a Russian or Chinese name, where an an average English speaker isn't able to type an approximation of the name on their keyboard.) - Peťa Viktorin
Thanks all. The PR is in process, and I believe it includes everything brought up here. If you have any more thoughts, please post them there. -CHB On Thu, Aug 26, 2021 at 1:54 AM Petr Viktorin <encukou@gmail.com> wrote:
On 26.08.2021 06:07, Christopher Barker wrote:
I'm working on a PR now. It seems there is little support for keeping
python2 content in the docs, so I'm re-writing it as though it was never there. If someone wants to add a note about Python 2, of course that can be added later.
Note that "moving the Python 2 content to a section at the end" is not all that straightforward, as it is pretty mixed in with the text at this point.
But now a question -- the current text reads:
"Code in the core Python distribution should always use UTF-8"
and then:
"In the standard library, non-default encodings should be used only for test purposes or when a comment or docstring needs to mention an author name that contains non-ASCII characters ..."
I *think* that's a remnant of the Py2 ASCII encoding days -- but I wanted to make sure, a bit later on, it says:
"The following policy is prescribed for the standard library ... In addition, string literals and comments must also be in ASCII."
For Python 2 code we mandated ASCII for the stdlib, with some exceptions using the source code encoding for testing purposes or in case e.g. Martin von Löwis or Marc-André Lemburg wanted to put his name into the code without escaping part of it ;-)
Note that Python 2 defaults to ASCII as source code encoding.
With UTF-8 as standard source code encoding, this is no longer necessary.
So the second quote can be changed to "In the standard library, non-default source code encodings should be used only for test purposes ...".
Is that still correct for string literals and comments? And what about docstrings?
It seems to me that if we really are utf-8, then there is no need for
On 26. 08. 21 9:54, Marc-Andre Lemburg wrote: the those
"textual" elements to be ASCII. e.g they can still contain non-ascii characters, and escaping those makes things less readable, not more.
So I think that section should now read:
""" Source File Encoding --------------------
Code in the core Python distribution should always use UTF-8, and should not have an encoding declaration.
In the standard library, non-UTF-8 encodings should be used only for test purposes.
I think the above should be limited to Python code. In C or other source files you may well still need a source code encoding.
The following policy is prescribed for the standard library (see PEP 3131): All identifiers in the Python standard library MUST use ASCII-only identifiers, and SHOULD use English words wherever feasible (in many cases, abbreviations and technical terms are used which aren't English). In comment and docstrings, authors whose names tht are not based on the Latin alphabet (latin-1, ISO/IEC 8859-1 character set) MUST provide a transliteration of their names in this character set.
Open source projects with a global audience are encouraged to adopt a similar policy. """
But maybe we do want to keep comments, docstrings and literals as ASCII with escapes?
No need for the stdlib, since UTF-8 is widely accepted by now and why should people with non-ASCII names not be able to write their true name ?
You may have noted that I rarely do... the reason is that in the past, the accent on the "e" caused me too many problems. Perhaps one of these days, I'll go back to adding it again :-)
I would drop the weirdly specific "(latin-1, ISO/IEC 8859-1 character set)" note, and only keep "based on the Latin alphabet". The Ł in Łukasz's name is not in latin-1, and I don't think it needs different treatment than German or French names. (As opposed to a Russian or Chinese name, where an an average English speaker isn't able to type an approximation of the name on their keyboard.)
- Peťa Viktorin
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/E6B6INCC... Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
Terry Reedy writes:
We could add (perhaps at the end of the first paragraph) something like "(Since the 2.x stdlib is frozen, all 2.x-specific guidelines were removed in Sept 2021.)" Anyone interested could then check git log for the last commit before then.
How about including the most recent 'main' SHA1 (where a 6-character prefix should do, and "the" refers to Chris's clone, we don't need to be hugely fussy about the exact previous commit when it eventually gets merged), or even tag it?
OK, PR here: https://github.com/python/peps/pull/2059 Interesting some of the cruft in there e.g. still referring to "new style classes" :-) I'll leave it to the PEP editors to decide about a note about Python 2. -CHB On Wed, Aug 25, 2021 at 10:28 PM Stephen J. Turnbull < stephenjturnbull@gmail.com> wrote:
Terry Reedy writes:
We could add (perhaps at the end of the first paragraph) something like "(Since the 2.x stdlib is frozen, all 2.x-specific guidelines were removed in Sept 2021.)" Anyone interested could then check git log for the last commit before then.
How about including the most recent 'main' SHA1 (where a 6-character prefix should do, and "the" refers to Chris's clone, we don't need to be hugely fussy about the exact previous commit when it eventually gets merged), or even tag it?
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/TWNYNKGC... Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
Christopher Barker writes:
PR here:
Thanks for your prompt efforts! The notes toward a "near future" agenda are above and beyond.
Interesting some of the cruft in there e.g. still referring to "new style classes" :-)
I think that should also come out "now", but that's a +1 to the idea, not a suggestion for you to do it. Maybe I will if nobody gets to it before the weekend. :-) Steve
On Wed, Aug 25, 2021 at 10:32 AM Mike Miller <python-dev@mgmiller.net> wrote:
How about moving Python 2 notes into a section at the bottom?
I don't think that's useful. PEP 8 is still meant for the stdlib which is obviously not using Python 2, so it just becomes baggage. Plus if people want to refer to the old version they have the version history. And for anyone who wants to keep the old version they can copy or fork it.
-Mike _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/76JIO4AF... Code of Conduct: http://python.org/psf/codeofconduct/
Greetings, What about stating the version on each PEP8 file? Like the docs always refer to a version of Python Better, each version of Python can have it's PEP8 guide as language features added require style guidelines. Kind Regards, Abdur-Rahmaan Janhangeer about <https://compileralchemy.github.io/> | blog <https://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ> Mauritius
participants (11)
-
Abdur-Rahmaan Janhangeer
-
Brett Cannon
-
Christopher Barker
-
Eric V. Smith
-
Guido van Rossum
-
Marc-Andre Lemburg
-
Mike Miller
-
Petr Viktorin
-
Stephen J. Turnbull
-
Steve Holden
-
Terry Reedy