Re: __init__ as a lambda

2010-08-04 Thread Steven D'Aprano
On Wed, 04 Aug 2010 12:58:18 -0700, Eric J. Van der Velden wrote: > Hello, > > Suppose > > class C: > def __init__(self,name):self.name=name > > I was wondering if I could make the __init__ a lambda function, Of course you can. Lambdas aren't special types of functions, they are *syntax* for

Re: __init__ as a lambda

2010-08-04 Thread John Nagle
On 8/4/2010 12:58 PM, Eric J. Van der Velden wrote: Hello, Suppose class C: def __init__(self,name):self.name=name I was wondering if I could make the __init__ a lambda Python is not a functional language. Attempts to make it one make it worse. There's this mindset that loops are

Re: __init__ as a lambda

2010-08-04 Thread Carl Banks
On Aug 4, 12:58 pm, "Eric J. Van der Velden" wrote: > Hello, > > Suppose > > class C: >  def __init__(self,name):self.name=name > > I was wondering if I could make the __init__ a lambda function, but > > class C: >  __init__=lambda self,self.name:None > > and then later, > > C('Hello') > > does no

Re: __init__ as a lambda

2010-08-04 Thread Stefan Schwarzer
Hi Eric, On 2010-08-04 21:58, Eric J. Van der Velden wrote: > class C: > def __init__(self,name):self.name=name > > I was wondering if I could make the __init__ a lambda function, but > > class C: > __init__=lambda self,self.name:None > > and then later, > > C('Hello') > > does not work; th

__init__ as a lambda

2010-08-04 Thread Eric J. Van der Velden
Hello, Suppose class C: def __init__(self,name):self.name=name I was wondering if I could make the __init__ a lambda function, but class C: __init__=lambda self,self.name:None and then later, C('Hello') does not work; the first argument, self, is assigned all rigth, but you cannot write th