[bind10-dev] Python classes vs modules vs other funny stuff
Jelte Jansen
jelte at isc.org
Mon Oct 12 16:13:13 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Graff wrote:
> Jelte Jansen wrote:
>> s = ISC.CC.message.to_wire(ss)
>> print ISC.CC.message.from_wire(s)
>>
>> is that what you are looking for?
>
> Close. However, to me, when reading this, I would think that "message"
> is a variable inside of ISC.CC. Is this what Python programmers would
> think?
>
> In any case, I renamed the file to Message.py, which will make it:
>
> ISC.CC.Message.to_wire()
>
> which to me makes it a class. I know it's not, but I just don't quite
> understand how this rather ad-hoc python upper/lower
> class/module/variable naming convention stuff works -- if there is any
> standard, ad-hoc or not.
>
I believe the Official Way is all-lowercase, no underscores for packages and
modules, CamelCase for classes, UPERCASE for constants, and
lcase_with_underscores for variables and methods. So following that, it would
become isc.cc.message.to_wire()
but even the style guide says to be flexible when it comes to readability. Funny
enough, it later says that the python's library is 'a bit of a mess'...
http://www.python.org/dev/peps/pep-0008/
Jelte
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkrTVZkACgkQ4nZCKsdOncWrtQCgiedJo4RkNfX6yST9sp6fvVrp
/n0AnAg7Ay8xF1DDKl/mvGZF9AN8MjSy
=sMt1
-----END PGP SIGNATURE-----
More information about the bind10-dev
mailing list