why () is () and [] is [] work in other way?
Ian Kelly
ian.g.kelly at gmail.com
Thu Apr 26 13:04:12 EDT 2012
More information about the Python-list mailing list
Thu Apr 26 13:04:12 EDT 2012
- Previous message (by thread): Python id() does not return an address [was Re: 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 Thu, Apr 26, 2012 at 3:10 AM, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote: > But I was actually referring to something more fundamental than that. The > statement "a is b" is a *direct* statement of identity. "John is my > father." "id(a) == id(b)" is *indirect*: "The only child of John's > grandfather is the parent of the mother-in-law of my sister-in-law" sort > of thing. (Excuse me if I got the relationships mixed up.) I might have used a different example: 1) "John is my father." 2) "John has the same social security number as my father." The first is concise and clearly expresses the intended statement of identity. The second could be read to imply any number of things: "John is my father." "Somebody at the SSA messed up and gave John the same SSN as my father." "John is an identity thief." If the assertion I'm trying to express is that John is my father, then the direct statement #1 is the best way to convey that, at least in English. Likewise, "a is b" more clearly expresses the intended comparison than does "id(a) == id(b)".
- Previous message (by thread): Python id() does not return an address [was Re: 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