I didn't mean to be extremely rude. Just a little bit..~:-). sorry. On Sun, 05 Dec 2004 12:09:22 -0800, Josiah Carlson <[EMAIL PROTECTED]> wrote: > [snip]
> > Goodness, you got right snippy with the 'intellectual property' thing. > I'm sorry if it sounded as if I had meant "I came up with this before", > I did not mean it that way. What I meant was "good advice", "I've seen > this advice before", and "I've previously taken note of it". As an > aside, I also believe that if Fredrik were concerned about my supposed > theft of his 'advice IP', he would mention it > > Confusions about 'is' are quite common. Perhaps every week a new thread > in regards to object identity is offered, usually asking about integer, > string or list identity. I'm not having much luck with the google > incantation right now, but my email archive is spitting back a thread on > "interning strings" from early November, which discusses strings and > identity. > > Really, everyone who is thinking of using 'is' should ask themselves > whether or not it is truely important to have the same object. In some > cases it matters, and in others cases it doesn't matter. The more > experience one has with Python and the implementations of algorithms, > the more obvious such choices will become. > > A perfect example of a case when using 'is' is proper is by Barry Warsaw > (http://mail.python.org/pipermail/python-dev/2004-March/043224.html): > > missing = object() > > if d.get('somekey', missing) is missing: > # it ain't there > > In the case of it not mattering, there was a series of threads in March > of this year in python-dev, discussing replacing the 'is' operator > strictly comparing object identity with a 'can be replaced by' operator, > spelled 'is'. See the threads entitled "redefining is" here: > http://mail.python.org/pipermail/python-dev/2004-March/thread.html > Of course it came out that it didn't happen ('is' is much faster, and > doesn't require objects to define a mechanism to get at their contents, > etc.), but it is not uncommon for people who think they want 'is' to > really want 'can be replaced by', especially in the case of tuples: > > >>> a = tuple(list('hello')) > >>> b = tuple(list('hello')) > >>> a == b > True > >>> a is b > False > >>> CanBeReplacedBy(a, b) > True > >>> > > (of course you need a proper implementation of CanBeReplacedBy, of which > a few are offered in the previously mentioned 'replacing is' threads). > > Now, whether or not knowing what 'is' does, or whether knowing the > internals in regards to how object identity works, is necessary for > learning the language, I don't know. It's been a few years since I was > a newb, but considering all of the questions regarding 'is' usually > resulting with python-list saying "you want '=='", I'd offer, 'it is not > necessary'. > > > - Josiah Thanx. Appreciate it. :) -- cheers, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list