Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed4.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.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'assignment': 0.07; 'subject:code': 0.07; 'exec': 0.09; 'similarly,': 0.16; 'for?': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; "can't": 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; '2015': 0.84; 'want:': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=6DO7a1JO9vwuCUVoIgZz2Yjtm0g6CUiRMK8I39k0wR0=; b=KXu7yJX3yjHar3+HIwNcG1lIELq8nsAM1RJ3l5Pbd6iMSZbw3dQhWBu+ghPBLYKcBt Mr0z9yj83EvwrA2JE+SJPt2LHPogz8QVTyFg7ZLHcD5UMlpMQf6p3zxOziWdklzJqw+G V8VS1FKjow8vVTU1PVcqA7xfHbvuDeRZBCQf49HgFDpYTHnmacrbXbFg8eHVLq83nYCg 79Rz8SRu0OFYk20H0RbfTALuuGj41P3ED0uKSsxpyLZcFqb2IR90LZO3xiKPBPKAXel+ sWPgWYNdQQ2HZcvhfNyevkunDBSr0AahWBueOb6E4c5NK+KekT2xroNSmL+YieMuCBwb Aleg== X-Received: by 10.107.12.158 with SMTP id 30mr10079007iom.61.1431315113422; Sun, 10 May 2015 20:31:53 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <66312d54-de5a-4015-99b5-41d332559e00@googlegroups.com> References: <66312d54-de5a-4015-99b5-41d332559e00@googlegroups.com> From: Ian Kelly Date: Sun, 10 May 2015 21:31:13 -0600 Subject: Re: code blocks To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431315116 news.xs4all.nl 2947 [2001:888:2000:d::a6]:57798 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3065 X-Received-Body-CRC: 876913337 Xref: csiph.com comp.lang.python:90339 On Sun, May 10, 2015 at 7:39 PM, zipher wrote: > Similarly, you'd want: > >>>> encode(codestr) > > to instantiate all objects in the codestr. You can't do this with eval, because it doesn't allow assignment (eval(n=2) returns "InvalidSyntax"). Is exec what you're looking for? >>> exec('n = 2') >>> print(n) 2