all() is slow?

alex23 wuwei23 at gmail.com
Sun Nov 13 21:50:33 EST 2011


On Nov 13, 4:28 pm, Devin Jeanpierre <jeanpierr... at gmail.com> wrote:
> > which implies that getattr(x, 'a!b') should be equivalent to x.a!b
>
> No, it does not. The documentation states equivalence for two
> particular values

It states equivalence for two values _based on the name_.

"If the string is the name of one of the object’s attributes, the
result is the value of that attribute. For example, getattr(x,
'foobar') is equivalent to x.foobar."

The string 'a!b' is the name of the attribute, ergo getattr(x, 'a!b')
_is_ x.a!b. If x.a!b isn't valid CPython, then etc.

> CPython breaks that equivalence

So you're outright ignoring the comments that this behaviour is to
make CPython more performant?



More information about the Python-list mailing list