Éric Araujo <mer...@netwok.org> added the comment:

> hasattr(transaction, '__exit__')

http://docs.python.org/dev/reference/datamodel#special-method-names explains 
that magic methods are looked up on the class, not on the instances.  There’s a 
lot of code out there that erroneously checks for __len__ or __call__ on 
instances, and this is the second time to my knowledge that a project abused a 
module-level __enter__ function.

----------
nosy: +eric.araujo

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

Reply via email to