Re: [Tutor] no. of references

2010-06-08 Thread Payal
Hi all, Excuse for TOFU. Thanks a lot Steven, Dave and Hugo. Steven the explanation was really great. Thanks a lot for it. Hugo, I was just curious, have no real need. Thanks. With warm regards, -Payal -- On Tue, Jun 08, 2010 at 08:07:28PM +1000, Steven D'Aprano wrote: > On Tue, 8 Jun 2010 04:

Re: [Tutor] no. of references

2010-06-08 Thread Hugo Arts
On 8 jun 2010, at 08:08, Payal wrote: > Hi, > If I have a list (or a dict), is there any way of knowing how many > other > 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 quest

Re: [Tutor] no. of references

2010-06-08 Thread Dave Angel
Payal wrote: Hi, If I have a list (or a dict), is there any way of knowing how many other variables are referencing the same object? With warm regards, -Payal Depends on what you mean by variables. Try sys.getrefcount(mylist) Naturally, the count will be one higher than you expect. And

Re: [Tutor] no. of references

2010-06-08 Thread Steven D'Aprano
On Tue, 8 Jun 2010 04:08:15 pm Payal wrote: > Hi, > If I have a list (or a dict), is there any way of knowing how many > other variables are referencing the same object? Sort of. The question is simple, but the answer isn't. It depends what you mean by "variables", and it requires a good understa

[Tutor] no. of references

2010-06-07 Thread Payal
Hi, If I have a list (or a dict), is there any way of knowing how many other variables are referencing the same object? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.py