Naming Conventions, Where's the Convention Waldo?

Andreas Waldenburger usenot at geekmail.INVALID
Sun Jul 11 10:24:23 EDT 2010


On Sun, 11 Jul 2010 15:46:40 +0200 News123 <news1234 at free.fr> wrote:

> Andre Alexander Bell wrote:
> > On 07/11/2010 10:30 AM, rantingrick 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?
> > 
> > [snip]
> 
> hm, well sometimes I do write generic functions, that do something
> with a list or a string or an int.
> 
> [snip]
> 
> I must admit, that I have still problems
> to not use the variables range or id
> 

There are several approaches:

- Use range_, id_, and so on. I think this is the proposed convention.
  Slightly ugly, though.
- Use abbreviations, or misspellings like lst, Set, klass, ... Less
  ugly, but can get weird.
- Prepend 'a' to a type name: alist, aset, astr. Similar weirdness
  potential as above, but more consistent in terms of style. I
  sometimes take this to the extreme and prepend 'some_'.

So really, this is a non issue, at least for me.

Having capitalized boolean values ... that is a bit odd, but as long as
children are starving in Africa, this isn't very high on my gripe-list.

/W

-- 
INVALID? DE!




More information about the Python-list mailing list