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 Library.insert(data) #88

Open
jkomoros opened this issue Jan 31, 2023 · 0 comments
Open

Add Library.insert(data) #88

jkomoros opened this issue Jan 31, 2023 · 0 comments

Comments

@jkomoros
Copy link
Collaborator

In a lot of flows now you first have to create a temp_bit=Bit(data=data) and then check its id to see if it's in the Library and if not call Library.insert_bit.

Given how common that is, we should probably have a method like Library.insert(data=data) that returns a Bit with that data, inserting it into the library if it doesn't yet exist or returning the Bit with that id if it does. Perhaps it should return a tuple of (bit, was_inserted=False) so you can detect if it was inserted or if it was already there.

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

1 participant