Uniform Function Call Syntax (UFCS)

Chris Angelico rosuav at gmail.com
Sun Jun 8 13:13:17 EDT 2014


On Mon, Jun 9, 2014 at 3:08 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Sun, Jun 8, 2014 at 10:48 AM, Chris Angelico <rosuav at gmail.com> wrote:
>> Except that it's even more complicated than that, because hasattr
>> wasn't defined in your module, so it has a different set of globals.
>> In fact, this would mean that hasattr would become quite useless.
>
> hasattr is a builtin, so it has no globals at all.  It would have to
> use the calling scope for UFCS resolution as in my example
> implementation.

Same difference. It can't simply look for the name in globals(), it
has to figure out based on the caller's globals.

ChrisA



More information about the Python-list mailing list