summaryrefslogtreecommitdiff
path: root/Doc/library/sys.rst
diff options
context:
space:
mode:
authorRobert Schuppenies <okkotonushi@googlemail.com>2008-07-14 10:13:31 +0000
committerRobert Schuppenies <okkotonushi@googlemail.com>2008-07-14 10:13:31 +0000
commitfbe94c55ca482bc30a831f8319bdc2074124a4e3 (patch)
treeef806672dc53507d7529838ad8250feee9b9d88f /Doc/library/sys.rst
parent3065b87a075656d52bb018821c7ba30cea26ec7a (diff)
downloadcpython-git-fbe94c55ca482bc30a831f8319bdc2074124a4e3.tar.gz
Merged revisions 64842,64853,64856,64945 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64842 | robert.schuppenies | 2008-07-10 15:43:26 +0200 (Thu, 10 Jul 2008) | 2 lines Fixed Issue3122 and extended sys.getsizeof tests for built-in types. ........ r64853 | robert.schuppenies | 2008-07-10 17:24:04 +0200 (Thu, 10 Jul 2008) | 3 lines Added additional __sizeof__ implementations and addressed comments made in Issue3122. ........ r64856 | robert.schuppenies | 2008-07-10 19:13:55 +0200 (Thu, 10 Jul 2008) | 3 lines Added garbage collector overhead and optional default return value to sys.getsizeof. ........ r64945 | robert.schuppenies | 2008-07-14 10:42:18 +0200 (Mon, 14 Jul 2008) | 2 lines Fixed test failure on Win64 machines. ........
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 42c36a6fa3..f92b1e4980 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -331,13 +331,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