why () is () and [] is [] work in other way?
Devin Jeanpierre
jeanpierreda at gmail.com
Mon Apr 23 16:27:40 EDT 2012
More information about the Python-list mailing list
Mon Apr 23 16:27:40 EDT 2012
- Previous message (by thread): why () is () and [] is [] work in other way?
- Next message (by thread): why () is () and [] is [] work in other way?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Apr 23, 2012 at 3:58 PM, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote: >> Whether a and b are the same object is implementation-dependent. > > And that has absolutely nothing to do with the behaviour of "is". The > "is" operator is not responsible for whether a and b are the same object. Heh, it has everything to do with the behavior of is. Although I know what you mean. > Short of having "is" be a null-op that always returns False, there are no > changes you can make to the definition of "is" that will make "a is b" > any more predictable. Well, no. Immutable objects could always compare equal, for example. This is more expensive though. is as-it-stands is very quick to execute, which is probably attractive to some people (especially for its used in detecting special constants). -- Devin
- Previous message (by thread): why () is () and [] is [] work in other way?
- Next message (by thread): why () is () and [] is [] work in other way?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list