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/039137.html below:

[Python-Dev] Re: accumulator display syntax

[Python-Dev] Re: accumulator display syntax [Python-Dev] Re: accumulator display syntaxNick Coghlan ncoghlan at iinet.net.au
Tue Oct 21 09:41:39 EDT 2003
Guido van Rossum strung bits together to say:

> except compactness of exprssion.  How frequent is
> 
>   result = 0.0
>   for x in S:
>       result += x**2
> 
> ???
> 
> (I've already said my -1 about your 'sum of ...' proposal.)

Just so this suggestion doesn't get buried in the part of the thread where I was 
getting rather carried away about Greg's 'of' syntax (sorry!).

What about:

   result + x**2 from result = 0.0 for x in S

Essentially short for:
   result = 0.0
   for x in S:
     result = result + x**2

Cheers,
Nick.

-- 
Nick Coghlan           |              Brisbane, Australia
ICQ#: 68854767         |               ncoghlan at email.com
Mobile: 0409 573 268   |   http://www.talkinboutstuff.net
"Let go your prejudices,
               lest they limit your thoughts and actions."


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