summaryrefslogtreecommitdiffstats
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorRobert Schuppenies <okkotonushi@googlemail.com>2008-07-10 17:13:55 (GMT)
committerRobert Schuppenies <okkotonushi@googlemail.com>2008-07-10 17:13:55 (GMT)
commit476290299885a87b8b90b55bbfef067945e63913 (patch)
tree0256a50d68580213b98bb1baa63cdd65fbda4a96 /Doc/library/sys.rst
parent5930d8f05e501ac0327c8b752a21412b0fb97cae (diff)
downloadcpython-476290299885a87b8b90b55bbfef067945e63913.zip
cpython-476290299885a87b8b90b55bbfef067945e63913.tar.gz
cpython-476290299885a87b8b90b55bbfef067945e63913.tar.bz2
Added garbage collector overhead and optional default return value to
sys.getsizeof.
Diffstat (limited to 'Doc/library/sys.rst')
-rw-r--r--Doc/library/sys.rst11
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 22397f2..871cec7 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -393,13 +393,20 @@ always available.
:func:`setrecursionlimit`.
-.. function:: getsizeof(object)
+.. function:: getsizeof(object[, default])
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.
+
.. versionadded:: 2.6