python - Sorting large numbers -


if 1 has list of very large numbers in python, so compiler cannot value of them numbers. there function sort list (while keeping numbers integers) in more efficient way such comparing number number? (but without converting string)

both python 2 , python 3 handle arbitrarily large integers:

>>> [2**34, 2**38, 2**99, 2**122, 2] [17179869184, 274877906944, 633825300114114700748351602688l, 5316911983139663491615228241121378304l, 2] 

and sort them expected:

>>> sorted(_) [2, 17179869184, 274877906944, 633825300114114700748351602688l, 5316911983139663491615228241121378304l] 

(python 2 show l integers larger sys.maxint in example here while python 3 shows integer values same smaller or larger integers)


Comments

Popular posts from this blog

java - Null response to php query in android, even though php works properly -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -