all() is slow?

Ethan Furman ethan at stoneleaf.us
Thu Nov 10 16:47:48 EST 2011


Devin Jeanpierre wrote:
> The only reason valid python identifiers come into it at all is
> because they get pasted into a string where identifiers would go, and
> that string is passed to exec().
> 
> So really, does it have "nothing" to do with exec? Or does your
> argument eventually boil down to the use of exec?

As I recall the big reason for namedtuples was things like

     sys.version_info[1]  # behind door number one is...

being much more readable as

     sys.version_info.minor

In other words, the tuple offsets are named -- hence, namedtuples.  And 
only valid identifiers will work.

So, no, it has nothing to do with 'exec', and everything to do with the 
problem namedtuple was designed to solve.

~Ethan~



More information about the Python-list mailing list