R. David Murray added the comment:

"magic methods" like __enter__ and __exit__ are only looked up on the class, 
not on the instance.  This is by design.

In some older versions of Python some specific methods (and I think __enter__ 
and __exit__ were among them for a time) were looked up on the instances, but 
this was a bug.

(Personally I think it would be nice if they were looked up on the instances, 
but there are good reasons why this is not done.)

----------
nosy: +r.david.murray
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20149>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to