On May 20, 11:49 am, [EMAIL PROTECTED] wrote: > On May 20, 9:04 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > > > > On May 20, 5:04 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > > John Salerno <[EMAIL PROTECTED]> wrote: > > > >>>> a = 'this is longer' > > > >>>> b = 'this is longer' > > > >>>> a == b > > > > True > > > >>>> a is b > > > > False > > > > > In the above example, Python has created only one string called > > > > 'hello' and both x and y reference it. However, 'this is longer' is > > > > two completely different objects. > > > > That is true when run interactively, but the behaviour changes again if > > > you > > > run it as a script: > > > > C:\Temp>type t.py > > > a = 'this is longer' > > > b = 'this is longer' > > > print a is b > > > > C:\Temp>t > > > True > > > > In short, two equal strings may or may not be identical and any code which > > > makes assumptions based on observed behaviour is broken. If you want to be > > > able to test identity on strings safely then use the 'intern()' builtin to > > > get repeatable behaviour. > > > > -- > > > Duncan Boothhttp://kupuguy.blogspot.com > > > There is no such thing as real true equals. > > That's quite some dark deep philosophy. Fortunately, computers are not > as complicated as real life. I would argue that, programatically, > there *is* such thing as "real true equals". I would also argue that > that view is most certainly not shared by everyone.- Hide quoted text - > > - Show quoted text -
Mean as it sounds, bits are pigeonholes: 5+V or 0. As such, computers are able to simulate numerical identity, but, don't forget, all your inputs are discretized (pigeonholed). Symbolic (mathematical) identity (equality) is defined as a reflexive, symmetric, transitive relation, and partitions its domain into equivalence classes (membership in which is binary). Symbols are outside of cause. Ma: Symbolic identity is a mathematical relation Mb: Symbols are acausal m: Matter is causal C: Symbolic identity is not defined on matter. Further, conclude computers are symbolic only. Now, what can a hoard of people do with some symbols? But, I defer on the practical sense. -- http://mail.python.org/mailman/listinfo/python-list