Defining name spaces

Dianne Hackborn (hackbod@gila.CS.ORST.EDU)
13 Apr 1995 05:17:21 GMT

This is only marginally Python-related, but more a style question which I
am curious to get some feedback on. If you don't want to waste your time
on something specific to one person, press 'n'. :)

In the project I am currently working on with Python, I need to define a
class hierarchy which can be subclassed by the application programmer
without any concerns about name collisions. The classes in the system may
come from three distinct places, with my current naming scheme being:

1. Built-in classes.
Names start with a capital letter, words divided by capitals, no
underscores.
Examples: Display, CurrentLine.

2. Standard extension classes.
Names start with a short common prefix in capitals, an underscore,
then the name as per #1.
Examples: TR_ShowValue, TR_Explode.

3. Custom application classes.
Names start with a lowercase letter.
Examples: myColor, disp_value, reallybadvar.

This in itself seems okay, and provides a fair amount of flexibility for
the application programmer. The issue I have is integrating with the
Python convention of naming methods in all underscore. I'd like my own
types to look the same as the rest of the Python system... so one
possiblity is to have another convention that fundamental types us all
lower-case letters [which really does look "correct," to me]. But this
then raises the issue of if, some time later, I want to change the
implementation of some type into an actual class which the Python
programmer can subclass. Or maybe this isn't an issue... <shrug> :)

I do have one real question, too. ;) Is there any official meaning for the
'__xx__' named variables? I have some places where I want to have some
similar "out of the way" variables, but it seems that variables with that
naming convention are reserved by the language. I may do something like
use single underscores for myself.

---------------------------------------------------------
Dianne Kyra Hackborn
hackbod@mail.cs.orst.edu "Who are the brain police?"
Oregon State University -- Frank Zappa
//www.cs.orst.edu/~hackbod/