reduce to be removed?

Dustan DustanGroups at gmail.com
Sat Nov 11 17:50:43 EST 2006


Fredrik Lundh wrote:
> Dustan wrote:
>
> > What's an accumulation loop, and how would I convert this code so it's
> > compatible with the future 3.0
>
> the release of Python 3.0 is far away, and nobody knows how it's going
> to look.  trying to be future-compatible at this time is a major waste
> of time and (not quite as wasteful as reopening yet another old "let's
> make some pointless change to the language" thread, but almost).
>
> surely you must have something better to do with your time ?
>
> </F>

It's always nice to know there are such good-natured people ready to
help on this group. Anyway, I figured out a way to get the builtin
function 'sum' to work as I need:
sum([[1,2,3],[4,5,6],[7,8,9]],  [])

On an unrelated note, can anyone explain this unpredictable behavior on
IDLE? I swear I never hit ctrl-c...
==============================
>>> help(sum)
Help on built-in function sum in module __builtin__:

sum(...)
    sum(sequence, start=0) -> value

    Returns the sum of a sequence of numbers (NOT strings) plus the
value
    of parameter 'start'.  When the sequence is empty, returns start.
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    help(sum)
  File "C:\Python25\lib\site.py", line 346, in __call__
    return pydoc.help(*args, **kwds)
  File "C:\Python25\lib\pydoc.py", line 1642, in __call__
    self.help(request)
  File "C:\Python25\lib\pydoc.py", line 1687, in help
    self.output.write('\n')
  File "C:\Python25\lib\idlelib\PyShell.py", line 1246, in write
    self.shell.write(s, self.tags)
  File "C:\Python25\lib\idlelib\PyShell.py", line 1235, in write
    raise KeyboardInterrupt
KeyboardInterrupt
==============================




More information about the Python-list mailing list