S
Sergio Correia
Hi, I'm kinda new to Python (that means, I'm a total noob here), but
have one doubt which is more about consistency that anything else.
Why if PEP 8 says that "Almost without exception, class names use the
CapWords convention", does the most basic class, object, is lowercase?
I found a thread about this:
http://mail.python.org/pipermail/python-list/2007-April/437365.html
where its stated that -object- is actually a type, not a class; but
the idea still doesn't convince me.
If i create a class Spam using -object- as a parent class, I would
expect -object- to be a class, not a type as in type(object) (what is
the difference between both btw?). But, on the other hand, if I do
help(object), I get:
Help on class object in module __builtin__:
class object
| The most base type
So is this a class? No...
<type 'object'>
My doubts get compounded when strange stuff starts to happen:
def __init__(self):
self.x = 1<type 'type'>
Type 'type'? What is that supposed to mean?
Hope this makes any sense ,
Sergio
have one doubt which is more about consistency that anything else.
Why if PEP 8 says that "Almost without exception, class names use the
CapWords convention", does the most basic class, object, is lowercase?
I found a thread about this:
http://mail.python.org/pipermail/python-list/2007-April/437365.html
where its stated that -object- is actually a type, not a class; but
the idea still doesn't convince me.
If i create a class Spam using -object- as a parent class, I would
expect -object- to be a class, not a type as in type(object) (what is
the difference between both btw?). But, on the other hand, if I do
help(object), I get:
Help on class object in module __builtin__:
class object
| The most base type
So is this a class? No...
<type 'object'>
My doubts get compounded when strange stuff starts to happen:
def __init__(self):
self.x = 1<type 'type'>
Type 'type'? What is that supposed to mean?
Hope this makes any sense ,
Sergio