diff options
author | André Erdmann <dywi@mailerd.de> | 2014-08-23 19:19:53 +0200 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2014-08-23 19:19:53 +0200 |
commit | cb26f0710d0b0559fb0e596e78d308c015c508da (patch) | |
tree | b3cc2c6627b32db2e2c5cb2ebfccef009626b5ec /roverlay/util | |
parent | console/interpreter: minor improvements (diff) | |
download | R_overlay-cb26f0710d0b0559fb0e596e78d308c015c508da.tar.gz R_overlay-cb26f0710d0b0559fb0e596e78d308c015c508da.tar.bz2 R_overlay-cb26f0710d0b0559fb0e596e78d308c015c508da.zip |
minor cleanup
Diffstat (limited to 'roverlay/util')
-rw-r--r-- | roverlay/util/dictwalk.py | 4 | ||||
-rw-r--r-- | roverlay/util/objects.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/roverlay/util/dictwalk.py b/roverlay/util/dictwalk.py index 0813d11..9408623 100644 --- a/roverlay/util/dictwalk.py +++ b/roverlay/util/dictwalk.py @@ -30,8 +30,8 @@ def dictmerge ( iterable, dict_cls=dict, get_key=None, get_value=None ): def dictwalk_create_parent_v ( root, path, dict_create=None, cautious=True ): - """Creates a dict tree structure using keys the given path. The last path - element will not be created. + """Creates a dict tree structure using keys from the given path. + The last path element will not be created. Returns a 3-tuple ( <parent of the last path element>, diff --git a/roverlay/util/objects.py b/roverlay/util/objects.py index 9c73749..0f2a2da 100644 --- a/roverlay/util/objects.py +++ b/roverlay/util/objects.py @@ -59,13 +59,13 @@ class SafeWeakRef ( weakref.ref ): def __repr__ ( self ): obj = self.deref_unsafe() - if obj: - return "<{} at 0x{:x} to {!r} at 0x{:x}>".format ( + if obj is not None: + return "<{} at {:#x} to {!r} at {:#x}>".format ( self.__class__.__name__, id ( self ), obj.__class__.__name__, id ( obj ) ) else: - return "<{} at 0x{:x} to None>".format ( + return "<{} at {:#x} to None>".format ( self.__class__.__name__, id ( self ) ) # --- end of __repr__ (...) --- @@ -109,7 +109,7 @@ class NoneRef ( object ): __nonzero__ = __bool__ def __repr__ ( self ): - return "<NoneRef at 0x{:x}>".format ( id ( self ) ) + return "<NoneRef at {:#x}>".format ( id ( self ) ) # --- end of __repr__ (...) --- # --- end of NoneRef --- |