3 ms·
I had a quick look at the examples and while they are written in python, they are not pythonic at all. `list_flatten` should use list a comprehension and probab
by devsnd 10y ago
I had a quick look at the examples and while they are written in python, they are not pythonic at all. `list_flatten` should use list a comprehension and probably use `collections.abc` [1] for the isinstance test. The `reverse_bits` function only works for 32 bit systems and should use `sys.intmax` [2] to find out how many bits to actually reverse. And `bit.subsets` will mutate the argument you gave to it to calculate the result (which is probably not intended). That's all the examples I looked at so far.
I know that the title says "minimal examples" and the goal is not make it "production ready", but as a learning resource you should always make sure to provide good examples, because that's what the students will use and write later on.
[1] https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterable https://docs.python.org/3/library/collections.abc.html#colle...
[2] http://stackoverflow.com/a/24944155/1191373 http://stackoverflow.com/a/24944155/1191373
- racerror 10y agoYou could have cloned, made proposed changes to the source, pushed and made a pull request. Then, referenced it here, made the same point and provided the solution with the same amount of effort as your English-only criticism.
- leblancfg 10y agoI don't think it's fair to ask of a stranger to take the time to fix someone else's cheat cheat if he's never going to use it. The criticism still holds, however.
- racerror 10y agoI agree with you. The point I was making, albeit poorly, was open-source is awesome. git, github and pull requests make it even better. When someone contributes something that may be half-baked and someone else comes along to critique it. A pull-request that demonstrates the solution can be an equally efficient means of communicating the same criticism. Meanwhile, the whole community reaps the benefit of that effort. TLDR; OSS devs should favor, "showing the way" and github makes that easy.