Best way to create a class dynamically on the fly?

Robert Oschler Oschler at earthlink.net
Sat Sep 28 14:38:27 EDT 2002


"Robert Oschler" <Oschler at earthlink.net> wrote in message
news:tFml9.13043$Lg2.3865279 at news2.news.adelphia.net...
> What is the best way to create a Python class dynamically at runtime?  A
> sample or doc would be great.  I'm a veteran C++ programmer so this
concept
> is very alien to me as you can imagine (dynamically created classes).  An
> example that would show the creation of a descendant (sub-class), and a
> another example showing the creation of an ancestor class would be
perfect.
>
> thx

I forgot to mention, I would like the classes I create dynamically to be
fully "pickle-able".  If there are any caveats or limitations in this area
please let me know.

thx






More information about the Python-list mailing list