On Sat, 29 Jun 2013 14:42:58 -0500, Tim Chase wrote: > On 2013-06-29 19:19, Steven D'Aprano wrote: >> Nobody ever asks why Python doesn't let you sort an int, or take the >> square of a list... > > just to be ornery, you can sort an int: > >>>> i = 314159265 >>>> ''.join(sorted(str(i))) > '112345569' > > And I suppose, depending on how you define it, you can square a list:
Yeah, but my point is that nobody ever *asks* how to do it, because they don't confuse the two concepts. Those who have some need for sorting the digits of an int-as-string work out how to solve the problem without asking. And you'll note I didn't say that nobody confuses an int and a string. That was no accident :-) -- Steven -- http://mail.python.org/mailman/listinfo/python-list