Skip to content
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

More elegant solution for CleverDict.ignore #23

Open
PFython opened this issue Jan 31, 2021 · 1 comment
Open

More elegant solution for CleverDict.ignore #23

PFython opened this issue Jan 31, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@PFython
Copy link
Owner

PFython commented Jan 31, 2021

Currently it's possible to set dictionary items with the same (key) names as existing methods e.g.

x=CleverDict()
x['save']="What a great save!"
x['save']
'What a great save!'

They don't overwrite the existing method (a good thing!) but there is some potentially confusing behaviour:

x
CleverDict({}, _aliases={}, _vars={})

This is because CleverDict.ignore includes {'save_path', 'delete', 'save', '_aliases'}.

Furthermore, although a user is unlikely to import their own data with an existing key of "_aliases", the other three ignored attributes might quite plausibly feature. In this case the solution is just to rename the keys before importing to CleverDict but the danger is that a user might not even know/expect this to be an issue until it becomes one...

@PFython PFython added enhancement New feature or request help wanted Extra attention is needed labels Jan 31, 2021
PFython added a commit that referenced this issue Feb 15, 2022
…leverDict.ignore

#23 more elegant solution for clever dict.ignore
@FelixTheC
Copy link
Collaborator

I think you can close this or??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants