forcing a definition to be called on attribute change

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Oct 24 16:09:11 EDT 2006


In <Xns9866A6B3F4017rtwfreenetREMOVEcouk at 216.196.109.145>, Rob Williscroft
wrote:

> Bruno Desthuilliers wrote in news:453dec91$0$23269$426a34cc at news.free.fr in 
> comp.lang.python:
> 
>>> class cSphere() :
>> 
>> OT : prefixing classes names with 'c' is totally unpythonic.
> 
> My understanding of "pythonic" is that its about how you use the 
> language not what style you code in.
> 
> […]
>
> I guess we could claim that one-liners are unpythonic (because 
> indentation is a language feature), but claiming a all PEP 8 
> violating styles are unpyhonic seems to me to be devaluing the 
> term.

IMHO "pythonic" is about readability and sticking to a naming convention
helps others to read your code.  If something is called `Sphere` you know
it's a class there's no need to tack a ``c`` in front.

We've seen this just for the class name here but prefixing names with
"type information" is "unpythonic" too, again IMHO, because this can get
very misleading if you change the type.  Then you have to change all
occurrences of the name or end up with names like `lstObj` bound to a
set object or something similar.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list