Getting happier ;-), but wondering if I'm thinking pythonically

Chad Netzer cnetzer at mail.arc.nasa.gov
Tue May 20 17:48:47 EDT 2003


On Tue, 2003-05-20 at 14:17, Brian Quinlan wrote:

[Some good advice, only a bit of which I want to provide alternative
comment on]

> 1. print is a statement so parens are superfluous (e.g. line 30)

    But can be handy to properly indent multiline expressions or
strings.


> 2. explicitly closing files is not usually necessary (e.g. line 35)

    But often useful depending on the application (ie. close them
explicitly when you are done with them, to prevent hanging file
handles.  Depending on the OS, and intended operations on the files,
this can be a benefit)

> 3. bare return statements are not necessary (e.g. 38)

   But often handy for helping the editor to properly autoindent your
Python code.

-- 

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)






More information about the Python-list mailing list