[Web-SIG] Coding conventions

deelan deelan at interplanet.it
Sun Nov 30 06:28:11 EST 2003


hi there,

since some code for the "web package" is starting to appear 
(WWW::Mechanize!) i was wondering if you guys have planned a set of 
coding convetions when naming classes, mothods, getter/setters and so on.

at least in the "web package" it would be cool to have some
consistency between modules.

just for a start i think that:

http://www.kryogenix.org/code/pybrowser/browser.py

gives some nice hints for this task:

* package/module names in lowercase.

* classes names like Java, e.g. SomeCoolClass

* method and function names? seems that the trend is to name them like 
some_cool_method()

* parameters and local vars, same as methods plus one or two
underscores where appropiate.

* explicit get and set methods, so when to use property(...)?
maybe an "implicit" get prefix to reduce typing ala webware?
i mean, title() method returns a string for the title property,
set_title should set title.

thanks to all.









More information about the Web-SIG mailing list