POV-Ray : Newsgroups : povray.off-topic : Programming style question - specifically Python : Re: Programming style question - specifically Python Server Time
29 Jul 2024 14:18:56 EDT (-0400)
  Re: Programming style question - specifically Python  
From: Darren New
Date: 21 Aug 2011 11:00:33
Message: <4e511d91$1@news.povray.org>
On 8/20/2011 22:52, Shay wrote:
> On Fri, 19 Aug 2011 13:49:01 -0700, Darren New wrote:
>
>> On 8/19/2011 13:04, Shay wrote:
>>> bool_a = len(A[0]) == 2
>>> bool_b = min([A[2] == x[2] for x in A[1:]) bool_c = ccw_angle(*A)<   pi
>>>
>>> bool_b will not work if bool_a is true
>>
>> bool_b = bool_a ? min(...) : false
>
> Beautiful, but that doesn't seem to be valid Python.

OK. I had assumed python had that operator. It's the same as

if bool_a then bool_b = min(...) else bool_b = false;

> bool_b = False if bool_a else min(...)
> does work. So, I learned something there.

I think you *might* have the condition reversed on that. That looks like 
it's saying you don't evaluate bool_b if bool_a is true.

-- 
Darren New, San Diego CA, USA (PST)
   How come I never get only one kudo?


Post a reply to this message

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