pg.object_utils.StrKey#
Accessible via pg.object_utils.StrKey
.
- class StrKey[source]#
Bases:
object
Interface for classes whose instances can be treated as str in
KeyPath
.A
pg.KeyPath
will format the path string using.
(dot) as the delimiter for a key represented by this object. Otherwise[]
(square brackets) will be used as the delimiters.Example:
class MyKey(pg.object_utils.StrKey): def __init__(self, name): self.name = name def __str__(self): return f'__{self.name}__' path = pg.KeyPath(['a', MyKey('b')]) print(str(path)) # Should print "a.__b__"