HNHacker News
TopNewBestAskShowJobs

Suor

614 karma · joined October 26, 2011

submissionscomments
Suor··on Functional Python Made Easy
You can pass flags and compiled regular expression. Pattern with named captures causes re_find to return dict.

You won't get entire match if you have several captures, but you can add a pair of parentheses around your regexp to circumvent this limitation.

As you can see, plenty of flexibility here. Also, you can fallback to naked re once or twice a year, not that much trouble.

Suor··on Functional Python Made Easy
re_find returns tuple of all captures if there are more than one. See parse ini example
Suor··on Abstracting Control Flow
Oh, I probably should spend some time clarifying the docs.

But basically it just helps avoiding nesting functions, a common boilerplate when writing decorators.

Suor··on Abstracting Control Flow
No, @decorator takes care of it - http://funcy.readthedocs.org/en/latest/decorators.html
Suor··on Abstracting Control Flow
There is a price for new vocabulary involved, which is some learning curve.

By the way, first piece of code can become much more hairy with time.

Suor··on Show HN: A set of handy tools to work with sequences and collections in Python
Yes, that decisions look dirty and dubious, but using funcy for several months, I've come to that practicality and convenience is worth it.

Some of itertools things are just reexports and builtins are extended purely - so that they behave the same given same arguments - with negligible performance overhead.

Anyway, if you are such a purist you still have at least two options: 1. just `import funcy` and use it as `funcy.map(...)` or `funcy.keep(...)` 2. Import only functions you use, avioding name clashes, use `from funcy import map as xmap` to import extended builtins.

Suor··on Show HN: A set of handy tools to work with sequences and collections in Python
Yes, where() doesn't handle that case, but it makes its interface more smooth for more common case of string keys.

That was a deliberate choice.

Suor··on Show HN: A set of handy tools to work with sequences and collections in Python
Predicate in some() is optional. A test for boolean truth is used in that case.

So, first example is the same as:

    some(bool, [0, '', -1, None, 2])
Suor··on It's Playtime - Light Table Playground released
Sorry, if this is a dump question, but how I can add some package and then require it in playground?

I'm trying to (require 'http.async.client)

← PreviousPage 2 of 2