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


Groups > comp.lang.python > #9577

Re: Python ++ Operator?

References <CAH+GN=3PDVnzEp7PJZk7y9BH=vbbsPs7UJoyRcJO3o2wCg-iag@mail.gmail.com> <CALG+76dizm12CbpOAzoC7U8x6N0OH3gfBR1OjgeLtDcgJ9y50w@mail.gmail.com> <CAPTjJmpAZsgqHvFvC5tvmLVw0OrNjrAr8v+hyCKeDVqyA-srpA@mail.gmail.com> <CAGGBd_r6QXjbSprRqTEaYOifZEabJCFoFS7YSUuMTa7uJ2xNrw@mail.gmail.com>
Date 2011-07-16 08:51 +1000
Subject Re: Python ++ Operator?
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1085.1310770297.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jul 16, 2011 at 6:26 AM, Dan Stromberg <drsalists@gmail.com> wrote:
>
> I don't regard this as a low level versus VHLL issue - I regard it as a
> matter of operators with side effects being too error prone.  Adding such
> operators to Python has been discussed (it'd almost certainly be easy to
> add), and rejected.

It's not that it has or has not, due to its highness of level, but
more a needs or needs not. In Python, iterating over an array is done
with a for loop and the array's own iterator (or enumerate() if you
need the indices), but C doesn't have iterators, so it needs a
convenient notation for incrementing through the array.

> BTW, array operations optimize to the same thing as pointer arithmetic in
> most C compilers, but the latter tends to be less clear.

I'm not fully convinced; there are many times when incrementing
pointers allows for much cleaner code. However, we are talking about
the readability of C among Python programmers. Personally, I find
pointer-dereference-and-post-increment to be perfectly readable, but
it's a construct that I use practically on a daily basis. To someone
who's not familiar with Python, list comps could suffer from the same
issues - what does THIS do? oh.

Chris Angelico

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


Thread

Re: Python ++ Operator? Chris Angelico <rosuav@gmail.com> - 2011-07-16 08:51 +1000
  Re: Python ++ Operator? Adam Przybyla <adam@rybnik.pl> - 2011-07-16 14:25 +0000

csiph-web