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/float/complex_special_methods.py

11 lines
145 B
Python
Raw Normal View History

py/objcomplex: Add mp_obj_get_complex_maybe for use in complex bin-op. This allows complex binary operations to fail gracefully with unsupported operation rather than raising an exception, so that special methods work correctly. Signed-off-by: Damien George <damien@micropython.org>
2020-06-22 10:21:02 +10:00
# test complex interacting with special methods
class A:
def __add__(self, x):
print("__add__")
return 1
print(A() + 1j)
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 33ms Template: 0ms
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