[Zope3-dev] Re: Zope3/src/zope/app/browser/skins/debug/exceptions.py:1.1

Guido van Rossum guido@python.org
Wed, 12 Mar 2003 09:59:12 -0500


> > As a rule, whenever the module contains classes that don't derive from 
> > other classes.
> 
> IMO, this is a matter of taste.
> 
> I personally, have come to dislike inheritance. I somehow find it
> more satisfying to see:
> 
>    class C:
> 
>       ....
> 
> 
> rather than:
> 
>    class C(object):
> 
> which seems redundant to me, as all classes should be new-style classes.
> 
> I don't feel very strongly about this.

As long as it's necessary to be aware of the distinction between
classic and new-style classes (which is a necessary evil until Python
3.0 gets rid of classic classes), I'm for explicit rather than
implicit.  Two ways of this explicitly are

  class C(object):

or

  class C:
      __metaclass__ = type

To me, this feels better than the global __metaclass__ = type, which
is easily overlooked when skimming the source of a class.

Note that for mix-in classes, it's probably not necessary to do either
-- if a classic class is mixed with a new-style class, the resulting
class is a new-style class.

--Guido van Rossum (home page: http://www.python.org/~guido/)