Use __dict__.update to update an object's fields.
This commit is contained in:
1 parent
eaf5888ae0
commit
73a098a499
1 file changed
+1
-2
@@ -448,8 +448,7 @@ class ConsoleApp( Frame ):
|
||||
|
||||
def assign( obj, **kwargs ):
|
||||
"Set a bunch of fields in an object."
|
||||
for name, value in kwargs.items():
|
||||
setattr( obj, name, value )
|
||||
obj.__dict__.update( kwargs )
|
||||
|
||||
class Object( object ):
|
||||
"Generic object you can stuff junk into."
|
||||
|
||||
Reference in new issue
Block a user