Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

This isn't one exception. For example complex doesn't have the __complex__ 
method.

__str__, __float__, __int__ and __bool__ are implemented in str, float, int and 
bool because there are corresponding special slots in a type object. But 
__bytes__ and __complex__ were added later and they have no slots. Calling them 
for bytes and complex will slowdown creating new object.

The user code rarely needs to call these methods directly. Just call bytes(), 
complex(), str(), float(), etc.

----------
nosy: +serhiy.storchaka

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

Reply via email to