A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2017-September/149130.html below:

[Python-Dev] Inplace operations for PyLong objects

[Python-Dev] Inplace operations for PyLong objects [Python-Dev] Inplace operations for PyLong objectsManciu, Catalin Gabriel catalin.gabriel.manciu at intel.com
Fri Sep 1 16:49:44 EDT 2017
> My question is -- how can the interpreter know if it can alter what is 
> supposed to be an immutable in-place? If it's used only internally to a 
> function, the it would be safe, but how to know that?

> -CHB

You can just check the reference count of your object, it's a member of the
PyObject structure which every CPython object contains: ob_refcnt. This will
indicate if your object is referenced by other Python variables or by Python
containers such as lists, tuples, dicts, sets etc.
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