On Apr 20, 2015, at 06:35 PM, Enrico Zini wrote:

>For the sites themselves, it depends. I use dict.iteritems a lot, and I
>do not intend to see my code migrated to use six.iteritems because it
>makes code hard to read, and it then requires a furter migration to make
>it readable again once there is a switch to python3. I can however take
>a migration to .items() for a temporary performance penalty that will go
>away without need of extra intervention after a switch to python3.

Personally, I think the use of dict.iteritems is way overused.  The
performance hit is theoretical unless you've actually measured it, and even
then I think it probably doesn't help much unless you've got huge dicts.

>So, patches that make code work in python3 without breaking idiomatic
>code, good. Patches that turn the code into an intermediate six-based
>language that looks neither like 2 nor 3, no thanks: that code will have
>to be maintained afterwards.

six isn't magical, it's just a convenience.  I usually avoid it unless the
convenience is pretty compelling, which it is in some cases, especially IMHO
when needing lots of six.moves imports.  In others, if I don't already know
how to write compatible code in stdlib Python, I might crack open six to see
how the sausage is made.

>Also, if I implement new features I am not necessarily going to test
>them on python3 unless it somehow happens automatically.

One word: tox :)

>Running the test suite twice is not much of an option, though, because it
>already takes a lot of time to run, and doubling the time it takes just means
>that code is going to get tested less. Unless of course someone reviews my
>test code and finds a way to make it run super fast: I'd certainly welcome
>that!

The nice thing is you can run `tox -e py27` for your normal cases, and then
`tox` before you push updates to just be sure it works for all supported
versions.

Cheers,
-Barry

Attachment: pgppXVDEdmj81.pgp
Description: OpenPGP digital signature

Reply via email to