| Index: Doc/library/sys.rst |
| =================================================================== |
| --- Doc/library/sys.rst (revision 64518) |
| +++ Doc/library/sys.rst (working copy) |
| @@ -409,13 +409,22 @@ |
| :func:`setrecursionlimit`. |
| -.. function:: getsizeof(object) |
| +.. function:: getsizeof(object[, default][, gc_head=True]) |
|
Martin v. Löwis
2008/07/07 05:24:06
I would like to reconsider the addition of the gc_
|
| Return the size of an object in bytes. The object can be any type of |
| object. All built-in objects will return correct results, but this |
| - does not have to hold true for third-party extensions as it is implementation |
| + does not have to hold true for third-party extensions as it is implementation |
| specific. |
| + The *default* argument allows to define a value which will be returned |
| + if the object type does not provide means to retrieve the size and would |
| + cause a `TypeError`. |
| + |
| + func:`getsizeof` calls the object's __sizeof__ method and adds an additional |
| + garbage collector overhead if the object is managed by the garbage collector. |
| + The *gc_head* argument allows to turn off the inclusion of this overhead |
| + in the returned result. |
| + |
| .. versionadded:: 2.6 |