Naming Conventions, Where's the Convention Waldo?
Andre Alexander Bell
post at andre-bell.de
Sun Jul 11 04:49:20 EDT 2010
On 07/11/2010 10:30 AM, rantingrick wrote:
> On Jul 11, 3:03 am, "Günther Dietrich" <gd.use... at spamfence.net>
> wrote:
>
>> So, it is not a disadvantage that the functions you listed above are
>> named in this way. In the contrary, it is an advantage, as it keeps
>> newcomers from using stupid variable names.
>
> "int" for an Integer is stupid?
> "list" for a List is stupid?
> "str" for a String is stupid?
>
> What am i missing?
You are missing (from PEP 8):
--- 8< --- 8< ---
Class Names
Almost without exception, class names use the CapWords convention.
Classes for internal use have a leading underscore in addition.
--- 8< --- 8< ---
You may want to think of list, int, str, object, ... as classes that
don't follow this advice with their class name.
But besides that, shouldn't a variable name reflect it's purpose instead
of it's type? E.g.
name = 'rantingrick'
counter = 1
...
as compared to
str = 'rantingrick'
int = 1?
Regards
Andre
More information about the Python-list
mailing list