[Tutor] custom types question

Michael Janssen Janssen at rz.uni-frankfurt.de
Thu Feb 12 04:25:26 EST 2004


On Thu, 12 Feb 2004, Thomas Clive Richards wrote:

> Also, does anyone know if there are any builtin python types which are written
> in python, or are they all in C? It'd be good to be able to look through the
> source code to the builtin types and see how they're done. I guess they'll be
> in C for the extra speed though.

they're C code and live in the instalation dir under Objects as
listobject.c and so forth. But you needn't to wade trough C code because
list, string and dict are available in python moduls: UserList,
UserString, UserDict. Here you find (old-style) classes that reimplement
all (most of?) the special methods (__somewhat__) in python.

Those UserX Classes are probably not worth to subclass now where we have
new-style classes but give's you mutch infos about how the C objects
work.


Special methods are described here:
http://www.python.org/doc/current/ref/specialnames.html



>
> Anyway, thanks ;)
>
>
> --
>
> Thomi Richards,
> thomi at once.net.nz
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



More information about the Tutor mailing list