Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9268

Re: Property setter and lambda question

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 <jjposner@codicesoftware.com>
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 <jjposner@codicesoftware.com>
Subject Re: Property setter and lambda question
In-reply-to <CAAyd8cncdj0CStxZdWDcpWCjjEd7WVA=m-CQ0H988zuv52SwMg@mail.gmail.com>
To Anthony Kong <anthony.hw.kong@gmail.com>
MIME-version 1.0
Content-type text/plain; charset=windows-1252
Content-transfer-encoding 7BIT
References <CAAyd8cncdj0CStxZdWDcpWCjjEd7WVA=m-CQ0H988zuv52SwMg@mail.gmail.com>
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 <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.911.1310405216.1164.python-list@python.org> (permalink)
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

Show key headers only | View raw


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


Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Property setter and lambda question John Posner <jjposner@codicesoftware.com> - 2011-07-11 13:26 -0400

csiph-web