Navigation Menu

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

Would it be valueable to implement lenses for dataclass in python3.7? #21

Closed
potbunker opened this issue May 14, 2019 · 2 comments
Closed

Comments

@potbunker
Copy link

Currently this project only supports subscriptable data structure, meaning list, dict.
Would it make sense to extend these functionalities to python3.7 dataclasses? or attrs-based instances?

@ingolemo
Copy link
Owner

I'm not really sure what you're talking about. This library supports dataclasses:

import dataclasses
from lenses import lens

@dataclasses.dataclass
class Pair:
    left: int
    right: int

old_pair = Pair(1, 2)
new_pair = lens.left.set(3)(old_pair)
print(old_pair, new_pair)

@potbunker
Copy link
Author

My oversight. Thanks for pointing it out for me.

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

No branches or pull requests

2 participants