[docs] [issue15436] __sizeof__ is not documented

Martin v. Löwis report at bugs.python.org
Sun Jul 29 18:18:05 CEST 2012

Martin v. Löwis added the comment:

rhettinger: users frequently need sys.getsizeof. See, for example,

[and so on]

In what cases, do you think, it generates meaningless results? I find the results for the shared-keys dictionary quite meaningful and natural.

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.

nosy: +loewis

Python tracker <report at bugs.python.org>

More information about the docs mailing list