siona at chiark.greenend.org.uk
Wed Jan 30 14:03:08 CET 2008
Benjamin <musiccomposition at gmail.com> wrote:
>> [ help(sys.getrefcount) says: ]
>> [ ... ] The count returned is generally
>> one higher than you might expect, because it includes the (temporary)
>> reference as an argument to getrefcount().
>Are there any cases when it wouldn't?
When the temporary reference which is the argument to getrefcount is
the *only* reference, eg:
>>> sys.getrefcount (set())
The return value for a weakly referenced object may also be not what
>>> s = set()
>>> r = weakref.ref(s)
>>> r() is s
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list