Alf P. Steinbach wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">* Dave
Angel -> seafoid:
One other point: you should always derive a class from some other
class, or 'object' by default. So you should being the class
definition by:
class Seq(object):
Why? It mainly has to do with super(). But in any case if you omit
the 'object' it's an "old style" class, and that's not even supported
in 3.x, so it's better to just get in the habit before it matters.
I think it's best to mention that the above applies to Python 2.x.
In Python 3.x, writing
class Seq:
is equivalent to writing
class Seq( object ):
<snip>
We were talking about 2.x And I explicitly mentioned 3.x because if
one develops code that depends on old-style classes, they'll be in
trouble with 3.x, which has no way to specify old-style classes. In
3.x, all classes are new-style. And although it'll no longer matter
whether you specify (object), it doesn't do any harm. As I said, it's a
good habit for a beginner to get into when defining classes.
DaveA
--
http://mail.python.org/mailman/listinfo/python-list