Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-14 Thread Terry Wilson
On Sep 13, 2016 10:42 PM, "Kevin Benton" wrote: > > >All performance matters. All memory consumption matters. Being wasteful over a purely aesthetic few extra characters of code is silly. > > Isn't the logical conclusion of this to write everything in a different language? :)

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Jay Pipes
On 09/13/2016 08:23 PM, Terry Wilson wrote: On Tue, Sep 13, 2016 at 6:31 PM, Jay Pipes wrote: On 09/13/2016 01:40 PM, Terry Wilson wrote: On Thu, Jun 11, 2015 at 8:33 AM, Sean Dague wrote: On 06/11/2015 09:02 AM, Jay Pipes wrote: On 06/11/2015 01:16

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Kevin Benton
>All performance matters. All memory consumption matters. Being wasteful over a purely aesthetic few extra characters of code is silly. Isn't the logical conclusion of this to write everything in a different language? :) On Tue, Sep 13, 2016 at 8:42 AM, Terry Wilson wrote:

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Terry Wilson
On Tue, Sep 13, 2016 at 6:31 PM, Jay Pipes wrote: > On 09/13/2016 01:40 PM, Terry Wilson wrote: >> >> On Thu, Jun 11, 2015 at 8:33 AM, Sean Dague wrote: >>> >>> On 06/11/2015 09:02 AM, Jay Pipes wrote: On 06/11/2015 01:16 AM, Robert Collins wrote:

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Jay Pipes
On 09/13/2016 01:40 PM, Terry Wilson wrote: On Thu, Jun 11, 2015 at 8:33 AM, Sean Dague wrote: On 06/11/2015 09:02 AM, Jay Pipes wrote: On 06/11/2015 01:16 AM, Robert Collins wrote: But again - where in OpenStack does this matter the slightest? Precisely. I can't think of a

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Terry Wilson
On Thu, Jun 11, 2015 at 8:33 AM, Sean Dague wrote: > On 06/11/2015 09:02 AM, Jay Pipes wrote: >> On 06/11/2015 01:16 AM, Robert Collins wrote: >>> But again - where in OpenStack does this matter the slightest? >> >> Precisely. I can't think of a single case where we are iterating

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Ed Leafe
On Sep 13, 2016, at 10:42 AM, Terry Wilson wrote: > All performance matters. All > memory consumption matters. Being wasteful over a purely aesthetic few > extra characters of code is silly. import this -- Ed Leafe

Re: [openstack-dev] [all][python3] use of six.iteritems()

