Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sup/pype
:snake: A sh-like forward pipe operator for Python
https://github.com/sup/pype
Last synced: 3 months ago
JSON representation
:snake: A sh-like forward pipe operator for Python
- Host: GitHub
- URL: https://github.com/sup/pype
- Owner: sup
- License: mit
- Created: 2016-08-27T03:07:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-27T04:19:22.000Z (over 8 years ago)
- Last Synced: 2024-10-11T12:48:43.482Z (4 months ago)
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pype
A general purpose sh-like forward pipe operator for Python.
# Installation
`pip install python-pipe`# Simple Example
```
from pype.pype import pdef hello_world(x):
print "Hi {0}!".format(x)>>> 'Charles' |p| hello_world
Hi Charles!
```
# Slightly More Complex Example
```
from pype.pype import pdef double_and_sum(num_lst):
create_mapper = lambda (fn): lambda (lst): map(fn, lst)
mult = lambda n: n * 2return num_lst |p| (mult |p| create_mapper) |p| sum
>>> [n for n in range(100)] |p| double_and_sum
9900
```