Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipes should work on everything! It also should be a PEP. For black. #8

Open
amogorkon opened this issue Apr 9, 2022 · 0 comments
Open

Comments

@amogorkon
Copy link

Thank you so much for this brilliant little thing. I've just copy&pasted your main code as a tooling decorator into https://github.com/amogorkon/justuse and it does its job without complaining even once.
For example
ordered = releases >> _filter_by_platform(tags=get_supported()) >> _sort_releases

last_version = project.releases >> reversed >> iter >> next

meta = (names 
<< filter(DIST_PKG_INFO_REGEX.search) 
<< map(functions.read_entry) 
>> dict
)

Pipes make this so much nicer and less cluttered. Readability counts! I hope you will continue maintaining this beautiful thing and maybe even make a PEP for inclusion into the core language 👍

This probably is also the only way to fix a little issue that happens when you write a small chain of pipes like

a = (foo
>> bar
<< baz
)

which would look ugly on a single line a = foo >> bar << baz with those arrows piping in different directions - alas, black thinks so otherwise, so it turns the multi-line pipe into a single line.

PS: You really should update your examples on your README to python 3 print-as-a-function ;-)

def calc():
    print 1 >> add(2) >> times(3)  # prints 9

should be

def calc():
    1 >> add(2) >> times(3)  >> print # prints 9 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant