Re: Python 3.0 - is this true?



walterbyrd <walterbyrd@xxxxxxxxx> 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

.



Relevant Pages