diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-08 21:32:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-08 21:32:29 +0100 |
commit | f4c9b33abf0ac6ff97cd39331d125a74fd2bb897 (patch) | |
tree | 64bdfb7d6d032d826640e1f9a43956b0b3947591 /tests/basics/del-attr.py | |
parent | 4671392d90e98ea4edf6e9ce7023d21cc9957d8c (diff) | |
download | micropython-f4c9b33abf0ac6ff97cd39331d125a74fd2bb897.tar.gz micropython-f4c9b33abf0ac6ff97cd39331d125a74fd2bb897.zip |
py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR.
This makes the runtime and object APIs more consistent. mp_store_subscr
functionality now moved into objects (ie list and dict store_item).
Diffstat (limited to 'tests/basics/del-attr.py')
-rw-r--r-- | tests/basics/del-attr.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/basics/del-attr.py b/tests/basics/del-attr.py new file mode 100644 index 0000000000..501c729ceb --- /dev/null +++ b/tests/basics/del-attr.py @@ -0,0 +1,28 @@ +# del a class attribute + +del C.f +try: + print(C.x) +except AttributeError: + print("AttributeError") +try: + del C.f +except AttributeError: + print("AttributeError") + +# del an instance attribute + +c = C() + +c.x = 1 +print(c.x) + +del c.x +try: + print(c.x) +except AttributeError: + print("AttributeError") +try: + del c.x +except AttributeError: + print("AttributeError") |