Size: 3379
Comment: Python warts vs. Python 3000
|
← Revision 5 as of 2017-08-31 16:59:50 ⇥
Size: 4476
Comment: Replace URLs with archive links.
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
* Andrew Kuchling's [http://web.archive.org/web/20031002184114/www.amk.ca/python/writing/warts.html Python Warts] - now archived * Hans Nowak's [http://zephyrfalcon.org/labs/python_pitfalls.html 10 Python pitfalls] * Steven Ferg's [http://www.ferg.org/projects/python_gotchas.html Python Gotchas] * Mark Lutz's [http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html When Pythons Attack] |
* Andrew Kuchling's [[http://web.archive.org/web/20031002184114/www.amk.ca/python/writing/warts.html|"Python Warts"]] - now archived * Hans Nowak's [[http://archive.is/xBOV2|"10 Python pitfalls"]] - now archived * Steven Ferg's [[http://web.archive.org/web/20080503031358/http://www.ferg.org:80/projects/python_gotchas.html|"Python Gotchas"]] - now archived * Mark Lutz's [[http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html|"When Pythons Attack"]] - [[http://archive.is/Tjd2q|Archive]] * David Mertz's "Python elegance and warts", [[http://web.archive.org/web/20090403002610/http://www.ibm.com/developerworks/linux/library/l-python-elegance-1.html|Part 1]] and [[http://archive.is/MdrIm|Part 2]] - now archived |
Line 13: | Line 14: |
* Rejected: the shortcoming in question is regarded as a feature, typically because any attempt to remove it would arguably change the language in a way which would be even more confusing - see [http://www.python.org/dev/peps/pep-3099/ PEP 3099] for a list of such requested features | * Rejected: the shortcoming in question is regarded as a feature, typically because any attempt to remove it would arguably change the language in a way which would be even more confusing - see [[http://www.python.org/dev/peps/pep-3099/|PEP 3099]] for a list of such requested features Note that the [[http://archive.is/c2tkF|"What's New in Python 3.0" document]] also contains a list of changes in Python 3000. One can argue that many of the changes are useful fixes that were too mundane for people to write critiques about. |
Line 18: | Line 21: |
|| Calling base class methods ||<#F0F0F0> Kuchling || [http://www.python.org/dev/peps/pep-3135/ New Super] || || Catching multiple exceptions ||<#F0F0F0> Kuchling, Nowak || [http://www.python.org/dev/peps/pep-3110/ Catching Exceptions in Python 3000] || |
|| Calling base class methods ||<#F0F0F0> Kuchling || [[http://www.python.org/dev/peps/pep-3135/|New Super]] || || Catching multiple exceptions ||<#F0F0F0> Kuchling, Nowak || [[http://www.python.org/dev/peps/pep-3110/|Catching Exceptions in Python 3000]] || |
Line 23: | Line 26: |
|| print >> ||<#F0F0F0> Kuchling || [http://www.python.org/dev/peps/pep-3105/ Make print a function] || | || print >> ||<#F0F0F0> Kuchling || [[http://www.python.org/dev/peps/pep-3105/|Make print a function]] || |
Line 28: | Line 31: |
|| [http://www.ferg.org/projects/python_gotchas.html#contents_item_1 Backslashes are escape characters] ||<#F0F0F0> Ferg || ''No remedy'' || || [http://www.ferg.org/projects/python_gotchas.html#contents_item_4 Print and softspace] ||<#F0F0F0> Ferg || [http://www.python.org/dev/peps/pep-3105/ Make print a function] || || [http://www.ferg.org/projects/python_gotchas.html#contents_item_5 Omitting parentheses when invoking a method] ||<#F0F0F0> Ferg, Lutz || ''Rejected'' - taking a reference to a function/method is a feature || |
|| [[http://web.archive.org/web/20161025191258/https://pythonconquerstheuniverse.wordpress.com/2008/06/04/gotcha-%E2%80%94-backslashes-are-escape-characters/|Backslashes are escape characters]] ||<#F0F0F0> Ferg || ''No remedy'' || || [[http://web.archive.org/web/20080503031358/http://www.ferg.org:80/projects/python_gotchas.html#contents_item_4|Print and softspace]] ||<#F0F0F0> Ferg || [[http://www.python.org/dev/peps/pep-3105/|Make print a function]] || || [[http://web.archive.org/web/20081029013232/http://pythonconquerstheuniverse.blogspot.com:80/2008/06/gotcha-forgetting-parentheses.html|Omitting parentheses when invoking a method]] ||<#F0F0F0> Ferg, Lutz || ''Rejected'' - taking a reference to a function/method is a feature || |
Line 32: | Line 35: |
|| Inconsistent/unpredictable comparisons/ordering ||<#F0F0F0> Mertz || ''No remedy'' || || Deficient sequence support for iterators, generators ||<#F0F0F0> Mertz || ''No remedy'' || || Attribute access mechanism proliferation ||<#F0F0F0> Mertz || ''No remedy'' - Mertz suggests standard decorators || |
Python Warts
Python "warts" are things for which people have criticised Python, typically aspects of the language or mechanisms of its implementation, because such aspects either expose certain surprising inconsistencies, are regarded as omissions, or cause irritation for parts of the community in some sense. One goal of Python 3000 was to fix inconsistencies which could not have been fixed earlier due to the backwards compatibility constraints imposed on earlier releases of Python. This page summarises the unfixed warts, pitfalls and "gotchas" (which are not mere observations) from the following resources and lists Python 3000 remedies, if any:
Andrew Kuchling's "Python Warts" - now archived
Hans Nowak's "10 Python pitfalls" - now archived
Steven Ferg's "Python Gotchas" - now archived
Mark Lutz's "When Pythons Attack" - Archive
David Mertz's "Python elegance and warts", Part 1 and Part 2 - now archived
In the table below, the following terminology is used:
- No remedy: while some believe this to be a shortcoming, a lack of wider consensus has resulted in no remedy being pursued
Rejected: the shortcoming in question is regarded as a feature, typically because any attempt to remove it would arguably change the language in a way which would be even more confusing - see PEP 3099 for a list of such requested features
Note that the "What's New in Python 3.0" document also contains a list of changes in Python 3000. One can argue that many of the changes are useful fixes that were too mundane for people to write critiques about.
Shortcoming |
Source |
Python 3000 Remedy |
No do statement |
Kuchling |
No remedy |
Local variables and scoping |
Kuchling, Nowak, Lutz |
No remedy |
Calling base class methods |
Kuchling |
|
Catching multiple exceptions |
Kuchling, Nowak |
|
Explicit self in methods |
Kuchling |
Rejected - this would require name declarations |
Doubled underscores for private variables |
Kuchling |
No remedy |
The .join() string method |
Kuchling |
No remedy |
print >> |
Kuchling |
|
Inconsistent indentation |
Nowak |
Rejected - indentation is central to Python's syntax |
The += operator |
Nowak |
No remedy |
Class attributes vs instance attributes |
Nowak |
No remedy |
Mutable default arguments |
Nowak, Ferg, Lutz |
No remedy |
Ferg |
No remedy |
|
Ferg |
||
Ferg, Lutz |
Rejected - taking a reference to a function/method is a feature |
|
Imports and reloading |
Lutz |
No remedy - improved reloading has been considered |
Inconsistent/unpredictable comparisons/ordering |
Mertz |
No remedy |
Deficient sequence support for iterators, generators |
Mertz |
No remedy |
Attribute access mechanism proliferation |
Mertz |
No remedy - Mertz suggests standard decorators |