On 12/17/2011 21:42, Chris Angelico wrote: > Welcome to the list! If you're curious as to what's happened, check > the archives: > http://mail.python.org/pipermail/python-list/ Thanks! Incidentally, is there a good way to respond to the original post in this thread, considering it wasn't delivered to me?
> But [1,2]*2 is operator overloading. The language doesn't quietly > convert [1,2] into a number and multiply that by 2, it keeps it as a > list and multiplies the list by 2. > > Allowing 1 < True is weaker typing. It should be noted, however, that > "1 < True" is False, and "1 > True" is also False. The comparison > doesn't make much sense, but it's not an error. I see where you're coming from, especially as I wouldn't consider overloading a function on types (in a language where that phrase makes sense) moving towards weak typing either. Or at least I wouldn't have before this discussion... At the same time, it seems a bit implementationy. I mean, suppose '1' were an object and implemented __lt__. Does it suddenly become not weak typing because of that? (The other thing is that I think strong vs weak is more subjective than many of the other measures. Is '1 < True' or '"1"+1' weaker? I think it has a lot to do with how the operations provided by the language play to your expectations.) On 12/17/2011 22:05, Chris Angelico wrote: > 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. I'm not quite sure I'd say that it could be 2, exactly, but I definitely disagree with this... after running 'int x = 5, *p = &x' would you say that "p is 5"? (Assume &x != 5.) 1+"one" *points to* "ne", but it's still a pointer. Evan
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list