Comments (3)
The undocumented...
Thanks for flagging this. invert
used to be documented, but its docstring was removed when bidict's doctests were ported to external files. (This particular one ended up here.)
naive use of this method could cause significant confusion about what state a bidict is in at what point in a program
(Not moved much by this point. By analogy, we have reversed(my_list)
as well as my_list.reverse()
; up to the caller to use responsibly.)
...who wanted to do an in-place replacement of values...
Instead of the snippet you give above, this is a cleaner way to replace a bidict with its inverse:
>>> b = b.inv
Since this communicates the intention just as clearly as b.invert()
, and is no less efficient than what invert
was doing under the hood, I agree there's no reason to keep the invert
method. Removed in d7551db. Thanks for the suggestion.
(Background: I work on a very large project (thousands of developers)
Are you using bidict in your very large project? Always curious to hear more about my users' use cases, in case you'd like to share. And if bidict is helping you in work you're getting paid for, please consider supporting bidict with a monetary contribution or asking your employer to do the same!
https://github.com/jab/bidict/blob/master/CONTRIBUTING.rst#other-ways-to-contribute
from bidict.
b = b.inv
doesn't change an object in-place (such that existing references to it are updated).
We're not using bidict at this point. I'm just considering whether I can make a recommendation for its inclusion in the project and flagging up some issues that I would expect people to bring up. Due to the size of the project we end up being extremely careful about what we include, and a lot of questions get asked before any action would be taken.
from bidict.
b = b.inv
doesn't change an object in-place (such that existing references to it are updated).
Yes, thank you. Meant to say, this must be done for every reference to b
.
...I'm just considering whether I can make a recommendation...
Gotcha. I'm interested to discuss any other concerns, and hope bidict can accommodate your use case. Thanks again for your thoughtful feedback.
from bidict.
Related Issues (20)
- Bug in BidirectionalMapping.__subclasshook__(): Any class with an inverse attribute is considered a collections.abc.Mapping HOT 8
- Suggestion: Include licence in documentation HOT 3
- Not installable from GitHub release tarball HOT 6
- Add more properties based tests HOT 1
- global name 'BidirectionalMapping' is not defined HOT 21
- github git tags out of sync since 0.18.4 HOT 3
- Missing __all__ in bidict/__init__.py leads to implicit reexport error with mypy in strict mode. HOT 9
- logo HOT 5
- Dependency Dashboard
- Type hints for Bidict type HOT 2
- Try slipcover HOT 1
- Maybe use nix for devcontainer and GHA “tests” workflow
- Why it returns None when I use bidict?
- Will you add a persistence method? HOT 1
- Improve OpenSSF Scorecard HOT 6
- Swap syntax does not work HOT 4
- Automate upgrading dev dependencies HOT 1
- Type alias definition for `MISSING` results in type violations HOT 1
- test fails with python3.12 HOT 3
- Remove dead batteries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bidict.