A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038979.html below:

[Python-Dev] The Trick

[Python-Dev] The TrickSamuele Pedroni pedronis at bluewin.ch
Sat Oct 18 15:29:56 EDT 2003
At 14:43 18.10.2003 -0500, Michel Pelletier wrote:
> > I don't like the trick of avoiding the copy if
> > the refcount is one;
> > AFAIK it can't be done in Jython.
>
>It may be possible with the java.lang.ref
>package using a somewhat similar trick by (I
>imagine) holding a soft reference and examining
>the object's rechability to the collector.
>-Michel

no, if you put the last reference to an object
in a weak-ref and trigger a GC (which is btw
expensive), well you can discover that there was
just one reference but you have also lost the object.

Now if you have a tiny wrapper/contents organization
you can overcome this, playing the trick with
the wrapper and keeping the contents, OTOH
as I said, the explicit GC is expensive, likely more
than allocating and copying.

regards.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4