Python 3K or Python 2.9?

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Fri Sep 14 05:48:30 EDT 2007


Terry Reedy wrote:
> No it does not.  The method wrapping is done at runtine.  The
> compiler is ignorant of the wrapping that will be done.

Agreed, after reading the docs.
 
>>>> dis.dis(f)
>   1           0 LOAD_GLOBAL              0 (c)
>               3 LOAD_ATTR                1 (meth)
>               6 CALL_FUNCTION            0
>               9 RETURN_VALUE
> 
> The function gets wrapped as a bound method as part of LOAD_ATTR. 
> When the compiler sees <expr>(args), it does not know and does not
> care about the
> particular type that <expr> will become.  It just assumes that it
> will be
> callable and emits the code to call it.  Consider

That's interesting. BTW, do you know something (apart from the dis
docs) that's worth reading if you're interested in Python byte
code?

Regards,


Björn

-- 
BOFH excuse #138:

BNC (brain not connected)




More information about the Python-list mailing list