Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.07; 'python': 0.08; 'header:In-reply-to:1': 0.09; 'question:': 0.09; 'throw': 0.09; 'exception': 0.12; 'url:moin': 0.12; 'wrote:': 0.15; 'lambda': 0.16; 'last,': 0.16; 'received:167.206.4': 0.16; 'received:cv.net': 0.16; 'received:hcvlny.cv.net': 0.16; 'received:srv.hcvlny.cv.net': 0.16; 'solution?': 0.16; 'cc:addr :python-list': 0.16; 'pm,': 0.16; 'subject:question': 0.21; 'cc:2**0': 0.21; 'url:wiki': 0.25; 'preferred': 0.25; 'pass': 0.28; 'anyway.': 0.29; 'cc:addr:python.org': 0.30; 'anthony': 0.30; 'expression': 0.32; 'header:User-Agent:1': 0.34; 'there': 0.34; '(as': 0.34; 'url:python': 0.37; 'received:192': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'might': 0.39; "i'd": 0.40; 'your': 0.60; 'john': 0.62; 'alternative': 0.70; 'placed': 0.72; 'kong': 0.84; 'subject:Property': 0.84 Date: Mon, 11 Jul 2011 13:26:27 -0400 From: John Posner Subject: Re: Property setter and lambda question In-reply-to: To: Anthony Kong MIME-version: 1.0 Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7BIT References: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310405216 news.xs4all.nl 21750 [2001:888:2000:d::a6]:45105 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9268 On 2:59 PM, Anthony Kong wrote: > 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