[issue11063] uuid.py module import has heavy side effects

INADA Naoki report at bugs.python.org
Thu Sep 28 05:27:25 EDT 2017


INADA Naoki <songofacandy at gmail.com> added the comment:

How often uuid1 is used?

I never use it and it looks uuid1 makes uuid.py complicated.
How about split it to _uuid1.py (or uuid/__init__.py and uuid/_uuid1.py)?

I hope PEP 562 is accepted.
It ease splitting out (heavy and slow and dirty) part into submodule without breaking backward compatibility.

Without PEP 562, easy way is making proxy function.

# uuid/__init__.py

def uuid1(node=None, clock_seq=None):
    """Generate a UUID from a host ID, sequence number, and the current time.
    If 'node' is not given, getnode() is used to obtain the hardware
    address.  If 'clock_seq' is given, it is used as the sequence number;
    otherwise a random 14-bit sequence number is chosen."""
    from . import _uuid1 
    return _uuid1.uuid1()

----------
nosy: +inada.naoki

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue11063>
_______________________________________


More information about the Python-bugs-list mailing list