-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed builtin method overriding by throwing key error and checking for `... #14
Conversation
…r `BuiltinMethodType`
…r `BuiltinMethodType` reduce dict_keys to list for 2.7+
fixed builtin method overriding by throwing key error and checking for `BuiltinMethodType`
👎 |
By preventing stator from overwriting values, getattr comes from super() so it does not need a check.
Hey @jxnl, thanks for contributing! >>> a = dict()
>>> a.keys = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object attribute 'keys' is read-only As for the tests, just some spacing in the dict-literals, i.e. Also, I don't know, but I feel there might be a different way to solve this. Anyways, thanks a bunch! |
I think it has to do with I know that the attribute dictionary behaves differently than a normal dict so I don't know if we should have the setattr from Would it make sense to change |
Yes, if we never let an attribute be defined (we redirect those into getting an item), we could simply check if we already have a property (which is bound to be a dict-property), and throw an attributeerror? EDIT: dicts don't have a getattr obviously! |
i'd think so! |
I really appreciate this @jxnl! 👍 But I feel bad for not merging your PR, I just got so excited I had to burst out and commit it. Hope you'll continue to invest in this! |
no worries :) |
Not sure about the prefered style but I've added two tests