"Eric S. Raymond" wrote: > > So I'm writing a module to that needs to generate unique cookies. The > module will run inside one of two environments: (1) a trivial test wrapper, > not threaded, and (2) a lomg-running multithreaded server. What do you mean by "unique"? Unique regarding your long-running server? If so, then I wonder why one should do > > So, how about `time.time()` + hex(hash([]))? > instead of using a single, simple counter for all sessions? > It looks to me like this will remain unique forever, because another thread > would have to create an object at the same memory address during the same > millisecond to collide. > > Furthermore, it looks to me like this hack might be portable to any OS > with a clock tick shorter than its timeslice. > > Comments? If I'm not overlooking something fundamental, the counter approach seems to be simpler and most portable. :-) but-sometimes-my-brain-malfunctions-badly-ly y'rs - chris -- Christian Tismer :^) <mailto:tismer@tismer.com> Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4