Where to "import"?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu Mar 8 18:49:42 EST 2007
Paulo da Silva a écrit :
> Bruno Desthuilliers escreveu:
>
>>Paulo da Silva a écrit :
>
> ...
>
>
>>>c.py
>>> class c:
>>
>> class C(object):
>>
>>1/ better to stick to naming conventions (class names in CamelCase)
>
> Ok. Thanks.
FWIW:
http://www.python.org/dev/peps/pep-0008/
>>2/ do yourself a favor: use new-style classes
>
> I still have python 2.4.3 (The gentoo current version).
new-style classes came with Python 2.2.1 IIRC.
> I didn't find this in my tutorial. Would you please enlight me
> a bit about this (class C(object))?
Inheriting from the builtin class 'object' (or from any other new-style
class) makes your class a new-style class. new-style classes have much
more features than old-style ones. Like support for properties (computed
attributes). old-style classes are still here mainly for compatibility
with old code. While there not yet officially deprecated, you can
consider them as such.
> Or just point me out some doc
> to read about.
http://www.python.org/doc/newstyle/
HTH
More information about the Python-list
mailing list