mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-19 13:15:00 -04:00
added optional default value to get()
This commit is contained in:
parent
a0fddbf147
commit
ce6815042f
@ -1,9 +1,5 @@
|
|||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
|
||||||
# TODO: add callback mechanism when values change.
|
|
||||||
# Should we announce every change through the messenger?
|
|
||||||
# Should you be able to hang a hook on a particular name?
|
|
||||||
|
|
||||||
class BulletinBoard:
|
class BulletinBoard:
|
||||||
"""This class implements a global location for key/value pairs to be
|
"""This class implements a global location for key/value pairs to be
|
||||||
stored. Intended to prevent coders from putting global variables directly
|
stored. Intended to prevent coders from putting global variables directly
|
||||||
@ -14,8 +10,8 @@ class BulletinBoard:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._dict = {}
|
self._dict = {}
|
||||||
|
|
||||||
def get(self, postName):
|
def get(self, postName, default=None):
|
||||||
return self._dict.get(postName)
|
return self._dict.get(postName, default)
|
||||||
|
|
||||||
def has(self, postName):
|
def has(self, postName):
|
||||||
return postName in self._dict
|
return postName in self._dict
|
||||||
|
Loading…
x
Reference in New Issue
Block a user