Naming conventions (was: Re: refering to base classes)

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Aug 30 00:22:16 EDT 2006


"glenn" <glenn at tangelosoftware.net> writes:

> Bruno Desthuilliers wrote:
> > It might be better to use newstyle classes if you can. Also, the
> > convention is to use CamelCase for classes names (unless you have
> > a strong reason to do otherwise).

Note that this style is more correctly called TitleCase, since the
first letter of *every* word is capitalised, like in a headline (or
title). "camel case" is different -- see below.

> ohh - interesting. Thanks for the camelCase tip - dont have a good
> reason to do otherwise, just bad habits.

The style called camelCase (all words run together, capitalise first
letter of every word except the first) is prevalent in Java, where it
denotes the name of an *instance*, in contrast to a *class* which is
named with TitleCase.

The camelCase style is less popular in the Python world, where (as per
PEP 8) instances are named with all lower case, either joinedwords or
separate_by_underscores.

-- 
 \                "Crime is contagious ... if the government becomes a |
  `\    lawbreaker, it breeds contempt for the law."  -- Justice Louis |
_o__)                                                         Brandeis |
Ben Finney




More information about the Python-list mailing list