1.1 --- a/micropython/inspect.py Mon Mar 31 00:54:03 2008 +0200
1.2 +++ b/micropython/inspect.py Sun Apr 06 02:53:43 2008 +0200
1.3 @@ -312,6 +312,10 @@
1.4 self.allattr = None # cache for all_attributes
1.5 self.allattr_names = None # from allattr
1.6
1.7 + # Add this class to its attributes.
1.8 +
1.9 + self.set("__class__", self)
1.10 +
1.11 # Image generation details.
1.12
1.13 self.location = None
1.14 @@ -653,6 +657,12 @@
1.15 del self.localnames[name]
1.16 return self.localnames
1.17
1.18 + def is_method(self):
1.19 +
1.20 + "Return whether this function is a method."
1.21 +
1.22 + return isinstance(self.parent, Class)
1.23 +
1.24 def is_relocated(self, name):
1.25
1.26 """
1.27 @@ -669,12 +679,14 @@
1.28
1.29 "Make sure all attributes are fully defined."
1.30
1.31 + i = None
1.32 for i, name in enumerate(self.argnames):
1.33 self[name].position = i
1.34
1.35 - j = i
1.36 - for i, attr in enumerate(self.locals().values()):
1.37 - attr.position = i + j
1.38 + if i is not None:
1.39 + j = i
1.40 + for i, attr in enumerate(self.locals().values()):
1.41 + attr.position = i + j
1.42
1.43 def function_from_method(self):
1.44