homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: UUID module for Python
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, ianbicking, ping, quiver, stroeder, tim.peters, tmick
Priority: normal Keywords: patch

Created on 2005年11月29日 08:58 by ping, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
uuid.py ping, 2005年11月30日 11:53 UUID object and generator for v1, v3, v4, v5 UUIDs
Messages (14)
msg49139 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2005年11月29日 08:58
I recently tossed off a module to generate UUIDs
because i needed one. Fredrik Lundh suggested i submit
it here for inclusion in the standard library.
See http://zesty.ca/python/uuid.html for a pydoc page.
The module provides a UUID class for representing UUIDs
and can generate version 1, 3, 4, or 5 UUIDs.
One drawback of the implementation is that it currently
runs external programs ("ipconfig" or "ifconfig") to
obtain the Ethernet hardware address used in a version
1 UUID. The version 1 UUID implementation also does
not use persistent storage to determine the clock
sequence number.
msg49140 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2005年11月29日 09:14
Logged In: YES 
user_id=45338
This update fixes __repr__ to return a proper expression
and adds the use of os.urandom (if available) to generate
randomness for version 4 UUIDs.
msg49141 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2005年11月29日 09:14
Logged In: YES 
user_id=45338
This update fixes __repr__ to return a proper expression
and adds the use of os.urandom (if available) to generate
randomness for version 4 UUIDs.
msg49142 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2005年11月29日 09:14
Logged In: YES 
user_id=45338
This update fixes __repr__ to return a proper expression
and adds the use of os.urandom (if available) to generate
randomness for version 4 UUIDs.
msg49143 - (view) Author: Ka-Ping Yee (ping) * (Python committer) Date: 2005年11月30日 11:54
Logged In: YES 
user_id=45338
This update fixes the order of the bytes in a hash-generated
UUID. With this fix, the interpretation of RFC 4122 is that
"octet 0" refers to the MOST significant octet, i.e. the one
printed on the left.
msg49144 - (view) Author: Michael Ströder (stroeder) Date: 2005年12月07日 23:47
Logged In: YES 
user_id=64920
I'd like to see some constants pre-calculated for gaining
performance, e.g. during mass data handling. E.g. the MAC
address should only determined once after startup. Or at
least as key-word argument so that the caller can decide to
cache the MAC address.
def uuid1(node=None):
 [..]
 node = node or getaddr()
msg49145 - (view) Author: Ian Bicking (ianbicking) * Date: 2006年03月07日 08:06
Logged In: YES 
user_id=210337
We had some minor problems backporting this to Python 2.3;
this fixed it:
- uuid = UUID(randrange(1<<32L), randrange(1<<16),
randrange(1<<16),
- randrange(1<<8), randrange(1<<8),
randrange(1<<48L))
+ uuid = UUID(randrange(1<<32), randrange(1<<16),
randrange(1<<16),
+ randrange(1<<8), randrange(1<<8),
randrange(1<<48))
I'm not sure what the most current version looks like, so
this might not be a problem anymore (e.g. if the values get
precalculated)
msg49146 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2006年03月07日 15:45
Logged In: YES 
user_id=31435
On c.l.py, Thomas Heller noted:
"""
I haven't used this module, but:
The wingetaddr() function doesn't work on a german version
of windows (there is no line in the output that starts with
'physical address').
In getaddr(), what if windows is installed on the D: drive?
"""
msg49147 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2006年03月07日 16:27
Logged In: YES 
user_id=671362
One more thing about getaddr function.
On Win 2k, "C:\WINNT" is used instead of XP-
like "C:\windows".
(If I remember correctly, Win 2k is still supportted. Am I 
right?)
msg49148 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006年03月07日 17:58
Logged In: YES 
user_id=849994
Instead of hardcoding directories for ipconfig, why not try
spawnp directly on UNIX or use something like
webbrowser._iscommand?
Minor nit: a,b,c = [1,2,3] is better a,b,c=1,2,3
msg49149 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2006年03月07日 18:20
Logged In: YES 
user_id=34892
> On Win 2k, "C:\WINNT" is used instead of XP-like 
> "C:\windows".
Perhaps uuid.py could use the "windir" environment variable.
It is defined on (at least) WinXP, Win2k, WinMe that I could
check and points to C:\WINDOWS (on WinXP and WinMe) and
C:\WINNT (on Win2k).
It would first be good to verify if it is defined on WinNT
and Win9x.
msg49150 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2006年03月07日 18:28
Logged In: YES 
user_id=34892
> use something like webbrowser._iscommand
I have a Python implementation of `which`:
 http://trentm.com/projects/which/
 http://trentm.com/projects/which/which.py
though that is likely overkill for this case.
msg49151 - (view) Author: Trent Mick (tmick) (Python triager) Date: 2006年03月07日 18:57
Logged In: YES 
user_id=34892
Would require a C extension but perhaps this could be used
to get the MAC address on Windows instead of running and
grepping (unreliable for different locales as Thomas pointed
out) ipconfig.exe:
http://support.microsoft.com/default.aspx?scid=kb;en-us;118623
How To Get the MAC Address for an Ethernet Adapter
msg49152 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006年07月03日 13:32
Logged In: YES 
user_id=849994
This module was now added to the stdlib.
History
Date User Action Args
2022年04月11日 14:56:14adminsetgithub: 42641
2005年11月29日 08:58:44pingcreate

AltStyle によって変換されたページ (->オリジナル) /