1.1 --- a/micropython/data.py Sat Jun 19 02:14:58 2010 +0200
1.2 +++ b/micropython/data.py Sun Jun 27 20:55:48 2010 +0200
1.3 @@ -123,6 +123,11 @@
1.4 def __getitem__(self, name):
1.5 return self.namespace[name]
1.6
1.7 + def get(self, name, default=None):
1.8 + return self.namespace.get(name, default)
1.9 +
1.10 + # Specialised access methods.
1.11 +
1.12 def get_using_node(self, name, node):
1.13
1.14 """
1.15 @@ -144,6 +149,15 @@
1.16
1.17 def _get_with_scope(self, name, external=0):
1.18
1.19 + """
1.20 + Find the source of the given 'name', returning the attribute object,
1.21 + scope (constant, local, global or builtins), and the full name of the
1.22 + source namespace (or None for constants).
1.23 +
1.24 + If the optional 'external' flag is set to a true value, only external
1.25 + (non-local) namespaces will be involved in the search.
1.26 + """
1.27 +
1.28 module = self.module
1.29 builtins = module and module.builtins or None
1.30 importer = module and module.importer or None
1.31 @@ -173,8 +187,7 @@
1.32 else:
1.33 return None, None, None
1.34
1.35 - def get(self, name, default=None):
1.36 - return self.namespace.get(name, default)
1.37 + # Attribute definition methods.
1.38
1.39 def __setitem__(self, name, value):
1.40 self.set(name, value)