[docs] [issue15436] __sizeof__ is not documented

Serhiy Storchaka report at bugs.python.org
Sun Jul 29 18:57:21 CEST 2012


Serhiy Storchaka added the comment:

> sys.getsizeof is certainly CPython-specific. However, __sizeof__ is not
> just an implementation detail of sys.getsizeof, just as __len__ is not an
> implementation detail of len(). Authors of extension types are supposed to
> implement it if object.__sizeof__ is incorrect.

I think there is one difference between __len__ and __sizeof__. __sizeof__ 
should be overloaded only for C-implemented classes. IMHO, it is a part of C 
API.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15436>
_______________________________________


More information about the docs mailing list