Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/basics/class2.py

18 lines
224 B
Python
Raw Normal View History

Add basic functionality tests for the Python bit.
2013-12-29 22:34:42 +00:00
# class with __init__
class C1:
def __init__(self):
self.x = 1
c1 = C1()
Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr. Creating of classes (types) and instances is much more like CPython now. You can use "type('name', (), {...})" to create classes.
2014-01-09 20:57:50 +00:00
print(type(c1) == C1)
Add basic functionality tests for the Python bit.
2013-12-29 22:34:42 +00:00
print(c1.x)
class C2:
def __init__(self, x):
self.x = x
c2 = C2(4)
Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr. Creating of classes (types) and instances is much more like CPython now. You can use "type('name', (), {...})" to create classes.
2014-01-09 20:57:50 +00:00
print(type(c2) == C2)
Add basic functionality tests for the Python bit.
2013-12-29 22:34:42 +00:00
print(c2.x)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 68ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API