diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-26 23:35:13 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-27 00:11:36 +0200 |
commit | e9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a (patch) | |
tree | c14b5aea484651e297487f3612ac14b899b57bf9 /tests | |
parent | 9b196cddab80e24b9ce66b1c922cb757b11fb16a (diff) | |
download | micropython-e9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a.tar.gz micropython-e9137b94f27594ea1bdeb5fa4eaddffcbb7b9e9a.zip |
py: Implement getattr() builtin.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/getattr1.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/getattr1.py b/tests/basics/getattr1.py new file mode 100644 index 0000000000..7b7e073922 --- /dev/null +++ b/tests/basics/getattr1.py @@ -0,0 +1,15 @@ +class A: + + var = 132 + + def __init__(self): + self.var2 = 34 + + def meth(self, i): + return 42 + i + + +a = A() +print(getattr(a, "var")) +print(getattr(a, "var2")) +print(getattr(a, "meth")(5)) |