Want to inherit from file

Steve Holden sholden at holdenweb.com
Mon Nov 13 08:57:00 EST 2000


Joe Smith wrote:
> 
> Steve Holden wrote:
> 
> > Franz GEIGER wrote:
> > Correct.  One of the less-pure aspects of Python is that the built-in
> > types are not first-class objects such as you build when defining your
> > own classes, and cannot be used as superclasses.
> 
> Why?  Is it difficult to make the built in ones first class?

It's to do with the implementation.  You cannot, for example, write

class MyString(types.stringtype):
	...

to define a class which inherits its behaviour from the built-in string.

I have seen statements to the effect that a desirable goal for Python 3000
would be parity between programmer-defined classes and built-in types, much
the same as (some) other object-oriented languages have,  But I believe it's
unlikely to happen in Python 2.x.

regards
 Steve
-- 
Helping people meet their information needs with training and technology.
703 967 0887      sholden at bellatlantic.net      http://www.holdenweb.com/







More information about the Python-list mailing list