On 19Aug2016 16:11, Lawrence D’Oliveiro <lawrenced...@gmail.com> wrote:
On Saturday, August 20, 2016 at 10:38:34 AM UTC+12, Chris Angelico wrote:
On Sat, Aug 20, 2016 at 8:31 AM, Lawrence D’Oliveiro wrote:
There is no short-cut evaluation when constructing tuples and lists.

I'm not sure how that would make difference in these examples. The
three parts are independent - the one place where short-circuiting is
important is indeed short-circuited.

That often is not the case, e.g. 
<https://github.com/ldo/qahirah/blob/master/qahirah.py>:

   assert \
       (
           len(self.points) == 0
       or
               not self.points[0].off
           and
               (closed or not self.points[-1].off)
       )

Aye, but beware that the expression is actually correct for the indentation. Compare:

  assert \
      (
          len(self.points) == 0
      and
              not self.points[0].off
          or
              (closed or not self.points[-1].off)

where the precedence causes the layout to mislead.

I'm not arguing against indented spread out layout here, I use it myself, but just mentioning that the human eye will tend to take the visual layout over a strict parse. So care is needed, as in all programming.

Cheers,
Cameron Simpson <c...@zip.com.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to