Pythonification of the asterisk-based collection packing/unpacking syntax

Chris Angelico rosuav at gmail.com
Sat Dec 17 23:05:33 EST 2011


On Sun, Dec 18, 2011 at 2:59 PM, Roy Smith <roy at panix.com> wrote:
> It is possible for 1 + "one" to be equal to 2 in C or C++.  All it takes
> is for the string literal to be located at memory location 1.  Not
> likely, but nothing in the language prevents it.

Not quite; 1 + "one" will be "ne", which might happen to be at memory
location 2. The data type is going to be char* (or, in a modern
compiler, const char*), not int. That said, though, I think that (in
this obscure circumstance) it would compare equal with 2. For what
that's worth. :)

ChrisA



More information about the Python-list mailing list