Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77)

Unified Diff: Doc/library/sys.rst

Issue 2414: Add gc header size to returned sizeof information SVN Base: http://svn.python.org/view/*checkout*/python/trunk/
Patch Set: added a default return value and made this and the gc_head inclusion optional Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
« no previous file | Lib/test/test_sys.py » ('j') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file | Lib/test/test_sys.py » ('j')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497