2016-09-13 Thread Terry Wilson
On Wed, Jun 10, 2015 at 4:41 AM, Robert Collins wrote: > On 10 June 2015 at 21:30, Ihar Hrachyshka wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA256 >> >> On 06/10/2015 02:15 AM, Robert Collins wrote: >>> I'm very glad folk are working

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-15 Thread Robert Collins
On 12 June 2015 at 05:39, Dolph Mathews dolph.math...@gmail.com wrote: On Thu, Jun 11, 2015 at 12:34 AM, Robert Collins robe...@robertcollins.net wrote: On 11 June 2015 at 17:16, Robert Collins robe...@robertcollins.net wrote: This test conflates setup and execution. Better like my

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread gordon chung
] [all][python3] use of six.iteritems() On 11 June 2015 at 17:16, Robert Collins robe...@robertcollins.net wrote: This test conflates setup and execution. Better like my example, ... Just had it pointed out to me that I've let my inner asshole out again - sorry. I'm going to step away from

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Mike Bayer
...@robertcollins.net To: openstack-dev@lists.openstack.org mailto:openstack-dev@lists.openstack.org Subject: Re: [openstack-dev] [all][python3] use of six.iteritems() On 10 June 2015 at 17:22, gordon chung g...@live.ca mailto:g...@live.ca wrote: maybe the suggestion

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread gordon chung
it is just me, or are these differences pretty negligible considering  this is the 1 million item dictionary, which in itself is a unicorn in openstack code or really most code anywhere? as was stated before, if we have million-item dictionaries floating around, that code has problems. I

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Victor Stinner
Hi, Le 10/06/2015 02:15, Robert Collins a écrit : python2.7 -m timeit -s 'd=dict(enumerate(range(100)))' 'for i in d.items(): pass' 10 loops, best of 3: 76.6 msec per loop python2.7 -m timeit -s 'd=dict(enumerate(range(100)))' 'for i in d.iteritems(): pass' 100 loops, best of 3: 22.6

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Jay Pipes
On 06/11/2015 01:16 AM, Robert Collins wrote: But again - where in OpenStack does this matter the slightest? Precisely. I can't think of a single case where we are iterating over anywhere near the number of dictionary items that we would see any impact whatsoever. Best, -jay

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Sean Dague
On 06/11/2015 09:02 AM, Jay Pipes wrote: On 06/11/2015 01:16 AM, Robert Collins wrote: But again - where in OpenStack does this matter the slightest? Precisely. I can't think of a single case where we are iterating over anywhere near the number of dictionary items that we would see any

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Dolph Mathews
On Thu, Jun 11, 2015 at 12:34 AM, Robert Collins robe...@robertcollins.net wrote: On 11 June 2015 at 17:16, Robert Collins robe...@robertcollins.net wrote: This test conflates setup and execution. Better like my example, ... Just had it pointed out to me that I've let my inner asshole out

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Mike Bayer
On 6/11/15 1:39 PM, Dolph Mathews wrote: On Thu, Jun 11, 2015 at 12:34 AM, Robert Collins robe...@robertcollins.net mailto:robe...@robertcollins.net wrote: On 11 June 2015 at 17:16, Robert Collins robe...@robertcollins.net mailto:robe...@robertcollins.net wrote: This test

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Nikhil Komawar
+1 : .items() Why can't we just add six.iteritems calls case by case basis (if that happens)? Regex substitutions for a library call don't make sense to me on such a massive scale. On 6/11/15 11:00 AM, Victor Stinner wrote: Hi, Le 10/06/2015 02:15, Robert Collins a écrit : python2.7 -m

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread John Dennis
On 06/11/2015 01:46 PM, Mike Bayer wrote: I am firmly in the let's use items() camp. A 100 ms difference for a totally not-real-world case of a dictionary 1M items in size is no kind of rationale for the Openstack project - if someone has a dictionary that's 1M objects in size, or even 100K,

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Clint Byrum
Top posting as this is more a response to the whole thread. My take aways from the most excellent discussion: * There is some benefit to iteritems in python2 when you need it. * OpenStack does not seem to need it - Except in places that are operating on tens of thousands of large objects

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-11 Thread Nikhil Komawar
On 6/11/15 2:45 PM, John Dennis wrote: On 06/11/2015 01:46 PM, Mike Bayer wrote: I am firmly in the let's use items() camp. A 100 ms difference for a totally not-real-world case of a dictionary 1M items in size is no kind of rationale for the Openstack project - if someone has a dictionary

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Sean Dague
On 06/09/2015 08:15 PM, Robert Collins wrote: I'm very glad folk are working on Python3 ports. I'd like to call attention to one little wart in that process: I get the feeling that folk are applying a massive regex to find things like d.iteritems() and convert that to six.iteritems(d).

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Robert Collins
On 10 June 2015 at 21:30, Ihar Hrachyshka ihrac...@redhat.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/10/2015 02:15 AM, Robert Collins wrote: I'm very glad folk are working on Python3 ports. I'd like to call attention to one little wart in that process: I get the

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Ihar Hrachyshka
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/10/2015 02:15 AM, Robert Collins wrote: I'm very glad folk are working on Python3 ports. I'd like to call attention to one little wart in that process: I get the feeling that folk are applying a massive regex to find things like

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Robert Collins
On 10 June 2015 at 17:22, gordon chung g...@live.ca wrote: maybe the suggestion should be don't blindly apply six.iteritems or items rather than don't apply iteritems at all. admittedly, it's a massive eyesore, but it's a very real use case that some projects deal with large data results

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread gordon chung
Date: Wed, 10 Jun 2015 21:33:44 +1200 From: robe...@robertcollins.net To: openstack-dev@lists.openstack.org Subject: Re: [openstack-dev] [all][python3] use of six.iteritems() On 10 June 2015 at 17:22, gordon chung g...@live.ca wrote: maybe the suggestion should be don't blindly apply

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Robert Collins
On 11 June 2015 at 17:16, Robert Collins robe...@robertcollins.net wrote: This test conflates setup and execution. Better like my example, ... Just had it pointed out to me that I've let my inner asshole out again - sorry. I'm going to step away from the thread for a bit; my personal state

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Robert Collins
On 11 June 2015 at 15:48, Dolph Mathews dolph.math...@gmail.com wrote: tl;dr .iteritems() is faster and more memory efficient than .items() in python2 Using xrange() in python2 instead of range() because it's more memory efficient and consistent between python 2 and 3... # xrange() +

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-10 Thread Dolph Mathews
...@live.ca wrote: Date: Wed, 10 Jun 2015 21:33:44 +1200 From: robe...@robertcollins.net To: openstack-dev@lists.openstack.org Subject: Re: [openstack-dev] [all][python3] use of six.iteritems() On 10 June 2015 at 17:22, gordon chung g...@live.ca wrote: maybe the suggestion should

[openstack-dev] [all][python3] use of six.iteritems()

2015-06-09 Thread Robert Collins
I'm very glad folk are working on Python3 ports. I'd like to call attention to one little wart in that process: I get the feeling that folk are applying a massive regex to find things like d.iteritems() and convert that to six.iteritems(d). I'd very much prefer that such a regex approach move

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-09 Thread Jay Pipes
On 06/09/2015 08:15 PM, Robert Collins wrote: I'm very glad folk are working on Python3 ports. I'd like to call attention to one little wart in that process: I get the feeling that folk are applying a massive regex to find things like d.iteritems() and convert that to six.iteritems(d). I'd

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-09 Thread Carl Baldwin
+1 Don't forget values and keys in addition to items. They aren't as common but come up every so often. I think you can iterate the keys just by iterating on the dict itself. Carl On Jun 9, 2015 6:18 PM, Robert Collins robe...@robertcollins.net wrote: I'm very glad folk are working on

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-09 Thread Eugene Nikanorov
Huge +1 both for the suggestion and for reasoning. It's better to avoid substituting language features by a library. Eugene. On Tue, Jun 9, 2015 at 5:15 PM, Robert Collins robe...@robertcollins.net wrote: I'm very glad folk are working on Python3 ports. I'd like to call attention to one

Re: [openstack-dev] [all][python3] use of six.iteritems()

2015-06-09 Thread gordon chung
py2 to py3 cheers, gord Date: Wed, 10 Jun 2015 12:15:33 +1200 From: robe...@robertcollins.net To: openstack-dev@lists.openstack.org Subject: [openstack-dev] [all][python3] use of six.iteritems() I'm very glad folk are working on Python3 ports. I'd