Names for modules and functions

Logan logan at phreaker.nospam
Tue Dec 2 06:14:50 EST 2003


On Tue, 02 Dec 2003 05:18:15 +0000, Jeff Wagner wrote:

> ... what is a good way to come up with names for modules, function,
> etc.? I am trying to come up with meaningful names but keep feeling 
> like I have a new puppy I have to name (and I was never good at that,
> either. My dog's name is Buddy).

I like 'Buddy' :-)


> So, are there any guidelines?

To google for 'naming conventions' resp. 'naming scheme' or 'style
guide' might help; but in general, you will only find stuff like 'use
underscores', 'don't use underscores', 'use camel notation', 'don't 
use camel notation' etc. and something on the order resp. use of 
nouns, verbs etc. (e.g. 'showXmlData' vs. 'XmlDataShow')

You might also want to have a look at the 'Style Guide for Python
Code' by Guido van Rossum and Barry Warsaw:

    http://www.python.org/peps/pep-0008.html

(But it does not really help in your special situation :-)


> Also, is it ok to name a module and function the same?

Often you will see that a module and its class have the same name
(if the module contains just one class).

Finally, it might help to look at the naming conventions for other
languages. E.g. for C#/.NET you will find very detailed instructions
on how to name stuff (Google, Microsoft website). 

HTH, L.

-- 
mailto: logan at phreaker(NoSpam).net





More information about the Python-list mailing list