Stupid Simple Pipe
Project description
# Stupid Simple Pipe
`pip install sspipe` then:
* `x | p(f)` is equal to `f(x)`
* `x | p(f).attr[item](arg) + 2 | p(g)` is equal to `g( f(x).attr[item](arg) + 2 )`
* `(x | p(f)) | p(g)` is equal to `x | (p(f) | p(g))`
* `px` is equal to `p(lambda x: x)`
Now, instead of
```python
from pathlib import Path
print(' '.join(list(map(str, filter((lambda x: x.is_dir()), Path('/etc').glob('*'))))))
```
Write:
```python
from sspipe import p, px
from pathlib import Path
Path('/etc').glob('*') | p.filter(px.is_dir()) | p.map(str) | p(list) | p(' '.join) | p(print)
```
`pip install sspipe` then:
* `x | p(f)` is equal to `f(x)`
* `x | p(f).attr[item](arg) + 2 | p(g)` is equal to `g( f(x).attr[item](arg) + 2 )`
* `(x | p(f)) | p(g)` is equal to `x | (p(f) | p(g))`
* `px` is equal to `p(lambda x: x)`
Now, instead of
```python
from pathlib import Path
print(' '.join(list(map(str, filter((lambda x: x.is_dir()), Path('/etc').glob('*'))))))
```
Write:
```python
from sspipe import p, px
from pathlib import Path
Path('/etc').glob('*') | p.filter(px.is_dir()) | p.map(str) | p(list) | p(' '.join) | p(print)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sspipe-0.0.4.tar.gz
(3.6 kB
view hashes)
Built Distribution
sspipe-0.0.4-py3-none-any.whl
(5.2 kB
view hashes)