[Numpy-discussion] adopting Python Style Guide for classes

Pearu Peterson pearu@cens.ioc...
Tue Oct 2 02:12:43 CDT 2007



Jarrod Millman wrote:
> Hello,
> 
..
> Please let me know if you have any major objections to adopting the
> Python class naming convention.

I don't object.

> Once we have agreed to using CapWords for classes, we will need to
> decide what to do about our existing class names.  Obviously, it is
> important that we are careful to not break a lot of code just to bring
> our class names up to standards.  So at the very least, we probably
> won't be able to just change every class name until NumPy 1.1.0 is
> released.
> 
> Here is what I propose for NumPy:
> 1.  Change the names of the TestCase class names to use CapWords.  I
> just checked in a change to allow TestCase classes to be prefixed with
> either 'test' or 'Test':
> http://projects.scipy.org/scipy/numpy/changeset/4144
> If no one objects, I plan to go through all the NumPy unit tests and
> change their names to CapWords.  Ideally, I would like to get at least
> this change in before NumPy 1.0.4.

It is safe to change all classes in tests to CamelCase.

> 2.  Any one adding a new class to NumPy would use CapWords.
> 3.  When we release NumPy 1.1, we will convert all (or almost all)
> class names to CapWords.  There is no reason to worry about the exact
> details of this conversion at this time.  I just would like to get a
> sense whether, in general, this seems like a good direction to move
> in.  If so, then after we get steps 1 and 2 completed we can start
> discussing how to handle step 3.

After fixing the class names in tests then how many classes use
camelcase style in numpy/distutils? How many of them are implementation
specific and how many of them are exposed to users? I think having this
statistics would be essential to make any decisions. Eg would we
need to introduce warnings for the few following releases of numpy/scipy
when camelcase class is used by user code, or not?

Pearu


More information about the Numpy-discussion mailing list