A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038789.html below:

[Python-Dev] decorate-sort-undecorate

[Python-Dev] decorate-sort-undecorate [Python-Dev] decorate-sort-undecorateGreg Ewing greg at cosc.canterbury.ac.nz
Thu Oct 16 01:11:45 EDT 2003
Peter Norvig <pnorvig at google.com>:

>    [Sum: x*x for x in numbers]
>    [Product: Prob_spam(word) for word in email_msg]
>    [Min: temp(hour) for hour in range(24)]
>    [Top(10): humor(joke) for joke in jokes]
>    [Argmax: votes[c] for c in candidates]

Interesting idea, but I'm a bit worried by the enclosing
[], which suggests that a list is being constructed,
whereas in most of your examples the result isn't a
list.

I still think it would be fun if Python had an "up"
operator, so with suitably defined accumulator
objects you could say things like

  total = add up my_numbers
  product = multiply up some_probabilities

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4