Easier and more self documenting patterns for loading/saving Persistent
[python_utils.git] / id_generator.py
index d4c70166bb3c52974793840cb8bebbf288500a49..4b61a93081d6dd17ab341330e7d4f08991ad4aab 100644 (file)
@@ -1,5 +1,12 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
+"""A helper class for generating thread safe monotonically increasing
+id numbers.
+
+"""
+
 import itertools
 import logging
 
@@ -12,7 +19,7 @@ generators = {}
 
 def get(name: str, *, start=0) -> int:
     """
-    Returns a thread safe monotonically increasing id suitable for use
+    Returns a thread-safe, monotonically increasing id suitable for use
     as a globally unique identifier.
 
     >>> import id_generator
@@ -28,7 +35,7 @@ def get(name: str, *, start=0) -> int:
     if name not in generators:
         generators[name] = itertools.count(start, 1)
     x = next(generators[name])
-    logger.debug(f"Generated next id {x}")
+    logger.debug("Generated next id %d", x)
     return x