Marcin Komorowski wrote:
> Please kindly critique my code - what could I have done better?  What 
> would have made this code more Pythonic?

I now nothing of appscript, and didn't even read it all, but a comment 
none the less.
> def myDebug( txt ):
>     if txt == None:
>         sys.stderr.flush()
>     else:
>         sys.stderr.write( txt )

You should use:

if txt is None:

the equality operator can be overloaded, so you can't count on it for 
None. However, you could probably just do:

def myDebug( txt ):
     if txt:
        sys.stderr.write( txt )
     else:
          sys.stderr.flush()

that will flush on both None and an empty string (or anything else that 
evaluates to False).

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer
                                                
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to