walterbyrd wrote:

> I have read that in Python 3.0, the following will raise an exception:
> 
>>>> [2, 1, 'A'].sort()
> 
> Will that raise an exception? 

Yes.

>>> [2, 1, "a"].sort()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: str() < int()

> And, if so, why are they doing this? How 
> is this helpful? Is this new "enhancement" Pythonic?

Is 1 > "A"? Is ord("B") > "A", "11" > 10? 
What happens for sorted([datetime.time(), "now"])? 

As the Zen puts it:

"In the face of ambiguity, refuse the temptation to guess."

So yes, I think this is an enhancement, and a pythonic one.

Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to