[Python-Dev] Python 2.x and 3.x use survey, 2014 edition

Mark Roberts wizzat at gmail.com
Tue Dec 16 19:48:07 CET 2014


On Tue, Dec 16, 2014 at 2:45 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> Iterating accross a dictionary doesn't need compatibility shims. It's
> dead simple in all Python versions:
>
> $ python2
> Python 2.7.8 (default, Oct 20 2014, 15:05:19)
> [GCC 4.9.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> d = {'a': 1}
> >>> for k in d: print(k)
> ...
> a
>
> $ python3
> Python 3.4.2 (default, Oct  8 2014, 13:08:17)
> [GCC 4.9.1] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> d = {'a': 1}
> >>> for k in d: print(k)
> ...
> a
>
> Besides, using iteritems() and friends is generally a premature
> optimization, unless you know you'll have very large containers.
> Creating a list is cheap.
>

It seems to me that every time I hear this, the author is basically
admitting that Python is a toy language not meant for "serious computing"
(where serious is defined in extremely modest terms). The advice is also
very contradictory to literally every talk on performant Python that I've
seen at PyCon or PyData or ... well, anywhere. And really, doesn't it
strike you as incredibly presumptuous to call the *DEFAULT BEHAVIOR* of
Python 3 a "premature optimization"? Isn't the whole reason that the
default behavior switch was made is because creating lists willy nilly all
over the place really *ISN'T* cheap? This isn't the first time someone has
tried to run this line past me, but it's the first time I've been fed up
enough with the topic to call it complete BS on the spot. Please help me
stop the community at large from saying this, because it really isn't true
at all.

-Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141216/39e36aa5/attachment.html>


More information about the Python-Dev mailing list