[Tutor] If tuple cannot be sorted, then why sorted() on a tuple is fine?

C W tmrsg11 at gmail.com
Wed Aug 2 15:01:31 EDT 2017


Dear list,

I am a little confused about why Tuple can be sorted.

Suppose I have the following,

> aTuple = (9, 3, 7, 5)
> sorted(aTuple)
[3, 5, 7, 9]

Why is it ok to sort a the class tuple? If it is invariant by nature, then
wouldn't applying a function on it yield an error?

Thanks!


More information about the Tutor mailing list