[Tutor] no. of references
hugo.yoshi at gmail.com
Tue Jun 8 15:03:19 CEST 2010
On 8 jun 2010, at 08:08, Payal <payal-python at scriptkitchen.com> wrote:
> If I have a list (or a dict), is there any way of knowing how many
> variables are referencing the same object?
In short, not in any compatible way. If you have a bounded list of
names, you can check them with the is operator. But the question "are
there any names anywhere in my program that refer to this object?" is
generally not answerable.
The more relevant question is: why would you want to know this?
More information about the Tutor