Suggestions for good programming practices?

Sean 'Shaleh' Perry shalehperry at attbi.com
Mon Jun 24 18:55:06 EDT 2002


On 24-Jun-2002 Dianne van Dulken wrote:
> Hi,
> 
> I'm fairly new to python, coming from a perl background, and was wondering
> if anyone has a list of things that they consider as good programming
> practice in Python (I thought this might be an interesting topic for
> discussion, anyway)
> 
> For example, in perl you obviously are always encouraged to use strict, and
> we always use eval around our main code to pick up any unexpected errors.  I
> presume the equivalent in python is the try statement.  Would you suggest
> that this should be used, or would that be redundant here?  Any other tips
> that you would suggest a new python user should be always doing as a good
> programming practice?
> 

one of the mantras you will hear on this list is:

the simpler the code the better

you hear this on style issues, on optimization issues, and well practically
everywhere.  Usually the simple, clean approach yields the best possible python
-- both in your time and in runtime.  So if you find yourself saying "man, why
is this so complex" you should stop and rethink the problem.

As a side item, tutor at python.org is a GREAT place to hang out and read about
other people learning python.  You can really pick up a lot of the niceties and
sublties of the language there.





More information about the Python-list mailing list