On 09/11/2013 01:41 PM, Markus Rother wrote:
4. As has been mentioned already, some built-in functions do magic stuff behind the scenes:
That's why they're called magic methods. ;)
>>> () == [] False But: >>> bool(().__eq__([])) True
This is not a trap, this is simply the wrong way to do it. The magic methods (aka dunder methods) are there for Python to call, not you (except under special circumstances, such as when writing your own dunder methods).
-- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list