[Python-Dev] Dinamically set __call__ method

Skip Montanaro skip.montanaro at gmail.com
Tue Nov 4 19:25:09 CET 2014


On Tue, Nov 4, 2014 at 10:52 AM, Roberto Martínez <
robertomartinezp at gmail.com> wrote:

> $ cat testcall.py
> class A:
>

You are using old-style classes in Python 2.7 unless you explicitly inherit
from object. If I vary the class line to be "class A(object):" I get the
same behavior with 2.7 as you see with 3.4. My guess is this causes the
different behavior between versions. You might also find it useful to
"print A.__call__" and "print a.__call__" with different class statements.

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141104/fbaa4d0e/attachment.html>


More information about the Python-Dev mailing list