Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29518

Re: sum works in sequences (Python 3)

From Terry Reedy <tjreedy@udel.edu>
Subject Re: sum works in sequences (Python 3)
Date 2012-09-19 14:49 -0400
References <franck-E8B1EB.16412019092012@news.free.fr> <scl6s.509699$Ax.328580@fx18.am4>
Newsgroups comp.lang.python
Message-ID <mailman.936.1348080608.27098.python-list@python.org> (permalink)

Show all headers | View raw


On 9/19/2012 11:07 AM, Alister wrote:

> Summation is a mathematical function that works on numbers
> Concatenation is the process of appending 1 string to another
>
> although they are not related to each other they do share the same
> operator(+) which is the cause of confusion.

If one represents counts in unary, as a sequence or tally of 1s (or 
other markers indicating 'successor' or 'increment'), then count 
addition is sequence concatenation. I think Guido got it right.

It happens that when the members of all sequences are identical, there 
is a much more compact exponential place value notation that enables 
more efficient addition and other operations. When not, other tricks are 
needed to avoid so much copying that an inherently O(N) operation 
balloons into an O(N*N) operation.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

sum works in sequences (Python 3) Franck Ditter <franck@ditter.org> - 2012-09-19 16:41 +0200
  Re: sum works in sequences (Python 3) Joel Goldstick <joel.goldstick@gmail.com> - 2012-09-19 10:57 -0400
  Re: sum works in sequences (Python 3) Neil Cerutti <neilc@norwich.edu> - 2012-09-19 14:57 +0000
  Re: sum works in sequences (Python 3) Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-19 09:03 -0600
    Re: sum works in sequences (Python 3) Neil Cerutti <neilc@norwich.edu> - 2012-09-19 15:06 +0000
      Re: sum works in sequences (Python 3) Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-19 09:24 -0600
      Re: sum works in sequences (Python 3) Steve Howell <showell30@yahoo.com> - 2012-09-19 08:37 -0700
        Re: sum works in sequences (Python 3) Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-19 12:33 -0600
          Re: sum works in sequences (Python 3) Steve Howell <showell30@yahoo.com> - 2012-09-19 11:43 -0700
    Re: sum works in sequences (Python 3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-19 16:14 +0000
  Re: sum works in sequences (Python 3) Alister <alister.ware@ntlworld.com> - 2012-09-19 15:07 +0000
    Re: sum works in sequences (Python 3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-19 16:18 +0000
    Re: sum works in sequences (Python 3) Terry Reedy <tjreedy@udel.edu> - 2012-09-19 14:49 -0400
    Re: sum works in sequences (Python 3) Hans Mulder <hansmu@xs4all.nl> - 2012-09-20 00:25 +0200

csiph-web