Boltons: over 100 Python utilities
github.com
github.com
In any review there is always a few WTFs like this one [4]. I am surprised you didn't get arrested during that development
[1] https://github.com/mahmoud/boltons/blob/master/boltons/cache...
[2] https://github.com/mahmoud/boltons/blob/master/boltons/strut...
[3] https://github.com/mahmoud/boltons/blob/master/boltons/table...
[4] https://github.com/mahmoud/boltons/blob/master/boltons/easte...
"A functional Python web framework that streamlines explicit development practices while eliminating global state."
Meanwhile somewhere else, it comes in as an overbearing global solutions provider. Hope that does not spell the end for the table_html utility.
* You can shorten the commit id:
https://github.com/mahmoud/boltons/blob/e5b7582/boltons/test...
* You can highlight ranges:
https://github.com/mahmoud/boltons/blob/e5b75821781b37ee8ccf...
* You can ignore whitespace in diffs:
https://github.com/cool-RR/python_toolbox
It supports Python 3.
Also, commit messages are a form of documentation; but they are one of the least useful ones. Much less useful in my opinion than docstrings, topical guides, references and blog posts. So I think that spending time on them is a much lower priority than spending time on the other kinds of documentation.
Does look like you docstring your functions--can't you autogenerate a docs site?
Edit: I do see the docs site, but it's a pretty sharp subset of the modules. The topical guides are nice, but I really prefer web-accessible basic docs too, so skipping those in favor of topical only isn't awesome from my POV.
The primary challenge in a toolbox is knowing what tools are there. Having to either browse the code or pydoc it myself to know the scope is a bit of a hump.
First thing I did with bolton was read the docs start to finish. That way when I hit a problem, I'll hopefully remember bolton could solve it.
I will check yours out when I have time to go through it--it looks very multifunctional.
I think the docs of iterutils.split() vs. iterutils.split_iter() might be a little off.
They both claim to return lists but split_iter() says if you want lists, see split(). Without having installed the package yet, my guess is split_iter() returns an iterator. Either way, the docs are contradictory.
https://boltons.readthedocs.org/en/latest/iterutils.html#ite...
Thanks for this!
> split_iter() yields lists of non-separator values.
-> returns a generator of lists
vs for split()
> Returns a list of lists.
Note that the examples in the docs always wrap split_iter() in list(), hiding the generator step from the visible output.
split_iter() docs say, "split_iter() yields lists of non-separator values," whereas split() docs say, "Returns a list of lists." Still, I'll look at clarifying it. ;)
Doesn't have quite the same options, but arguably nicer to use because it's a decorator.
I suppose that may be because sets are not supposed to be ordered. Nor indexable.
>>A total order (or "totally ordered set," or "linearly ordered set") is a set plus a relation on the set<<
Please note that "set" (unqualified) means the general concept of a set. You can extend that general concept, but then what you get is a new thing (in this case a "totally ordered set").
I am sure I didn't.
But claiming that Python's implementation of sets "lacks fundamental features" is unfair, wrong, and making the world a dumber place. Some might want to live in that place. I don't.
Python collections are data structures (containers etc). The standard library is not a symbolic math library, and they are not supposed to model math entities perfectly (e.g. they can me mutable), they are used for their utility, which might or might not need them to be ordered.
Go on and complain about tree types for not handling cycles. Because hey, sometimes you need cycles, don't you? I will be sure not to comment.
Image related.
http://i0.kym-cdn.com/photos/images/newsfeed/000/131/351/eb6...
1) the Python standard library is not SymPy or some math modelling library, and its collections are not supposed to map 1 to 1 with the corresponding mathematical entities -- just have those properties that are useful. In fact, the standard python set type is mutable to begin with.
2) even if they were, there are versions of sets in maths were ordering is indeed desired.
So this makes your snarky comments needlessly smug and misguiged in 2 different ways. But given the rudeness, I don't think this warrants any more discussion. Have a nice life.
```
def chunk_iter(some_seq, n):
return (seq[pos:pos + n] for pos in range(0, len(seq), n))
```example for multi-dict: (unless I'm missing something)
```
from collections import defaultdict
d = defaultdict(list)
d['a'].append('b')
d['a'].append('c')
dict(d)
{'a': ['b', 'c']}
```
e.g.
chunk_iter - iterables not just sequences
multi-dict - usability
Plus nice error messages.
The goal is to be standard library quality.
def chunks_of(it, n):
return takewhile(len, imap(list, imap(islice, repeat(it), repeat(n))))
But this library functions adds error checking and are more expressive (I wrote the above and always have to look at it lenghty to understand it).I've not paid much attention yet to the license scheme, but if it's friendly to be used on commercial projects, I might take the plunge.
In contrast, my own "utils" libraries[1] are often too specific, or not well documented. However, there's already some overlap (eg. I had my own version of funutils.mro_items()), and later today I'll take a look through and see what of mine might be a candidate for inclusion.
Are they related to that singer guy?
Nice one
You know, this makes me thing about how there are so many things that I wish Python would come with: requests, lxml, gevents and a good amount of stuff from the package.
I wish there was Python 2.8.
boltons.tableutils has a lot of TODOs - if you like the concept, the littletable package [1] takes the concept of a python query language pretty far. I put it in production and extended it even further [2]. We'd both welcome help / pull requests.