Why can't I use __setitem__? #10177
Unanswered
andreyu-git
asked this question in
Using MicroPython
Replies: 2 comments
-
|
It's a different implementation. Some double under methods are missing or implemented in C.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@andreyugit Can you use setattr instead? e.g. the following works: class User(object):
def __init__(self, user):
for k, v in user.items():
setattr(self, k, v)
p = User({'age':'25','name':'Tom'})
print(p.name) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Tell me why it doesn't work, what is the error?
TypeError:
ESP32
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions