[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Sat, 15 Feb 2014 10:44:39 +0100, Christian Gollwitzer wrote: > Am 15.02.14 01:57, schrieb Chris Angelico: >> Can you give an example of an ambiguous case? Fundamentally, the 'is' >> operator tells you whether its two operands are exactly the same >> object, nothing more and nothing less, so I assume your "ambiguous >> cases" are ones where it's possible for two things to be either the >> same object or two indistinguishable ones. > > What about the thing I posted down in this thread? > > >>> import numpy as np a=np.array([1, 2, 3, 4]) > >>> b=a[:] > >>> id(a) > 140267900969344 > >>> id(b) > 140267901045920 > > So, a and b are different things, right? > > >>> b[1]=37 b > array([ 1, 37, 3, 4]) > >>> a > array([ 1, 37, 3, 4]) > > Still they are connected. I can imagin that id() is just a debugging > tool for extensions. What useful applications does it have outside of > this? > > Christian try id(a[0]) and id(b[0]) the two tupples are different but they both contain the same list -- If God wanted us to be brave, why did he give us legs? -- Marvin Kitman

- Prev by Date:
**Puzzling PDF** - Next by Date:
**random.sample with large weighted sample-sets?** - Previous by thread:
**Explanation of list reference** - Next by thread:
**Explanation of list reference** - Index(es):