Serhiy Storchaka added the comment:
This will be fragile because the behavior will be depend from the number of
keyword argument. Hypothetic example:
>>> kwargs = {'a': 1}
>>> obj = object(**kwargs)
>>> obj.b = 2 # success
>>> kwargs = {} # empty
>>> obj = object(**kwargs)
>>> obj.b = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'object' object has no attribute 'b'
For now you need only one or two line of code to declare new class.
>>> class Object: pass
...
>>> obj = Object()
>>> obj.a = 1
>>> obj.b = 2
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22123>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com