Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyinfix (Infixes for Python)

Why?

No practical reason, just for fun. The "readability" achieved using this is not worth the performance tradeoff. There are many interesting Python features used here, so I hope you can learn something. Have fun! ^^

Examples

from main import Infix

add = Infix(lambda x, y: x+y)
print(2 @ add @ 2)

subtract = Infix(lambda x, y: x-y)
print(4 >> subtract << 2)

You can even mix them:

print(2 | add ^ 1)

Find supported ones in the source file in COVERED variable. Why is power not supported (**)? Because Python executes operations with it in a different order, that would require writing less cool code.

About

Warning! Fun Python stuff!

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages