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

Add sc.autoapply() #548

Open
cliffckerr opened this issue Oct 24, 2023 · 0 comments
Open

Add sc.autoapply() #548

cliffckerr opened this issue Oct 24, 2023 · 0 comments
Labels
enhancement New feature lowpriority Low priority task

Comments

@cliffckerr
Copy link
Member

cliffckerr commented Oct 24, 2023

Inspired by @kelvinburke's odict_custom, would be nice to have a function that creates a new object that automatically applies a function on set. For example:

obj = dict(a=12, b=34)
strdict = sc.autoapply(obj, func=str)
strdict['c'] = 56
print(strdict['a']) # gives '12'
print(strdict['c']) # gives '56'

Not sure if this is possible in the general case, but would be cool if it were! Related to sc.asobj().

@cliffckerr cliffckerr added the enhancement New feature label Oct 24, 2023
@cliffckerr cliffckerr added the lowpriority Low priority task label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature lowpriority Low priority task
Projects
None yet
Development

No branches or pull requests

1 participant