[Python-ideas] Dollar operator suggestion

Mike Müller mmueller at python-academy.de
Fri Oct 27 01:46:28 EDT 2017


This already exists in Coconut:
http://coconut.readthedocs.io/en/master/HELP.html#function-composition

>From http://coconut-lang.org/:
> Coconut is a functional programming language that compiles to Python. 
> Since all valid Python is valid Coconut, using Coconut will only extend
> and enhance what you're already capable of in Python.

Mike

Am 26.10.17 um 13:06 schrieb Yan Pas:
> I've looked up this feature in haskell. Dollar sign operator is used to avoid
> parentheses.
> 
> Rationalle:
> Python tends to use functions instead of methods ( e.g.len([1,2,3]) instead of
> [1,2,3].len() ). Sometimes the expression inside parentheses may become big 
> and using a lot of parentheses may tend to bad readability. I suggest the
> following syntax:
> 
> len $ [1,2,3]
> 
> Functions map be also  chained:
> 
> len $ list $ map(...)
> 
> This operator may be used for function composition too:
> 
> foo = len $ set $
> in the same as
> foo = lambda *as,**kas : len(set(*as, **kas))
> in current syntax
> 
> Regards,
> Yan
> 
> 
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 



More information about the Python-ideas mailing list