-----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 d.iteritems() and convert that to six.iteritems(d). > > I'd very much prefer that such a regex approach move things to > d.items(), which is much easier to read. > > Here's why. Firstly, very very very few of our dict iterations are > going to be performance sensitive in the way that iteritems() > matters. Secondly, no really - unless you're doing HUGE dicts, it > doesn't matter. Thirdly. Really, it doesn't. >
Does it hurt though? ;) > At 1 million items the overhead is 54ms[1]. If we're doing inner > loops on million item dictionaries anywhere in OpenStack today, we > have a problem. We might want to in e.g. the scheduler... if it > held in-memory state on a million hypervisors at once, because I > don't really to to imagine it pulling a million rows from a DB on > every action. But then, we'd be looking at a whole 54ms. I think we > could survive, if we did that (which we don't). > > So - please, no six.iteritems(). > The reason why in e.g. neutron we merged the patch using six.iteritems is that we don't want to go too deep into determining whether the original usage of iteritems() was justified. The goal of the patch is to get python3 support, not to apply subjective style guidelines, so if someone wants to eliminate .iteritems(), he should create another patch just for that and struggle with reviewing it. While folks interested python3 can proceed with their work. We should not be afraid of multiple patches. Ihar -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVeAO+AAoJEC5aWaUY1u57/XwH/0AsOQHa1IDWOauginSHAbi+ ZNwAUDRSKEI+ydwf9u/DxRkZP2MsiJwAbrlPeGyjr8aqNpqoTLcS5CxYaS7IqSOn khrVGkczv6yNwKrB6j3jAFJtXz+Z2i475eTLJqRgdUeI4gJinhc0ghXJzF+4HpUN 2DewJlOqrD3OWJcUu0Gvmp4aEkr8JK0Iu2crCRoFJ2N5fvv7rt8FfcZ3oGkixJXd n0+xD5Aszl8M/jAv3xt7ZxqFSL7QUiEhAVVgJEHm0D8mAR+2J9bpCKVvjkJ5T7Tw fkHYXetzUipe0MMpXPl3jfSKBitpFOOOEBaqOSXvvgtxAo8U6nkNgPe6n+vuduc= =lUY4 -----END PGP SIGNATURE----- __________________________________________________________________________ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev