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
defaultdict and ordered defaultdict #2
Comments
It does seem like a natural fit to add defaultdict in the same model as OrderedDict and rename the module to "cycollections". A pull request would be greatfully accepted! I'm not so sure about ordered defaultdict, because that is not actually in the standard lib. But that subclass should still work -- if not, it is a bug. On Mon, Nov 10, 2014 at 9:14 AM, chebee7i notifications@github.com
|
Actually, |
Right, so I guess only the ordered variant would benefit. |
@chebee7i Looks like github mangled my earlier emailed reply about ordered/default dict:
Please do give that subclass a try and let me know if for any reason it does not work. |
It works nicely. https://gist.github.com/chebee7i/49ebf6af69c329f8ffcb In the gist, the |
If you're really concerned about speed, I would consider is making it an extension type instead of a normal class. I found that made a big difference for the speed of OrderedDict. |
I don't see a cython ordered defaultdict fitting in with this project, because it's not part of the standard library. But if you need it, I encourage you to go ahead and do it in your own project! |
Could we also get a defaultdict and an ordered defaultdict? The latter would be especially helpful snce the typical recommendation is to subclass: http://stackoverflow.com/questions/6190331/can-i-do-an-ordered-default-dict-in-python
Might require a package rename?
The text was updated successfully, but these errors were encountered: