Python Forum
system-wide unique incrementing string or number
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
system-wide unique incrementing string or number
#11
suppose i get a few of these and put them in a list in the order i get them. is this order the same order as sorted? that is, will thelist == sorted(thelist) be True?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#12
It's easy to test
import random
import uuid

the_list = [uuid.uuid1() for _ in range(10)]
print(the_list == sorted(the_list))
the_copy = the_list[:]
print(the_copy == the_list)
random.shuffle(the_copy)
print(the_copy == the_list)
the_sorted = sorted(the_copy)
print(the_sorted == the_list)
Output:
True True False True
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  convert a string to a number Naheed 7 4,442 Apr-26-2021, 08:08 AM
Last Post: Naheed
  find unique string Skaperen 1 1,739 Nov-06-2019, 06:42 AM
Last Post: perfringo
  Forum-wide Competition: Rock Paper Scissors [Meta-thread] nilamo 10 10,167 Oct-13-2016, 10:41 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020