It (imao) really depends. If I see

if a == 'foo':
   do nothing
else:
   do what I want

I always expect a equalling foo to be the primary result being tested
for, as it comes first. When it comes time to bug hunt, it takes a
mental readjustment to realise that I don't want a to be 'foo', and it
involves reading do nothing.

Hence, 

if not a == "foo" :
   do what I want
else:
   do nothing

is much more obvious to me, I consider 'elses' to be secondary, and I
(personally speaking) always look at the first conditional, and expect
it to be the primary action, if you get my drift.

On Mon, 14 Feb 2005 06:48:09 -0500, Ron Phillips
<[EMAIL PROTECTED]> wrote:
>  
> And now for something only slightly different: education research shows that
> people process "positives" far more quickly and accurately than "negatives",
> so for readability I often code like: 
>   
> if os.path.exists('filename') 
>     #no-operation 
> else 
>     #operation 
>   
> YMMV, of course. 
>   
> Ron
>  
> At 08:52 AM 2/11/2005, Mark Brown wrote:
>  
> Hi,
> I'm a newbie and was wondering which of these IF conditions is better
> structure:
> if not os.path.exists('filename'): 
> 
> if os.path.exists('filename') == False: 
>  
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to