PEP 276 Simple Iterator for ints

Paul Rubin phr-n2001d at nightsong.com
Thu Nov 15 19:14:11 EST 2001


David Eppstein <eppstein at ics.uci.edu> writes:
> - Functional programming e.g. "def factorial(n): 
> reduce(multiply,range(1,n+1))" vs "reduce(multiply,[1,2,...n])".  A closed 
> interval would be more natural.

Well, non-Pythoners already are terrified of how Python uses indentation
instead of curly braces or begin/end to express program structure.
Why not drive them COMPLETELY crazy?

  factorial = reduce(multiply[1,2...n])   # closed interval
  for i in [0,1,...n):                    # half-open interval

<wink>, I think ;-)



More information about the Python-list mailing list