Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.065 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'exec': 0.07; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'input': 0.18; 'bit': 0.21; 'received:209.85.214.174': 0.21; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'objects': 0.29; 'this.': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'subject:with': 0.36; 'should': 0.36; 'possible': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'build': 0.39; 'header:Received:5': 0.40; '30,': 0.62; '(source)': 0.84; 'spreadsheet': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LhT8py802rtQ00GF0nsJQjKIt9+s3n9GyfGD8qYHVYg=; b=1BRxPOacKHnv20VHxlHw3epsQtimwCSQnC5ujAr1+ktfAm9DGQmAgeOxNgQawzBQUd FpbqBQ/lGY55rxQFvKSiNE0jLbS3VGlm5SEwmd6VwKDyzo8EdOC+SFUouDC7uIR1yzIS aJDdd30id2nmvPHWHwitCKPLwC6ba6MCK1GAVRw7EPu+PRYhW1ZTpQmrjoQNTv+IwMg1 MwVEAAolIhw29pG2Sdy3eAtbNeCynYgvn2uPyTp1UswE38jMemJGqVpPc7uCb6XWjyfW q7ZmTgZbU6uCQ2jfnl/5m1AnWfTPCOx/ub8moPZvrbZN+VY9aeyZkyX5hss6YA7C3P6I R2xQ== MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 31 Oct 2012 00:18:57 +1100 Subject: Re: exec with partial globals From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351603139 news.xs4all.nl 6982 [2001:888:2000:d::a6]:59394 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32487 On Tue, Oct 30, 2012 at 11:57 PM, Helmut Jarausch wrote: > Given spreadsheet S (Source) and D (Destination) as objects (wrapping a > dictionary) a possible (legal) input would be > > D.price= D.price-S.discount > > No other fields of 'D' should be modifiable. That's a bit harder. What you're describing, using exec with specific globals, would not be able to do this. You'd need to build a proxy object that decides whether or not to pass on the change. ChrisA