diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-31 16:07:03 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-31 16:07:03 -0400 |
commit | 59cbb7fc0211d2b74008540e5f53dbce606fbd67 (patch) | |
tree | cdcf9b4994fffb172a93819531e8e379a2e907ba /mop | |
parent | eed0b063a3520c0c55c4e147789e4bbb53e55416 (diff) | |
download | python-mop-59cbb7fc0211d2b74008540e5f53dbce606fbd67.tar.gz python-mop-59cbb7fc0211d2b74008540e5f53dbce606fbd67.zip |
add an attribute method to get the value at that attribute
Diffstat (limited to 'mop')
-rw-r--r-- | mop/__init__.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mop/__init__.py b/mop/__init__.py index 554cc9c..c07b12e 100644 --- a/mop/__init__.py +++ b/mop/__init__.py @@ -227,6 +227,12 @@ def bootstrap(): name="get_body", body=gen_reader("body") )) + def get_value(self, instance): + return instance.slots[self.get_name()] + Attribute.add_method(Method.new( + name="get_value", body=get_value + )) + Class.add_attribute(Attribute.new(name="name")) Class.add_attribute(Attribute.new(name="superclass")) Class.add_attribute(Attribute.new(name="attributes", default=lambda: {})) |