[Dev] python modules and classes

Katie Capps Parlante capps at osafoundation.org
Fri Nov 21 17:28:16 PST 2003


fyi,

When meeting to talk about CPIA, the apps folks noted that we were all 
finding it convenient to place multiple classes in one module, even 
though we had an earlier guideline for one class per module. We decided 
to drop that guideline.

There's a lot of code with import statements that look like this:

    from mypackage.mymodule import MyClass

    foo = MyClass()

... although we'd use the same name for module and class. Its perhaps 
better to do this:

    import mypackage.mymodule as mymodule

    foo = mymodule.MyClass1()
    bar = mymoudle.MyClass2()

In general we're not uber-sticklers for coding conventions unless its 
really important for correctness, but thought I'd share the conversation.

http://wiki.osafoundation.org/bin/view/Main/ChandlerCodingStyleGuidelines

Cheers,
Katie





More information about the Dev mailing list