Is their an expression to create a class?

Robert Kern robert.kern at gmail.com
Tue Mar 17 22:24:08 CET 2009


On 2009-03-17 16:13, Paddy wrote:
> We the def statement and the lambda expression. We have the class
> statement, but is their an expression to create a class?
>
> Or:
>
>>>> def F(): pass
>
>>>> type(F)
> <type 'function'>
>>>> # Is to:
>>>> F2 = lambda : none
>>>> type(F2)
> <type 'function'>
>>>> # As
>>>> class O(object): pass
>
>>>> type(O)
> <type 'type'>
>>>> # is to:
>>>> # ????

type('O', (object,), {})

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list