Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Property validation in __init__ method makes conclision #23

Open
winkidney opened this issue Jan 8, 2015 · 0 comments
Open

Property validation in __init__ method makes conclision #23

winkidney opened this issue Jan 8, 2015 · 0 comments

Comments

@winkidney
Copy link

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?

Best wishes:)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant