What is up with "=="?
Quentin Crain
czrpb at yahoo.com
Wed Oct 8 16:48:03 EDT 2003
More information about the Python-list mailing list
Wed Oct 8 16:48:03 EDT 2003
- Previous message (by thread): What is up with "=="?
- Next message (by thread): What is up with "=="?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello All! Could someone explain (links are good too!) why: >>> 1+"1" Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unsupported operand types for +: 'int' and 'str' >>> 1=="1" 0 1 Whos __eq__ or __cmp__ is being called: String's or Int's? 2 Why IS comparison supported across types? 3 The exception + gives makes it sound like there is a built-in function + that does not like taking an 'int' and a 'string'. Read this way, the built-in == does accept 'int' and 'string'. Anyway, I have spent a good 10-15 mins googling for things like 'python subclass int' and have not found anything useful. (PEP's 252 and 253 did not help me -- perhaps I misread them?) What am I missing! Quentin ===== -- Quentin Crain ------------------------------------------------ I care desperately about what I do. Do I know what product I'm selling? No. Do I know what I'm doing today? No. But I'm here and I'm gonna give it my best shot. -- Hansel __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com
- Previous message (by thread): What is up with "=="?
- Next message (by thread): What is up with "=="?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list