Property setter and lambda question

John Posner jjposner at codicesoftware.com
Mon Jul 11 19:26:27 CEST 2011


On 2:59 PM, Anthony Kong wrote:

<snip>
> So the question: is it possible to use lambda expression at all for
> the setter? (As in the last, commented-out line)
>
> Python interpreter will throw an exception right there if I use the
> last line ('SyntaxError: lambda cannot contain assignment'). I'd use
> pass a setter method anyway.  
>
> What is your preferred solution?

Anthony, you might take a look at this alternative writeup for
"property", which I placed on the Python Wiki:

    http://wiki.python.org/moin/AlternativeDescriptionOfProperty

HTH,
John






More information about the Python-list mailing list