property problems

Michael Hudson mwh at python.net
Fri Nov 15 08:50:28 EST 2002


Antonio Cuni <TOGLIMIcuni at programmazione.it> writes:

> Alex Martelli wrote:
> 
> > What really determines if x is a new-style class is x's metaclass,
> > and rather than inheriting it from x's base (which is the normal
> > way to do it) you may alternatively choose to assert it explicitly
> > by a __metaclass__ attribute in class scope (or a global variable
> > __metaclass__ in module scope if x has no bases).  x is new-style
> > iff x's metaclass is the built-in type object named 'type'.
>  
> uhm... type inherit from object, but object's metaclass is type: isn't 
> there a recursion problem?

Sort of, but the first pieces are put together in a way different from
the rest of the system.  I think Smalltalk has a similar "problem".
In Python's case I guess you could say that type and object are
created by an "outside force" (C code) that knows the eventual
appearance of each object.

But there were (are?) bugs along these lines in Python; for a while
there were things you could do that would access bits of the system
before they were setup properly and segfault.  It's hard to be certain
that all of these are gone.

> ciao Anto
> PS & OT: what's the english for "circolo vizioso"?

Vicious circle?

Cheers,
M.

-- 
 "Well, the old ones go Mmmmmbbbbzzzzttteeeeeep as they start up and
  the new ones go whupwhupwhupwhooopwhooooopwhooooooommmmmmmmmm."
                         -- Graham Reed explains subway engines on asr



More information about the Python-list mailing list