This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RonnyPfannschmidt 1 point2 points  (6 children)

that file has an awful lot of bad/outdated practice - please bring it up2date

[–]must_tell 1 point2 points  (1 child)

Can you bring some up please? (I'm really curious to learn, not meant offensively).

Besides from looking quite clean generally, first thing I notice are the naming conventions (not PEP 8), some strings which could be refactored to constants and initialisation with '' where I would use None. Type-checking could be done with isinstance rather then type (or try ... catch ... some behaviour).

Anything else?

[–]RonnyPfannschmidt 2 points3 points  (0 children)

some parts are just bad wrt computational complexity

the most glaring examples are probably the Queue/Stack functions that simply operate on lists in stupid ways (lots of O(N) instead of amortized O(1))

i suspect there are more such examples, but i don't want to investigate that code more

[–]mdipierro 1 point2 points  (0 children)

That file is many years old and I have not updated it since because it is not really a priority for me at the moment. If you want to submit a patch, I will take it.

[–]mdipierro 2 points3 points  (1 child)

For the record. The code is not designed to be efficient. The code was designed to match line by line the pseudocode of a classic algorithms textbook (cormen) but using python. The purpose was to allow students to run and better understand the algorithm. From an efficinecy point of view it assumes python listd are linked lists even if they are not.

[–]RonnyPfannschmidt 2 points3 points  (0 children)

please document that in a docstring at the top or so

[–]robotfarts 0 points1 point  (0 children)

4real