all() is slow?

OKB (not okblacke) brenNOSPAMbarn at NObrenSPAMbarn.net
Fri Nov 11 00:40:09 EST 2011


Devin Jeanpierre wrote:

>> '--' not being allowed for a name has *nothing* to do with exec, and
>> everything to do with `--` not being a valid Python identifier. 
> 
> 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().

    	The whole point of named tuples is to be able to access the members 
via attribute access as in "obj.attr".  Things like "obj.--" are not 
valid Python syntax, so you can't use "--" as the name of a namedtuple 
field.  Yes, you can do "getattr(obj, '--')" if you want, but it's quite 
reasonable for namedtuple to refrain from catering to that sort of 
perverse usage.

-- 
--OKB (not okblacke)
Brendan Barnwell
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown



More information about the Python-list mailing list