POV-Ray : Newsgroups : povray.off-topic : Programming style question - specifically Python : Re: Programming style question - specifically Python Server Time
29 Jul 2024 20:21:16 EDT (-0400)
  Re: Programming style question - specifically Python  
From: Warp
Date: 27 Aug 2011 10:14:33
Message: <4e58fbc8@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> On 8/26/2011 7:48, Warp wrote:
> >    You are not setting bool_b the value of bool_a.

> And that's exactly my complaint. The value of bool_b is dependent on bool_a, 
> but not really assigned from it. I'm sure you see what I mean.

  Not really.

> > You are making a boolean
> > 'and', and assigning the result of that to bool_b.

> But when the first expression indicates the second can't be evaluated, 
> there's no reason to assign the first expression to bool_b, semantically 
> speaking. I.e., it looks to me like it's tying the two too closely.

  bool_a is not being assigned to bool_b. The result of the expression
"something && something_else" is being assigned to bool_b.

  I don't even understand what is it that you don't like about this.

> >    This is, btw, a common tactic used in unix shell scripts.

> Yeah, but IME it's usually used *only* to short circut the evaluation, not 
> to actually use the result. YMMV.

  It may be *common* for the result to be discarded, but it's perfectly
possible to take the result into account for subsequent decisions. The
advantage of using a sequence of commands separated by && is that you
don't need to put an 'if' after each of the commands, if you want to
react to one of them failing. You only need to use one 'if' to catch any
of them failing.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.