Thomas Jollans wrote:
> On 06/15/2010 12:06 AM, Craig Yoshioka wrote:
>> I'm trying to write a class factory to create new classes dynamically at
>> runtime from simple 'definition' files that happen to be written in
>> python as well. I'm using a class factory since I couldn't find a way to
>> u
Sorry, the first example should be:
class Status(object):
def __init__(self,definitions):
for key,function in definitions:
setattr(self,key,property(function))
On Jun 14, 2010, at 3:06 PM, Craig Yoshioka wrote:
> I'm trying to write a class factory
On 06/15/2010 12:06 AM, Craig Yoshioka wrote:
> I'm trying to write a class factory to create new classes dynamically at
> runtime from simple 'definition' files that happen to be written in python as
> well. I'm using a class factory since I couldn't find a way to use
> properties with dynamic
On Mon, Jun 14, 2010 at 4:06 PM, Craig Yoshioka wrote:
> def makeStatus(definitions):
> class Status(object):
> pass
> for key,function,data in definitions:
> setattr(Status,key,property(lambda x: function(data)))
> return Status()
>
> but all my
Fernando Perez wrote:
> there are a couple of threads on lambdas today, which got me curious about
> their differences as far as bytecode goes:
>
> planck[~]|2> lf=lambda x: x**2
> planck[~]|3> def ff(x): return x**2
> |.>
> planck[~]|4> import dis
> planck[~]|5> dis.dis(lf)
> 1
Erik Max Francis wrote:
> Fernando Perez wrote:
>
>> Can someone explain to me what the extra two bytecodes at the end of the
>> function version (ff) are for?
>>
>> This is just curiosity, please note that I am NOT making any arguments pro
>> or against lambdas, functions or anything else.
>
>
Fernando Perez wrote:
Can someone explain to me what the extra two bytecodes at the end of the
function version (ff) are for?
This is just curiosity, please note that I am NOT making any arguments pro or
against lambdas, functions or anything else.
It's returning None. I would guess that it's a sa