Good programming style

Grant Edwards grante at visi.com
Sun Sep 14 20:29:18 EDT 2008


On 2008-09-14, Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:
> Astley Le Jasper <Astley.lejasper at gmail.com> writes:
>
>> Is it best to have it all in one script or split it into per
>> site scripts that can then be called by a manager script? If
>> everything is in one script would you have per site functions
>> to extract the data or generic function that contain vary
>> slightly depending on the site, for example
>> 
>> import firstSiteScript
>> import secondSiteScript
>
> First: each of these things you're importing is a "module" in
> Python. A script is what I prefer, for clarity, to call a
> "program": it's intended to be executed independently as the
> top level of execution.
>
> Second: please do yourself a favour and drop the camelCaseNames.
> Follow PEP 8 <URL:http://www.python.org/dev/peps/pep-0008> for style
> and naming in your Python code.

If he finds camelcase more readable and easier to type (as do
I), how is switching to underscores "doing himself a favor"?

I'm generally in favor of using a consistent naming style
throughout a project, but I don't see why the naming style used
in my source code should be subject to somebody else's
arbitrary standard.

When it comes to writing code intended for the standard library
in the main Python distribution, I would certainly defer to the
existing standard as defined in PEP 8.  However, I don't see
any reason that style should be imposed on all everybody else.

-- 
Grant




More information about the Python-list mailing list