Python 3.0 - is this true?

Arnaud Delobelle arnodel at googlemail.com
Sat Nov 8 20:02:28 CET 2008


walterbyrd <walterbyrd at iname.com> writes:

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

Yes.  In fact, plenty of objects of different types aren't comparable
anymore.

> And, if so, why are they doing this?

How is it helpful to be able to sort things which have no natural order?

> How is this helpful?

It goes well with duck typing.  It lets you know when you things happen
that you don't mean to happen.

> Is this new "enhancement" Pythonic?

By definition!

-- 
Arnaud




More information about the Python-list mailing list