rgsoda / pypy-llist Goto Github PK
View Code? Open in Web Editor NEWlinked list in pure python
License: MIT License
linked list in pure python
License: MIT License
Hey,
Tried the following:
`import pyllist
dllist = pyllist.dllist
a = dllist([2.0])
a.appendleft(1.0)
a.appendright(3.0)
b = a.nodeat(1)
print(b)
c = b.prev()
print(c)`
The documentation makes it sound like next and prev should return the adjacent dllistnodes, but they seem to be returning the value stored in the node instead. Maybe this is intentional, maybe not, but how do I get the node instead of the value? I want to walk along the list!
The documentation says that an llist.dllist object has a method iternodes() dllist object:
iternodes([to])
Iterate over the list starting from the first node. If to is specified, iteration stops when the current node becomes equal to argument to.
Successfully installed llist-0.5
When I try to import pyllist in python3 "ModuleNotFoundError: No module named 'dllist'" error occurs, If I change init.py, the import works fine in python3. I did not try it in python2, but I guess the same will occur there as well
The same dllistnode can be removed more than 1 time and decrease the length of dllist. For example
l = dllist([1, 2, 3])
tmp = l.first
l.remove(tmp)
print(len(l))
l.remove(tmp)
print(len(l))
l.remove(tmp)
print(len(l))
The linked list structure is correct but the length is wrong.
Hey guys, no idea if this is being maintained still, but here goes. I wanted to use your doubly-linked-list module because I need one for an algorithm. I was doing some tests. Try the following code:
`import pyllist
dllist = pyllist.dllist
a = dllist([2.0])
for i in a:
print(i)
print("\n")
a.appendleft(1.0)
for i in a:
print(i)
print("\n")
a.appendright(3.0)
for i in a:
print(i)`
The output I get is this:
`2.0
1.0
2.0
1.0
3.0`
Where the hell has the 2.0
gone? Weirdly, if I try the same thing after initialising with say [2.0, 4.0], everything is fine. What do you think?
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.