Smalltalk and Python

Alex Martelli aleaxit at yahoo.com
Fri Dec 15 13:32:56 CET 2000


"Andrew Dalke" <dalke at acm.org> wrote in message
news:91c7r4$7a0$1 at slb1.atl.mindspring.net...
    [snip]
> One packet of syntactic sugar, coming up!
>
> def make_a(*classes):
>   class make_a:
>     pass
>   make_a.__bases__ = tuple(classes)
>   return make_a()

or, in a similar vein:

def make_a(*classes, **attribs):
    return new.classobj('blob', classes, attribs)()


Alex






More information about the Python-list mailing list