L
Laszlo Nagy
Hi All,
Here is what I read in PEP 8:
Here is my problem. There is ConfigParser, StringIO, Queue, HTMLParser
etc. They are all part of the standard library. Most of these are
modules with only a "main class" defined. ConfigParser module contains
ConfigParser class, Queue module contains Queue class etc. Should I use
CapWords for the module (and file) name or not? E.g. should I
from mess.wxmegaeidgets.GenericDialog import GenericDialog
or
from mess.wxmegaeidgets.genericdialog import GenericDialog
(suppose that the module contains only the GenericDialog class. BTW,
will Py3K change the standard library names in order to follow PEP 8?)
I also have problems with function and method names:
Great, but what if I subclass wx widgets? They all have CapWords.
(wx.Window.ShowModal, wx.Window.Bind etc.) I must use CapitalizedWords
for method names because sometimes I have to override inherited methods,
and it is not possible to change their name. Where should be the limit?
If I create a composite widget then should I use lowercase and
underscores? If I create a class that is not itself a widget, but works
with widgets? The PEP defines the "theoretically good" coding style, but
what is the correct style in an environment where you have third party
libraries that are not following the PEP?
Thanks,
Laszlo
Here is what I read in PEP 8:
Package and Module Names
Modules should have short, all-lowercase names. Underscores can be used
in the module name if it improves readability. Python packages should
also have short, all-lowercase names, although the use of underscores is
discouraged.
Since module names are mapped to file names, and some file systems are
case insensitive and truncate long names, it is important that module
names be chosen to be fairly short -- this won't be a problem on Unix,
but it may be a problem when the code is transported to older Mac or
Windows versions, or DOS.
When an extension module written in C or C++ has an accompanying Python
module that provides a higher level (e.g. more object oriented)
interface, the C/C++ module has a leading underscore (e.g. _socket).
Here is my problem. There is ConfigParser, StringIO, Queue, HTMLParser
etc. They are all part of the standard library. Most of these are
modules with only a "main class" defined. ConfigParser module contains
ConfigParser class, Queue module contains Queue class etc. Should I use
CapWords for the module (and file) name or not? E.g. should I
from mess.wxmegaeidgets.GenericDialog import GenericDialog
or
from mess.wxmegaeidgets.genericdialog import GenericDialog
(suppose that the module contains only the GenericDialog class. BTW,
will Py3K change the standard library names in order to follow PEP 8?)
I also have problems with function and method names:
Function Names
Function names should be lowercase, with words separated by underscores
as necessary to improve readability.
mixedCase is allowed only in contexts where that's already the
prevailing style (e.g. threading.py), to retain backwards compatibility.
Great, but what if I subclass wx widgets? They all have CapWords.
(wx.Window.ShowModal, wx.Window.Bind etc.) I must use CapitalizedWords
for method names because sometimes I have to override inherited methods,
and it is not possible to change their name. Where should be the limit?
If I create a composite widget then should I use lowercase and
underscores? If I create a class that is not itself a widget, but works
with widgets? The PEP defines the "theoretically good" coding style, but
what is the correct style in an environment where you have third party
libraries that are not following the PEP?
Thanks,
Laszlo