Skip to content

Commit 5368f27

Browse files
committed
Rename Dyn -> _Dyn (singleton; constructor should be private)
1 parent ec5f328 commit 5368f27

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

unpythonic/collections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .llist import cons
2323
from .misc import getattrrec
2424
from .env import env
25-
from .dynassign import Dyn
25+
from .dynassign import _Dyn
2626

2727
def get_abcs(cls):
2828
"""Return a set of the collections.abc superclasses of cls (virtuals too)."""
@@ -123,7 +123,7 @@ def doit(x):
123123
return {doit(elt) for elt in x}
124124
# env and dyn provide the Mapping API, but shouldn't get the general Mapping treatment here.
125125
# (This is important for the curry and lazify macros.)
126-
elif isinstance(x, Mapping) and not isinstance(x, (env, Dyn)):
126+
elif isinstance(x, Mapping) and not isinstance(x, (env, _Dyn)):
127127
ctor = type(x)
128128
return ctor({k: doit(v) for k, v in x.items()})
129129
elif isinstance(x, Sequence) and not isinstance(x, (str, bytes, range)):

unpythonic/dynassign.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __del__(self):
7373
def _refresh(self):
7474
self.maps = list(reversed(_getstack())) + [_global_dynvars]
7575

76-
class Dyn(Singleton):
76+
class _Dyn(Singleton):
7777
"""This module exports a singleton, ``dyn``, which provides dynamic assignment
7878
(like Racket's ``parameterize``; akin to Common Lisp's special variables.).
7979
@@ -259,7 +259,7 @@ def __setitem__(self, k, v):
259259
def __repr__(self):
260260
bindings = ["{:s}={}".format(k, repr(self[k])) for k in self]
261261
return "<dyn object at 0x{:x}: {{{:s}}}>".format(id(self), ", ".join(bindings))
262-
dyn = Dyn()
262+
dyn = _Dyn()
263263

264264
def make_dynvar(**bindings):
265265
"""Create a dynamic variable and set its default value.
@@ -289,5 +289,5 @@ def make_dynvar(**bindings):
289289

290290
# register virtual base classes
291291
for abscls in (Container, Sized, Iterable, Mapping):
292-
abscls.register(Dyn)
292+
abscls.register(_Dyn)
293293
del abscls

0 commit comments

Comments
 (0)