[Python-ideas] Documenting Python warts on Stack Overflow

Chris Angelico rosuav at gmail.com
Tue Jan 1 23:16:39 CET 2013


On Wed, Jan 2, 2013 at 8:55 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> The problem is you are listing examples which *in your opinion* are
> issues with Python. Other people would have different ideas of what is
> an issue and what is not. This can't be the right methodology if we
> want to write a piece of Python docs. Only things which are
> *well-known* annoyances can qualify.

My understanding of a "Python wart" is that it's something that cannot
be changed without readdressing some fundamental design. For example,
Python has decided that indentation and line-endings are significant -
that a logical statement ends at end-of-line. Python has further
decided that line continuation characters are unnecessary inside
parenthesized expressions. Resultant wart: Breaking a massive 'for'
loop between its assignment list and its iterable list doesn't work,
even though breaking it anywhere else does. (This question came up on
python-list a little while ago.) Why should it be an error to break it
here, but not there? Why can't I split it like this:

for x,y,z in
  start_point,
  continuation_point,
  end_point
:
  pass

when it's perfectly legal to split it like this:

for (
  x,y,z
) in (
  start_point,
  continuation_point,
  end_point
):
  pass

Well, because you can't. It's a little odd what you can and can't do,
until you understand the underlying system fairly well. It's something
that's highly unlikely to change; one of the premises would have to be
sacrificed (or at least modified) to achieve it.

Something that could be changed if the devs had enough time is a
tracker issue (or a "show me some code" issue - you want to complain,
you can do the work to fix it). Something that could be changed, but
would break backward compatibility is a prime candidate for __future__
and/or Python 4 (like the change of the division operator - that
change introduced its own oddities, some of which may be warts, eg
that int/int->float but sqrt(float) !-> complex). A wart is different
from both of the above.

ChrisA



More information about the Python-ideas mailing list