On Thu, 21 Apr 2005 07:58:14 -0400, Kent Johnson <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote: >> The following shows nothing static anywhere, yet a class has been defined, >> an instance created, and >> __init__ called with initial value, and the value retrieved as an attribute >> of the returned instance, >> and it's all an expression. >> >> >>> type('C', (), {'__init__': lambda >> self,v:setattr(self,'foo',v)})('hello').foo >> 'hello' > >I have no idea what point you are trying to make, except maybe that it is >possible to obfuscate a >simple class definition. > I may have misunderstood your point ;-) I was just trying to add an exclamation point. I.e., everything happening above shows that you don't need to have a name bound to the class as in class C:pass, nor do you need to "put" and instance "somewhere", as in in inst = C('hello'), and you don't need to do that to get inst.foo from all of the preceding. I.e., whatever the OP thinks about assigning/binding, it's not an absolutely necessary part of any of the preceding. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list