User talk:Hout: Difference between revisions

Line 160:
 
: Thanks for looking at that – it does seem intractable at the moment, but at least we have pointed people to the possibility of viewing it in Firefox [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 22:09, 22 November 2016 (UTC)
 
==Pythonic code==
Hi, You've stated that you don't think PEP-8 applies to your functional code. Have you tried to get PEP-8 updated as yet?
 
Currently your code adds commentsabove function definitions, where it is "Pythonic" to add such - given your reasons for those comments, to the Python [https://www.python.org/dev/peps/pep-0257/ docstring].
 
The difference is shown here:
<lang python>In [29]: # concatMap :: (a -> [b]) -> [a] -> [b]
...: def concatMap(f):
...: return lambda xs: list(chain.from_iterable(map(f, xs)))
...:
...:
...: help(concatMap)
Help on function concatMap in module __main__:
 
concatMap(f)
# concatMap :: (a -> [b]) -> [a] -> [b]
 
 
In [30]: def concatMap(f: Callable) -> Callable:
...: """\
...: Returns a function of one argument, a list, that:
...: chains the results of mapping function f over its list argument.
...: """
...: return lambda xs: list(chain.from_iterable(map(f, xs)))
...:
...:
...: help(concatMap)
Help on function concatMap in module __main__:
 
concatMap(f:Callable) -> Callable
Returns a function of one argument, a list, that:
chains the results of mapping function f over its list argument.
 
 
In [31]: </lang>
 
You have the chance to write more Pythonic code but but instead continue to add Haskell translations, under the guise that "Guido hated, and stymied functional programming in Python; and that you know better". Fine, you should put this to the language community and convince them of your superior methods. Until then, ''Post Python and not converted Haskell''. If you haven't converted Guido's community, then its not idiomatic Python.
 
[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 10:44, 28 October 2018 (UTC)
Anonymous user