You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2019. It is now read-only.
Hello bcj,
When i pass {'get': 'example'} to __init__ method, instance created, but i cant access dict key by getattr since __init__ method only add no-conflict key as instance property.
But when i user attrdict_instance.property = "example", it raise a key error.
The question is : this two place acts not the same way.(__init__ and setattr)
Dict has key get but i can't access it(if i haven't read source code , i wouldn't know how can i access it correctly.)
Would __init__ method raises a KeyError to tell user do not use reserved key-name when collision being caught be a better way?
Hello bcj,
When i pass
{'get': 'example'}to__init__method, instance created, but i cant access dict key bygetattrsince__init__method only add no-conflict key as instance property.But when i user
attrdict_instance.property = "example", it raise a key error.The question is : this two place acts not the same way.(
__init__andsetattr)Dict has key
getbut i can't access it(if i haven't read source code , i wouldn't know how can i access it correctly.)Would
__init__method raises a KeyError to tell user do not use reserved key-name when collision being caught be a better way?Best wishes:)