Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

More elegant solution for CleverDict.ignore #23

Open
Open
More elegant solution for CleverDict.ignore#23
Labels
enhancementNew feature or requesthelp wantedExtra attention is needed

Description

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions