i have a python class that is defined using __slots__, like so:
class TheClass:
__slots__=['foo','bar']
I would like to sets it values by name, like so
the_object=TheClass()
for x in ['foo','bar']:
the_object[x]=x+x
is that possible?
i have a python class that is defined using __slots__, like so:
class TheClass:
__slots__=['foo','bar']
I would like to sets it values by name, like so
the_object=TheClass()
for x in ['foo','bar']:
the_object[x]=x+x
is that possible?
Copyright © 2021 Jogjafile Inc.
No difference with general case, you can use
getattrandsetattr:You'll get: