On Oct 7, 3:27 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > The meaning comes from the most common usage.
I wasn't suggesting that the "in" keyword have a different sematic for sequence types. I was just saying that regarding the question whether there is anything similar to "dict.has_key / k in dict" for lists, the "in" keyword is not semantically analogous. > Because it's not needed at all: valid sequence indexes are *exactly* > range(len(seq)). This is the basic point of being a sequence: when > indexes are not contiguous, in fact you have a mapping, not a sequence. True. But valid dictionary keys are exactly d.keys(). The has_key method is just sugar. > Sometimes, maybe... But since you can write it efficientely in a few > lines when needed, I don't see the need to put it into the core language. Couldn't the same be said for dictionaries? I could write for sequences: if index < len(seq) and seq[index]: ... But I could also write for dictionaries: if key in dic.keys() and dic[key]: ... I just wonder why the syntactic sugar was added for dicts, but not for sequence types. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list