shoyer / cyordereddict Goto Github PK
View Code? Open in Web Editor NEWCython implementation of OrderedDict
License: MIT License
Cython implementation of OrderedDict
License: MIT License
Great package! Can't wait to use it in my Python 3.4 projects. Any ideas how much has to be done to make it compatible? Saw a few bits that should be easy to fix, like itertools.imap
which no longer exists in Py3. Let me know if I can help in any way.
Something seems to have gone wrong :(
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?
This code
from cyordereddict import OrderedDict
od = OrderedDict([('a', 1)])
for (k, v) in od.items():
del od[k]
results in
Traceback (most recent call last):
File "test.py", line 3, in <module>
for (k, v) in od.items():
File "<path>/env/bin/../lib/python3.4/_collections_abc.py", line 497, in __iter__
for key in self._mapping:
File "cyordereddict/_cyordereddict.pyx", line 112, in __iter__ (python3/cyordereddict/_cyordereddict.c:2725)
AttributeError: 'NoneType' object has no attribute 'key'
It might be more helpful to raise RuntimeError: dictionary changed size during iteration
like dict
does.
This will be helpful for packages that use the OrderedDict class without allowing to replace it with another class.
@shoyer have you measured if there is any difference between collections.OrderedDict vs. cyordereddict in terms of memory usage? Seen the code and it seems to be a "line to line port", so memory usage should be the same?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.