Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Python': 0.04; 'coders': 0.07; 'received:mail-qy0-f174.google.com': 0.07; '__future__': 0.09; 'braces': 0.09; 'pm,': 0.11; 'def': 0.13; 'wrote:': 0.14; 'base64': 0.16; 'received:209.85.216.174': 0.16; 'subject:exercise': 0.16; '\xa0print': 0.16; 'cc:no real name:2**0': 0.20; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'subject:question': 0.22; 'cc:addr:python-list': 0.22; 'thu,': 0.22; 'emailed': 0.23; 'chris': 0.27; 'skip:b 20': 0.27; 'message- id:@mail.gmail.com': 0.28; 'probably': 0.30; 'seem': 0.30; 'this.': 0.30; 'cc:addr:python.org': 0.31; 'cc:addr:gmail.com': 0.31; 'difficulty': 0.31; 'semantics': 0.31; 'it.': 0.31; 'import': 0.32; 'skip:e 20': 0.33; 'page': 0.33; 'there': 0.35; 'print': 0.35; 'think': 0.36; 'should': 0.37; 'received:209.85': 0.37; 'issue': 0.37; 'thursday,': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'reasons': 0.38; 'cc:2**1': 0.38; 'could': 0.39; 'received:209': 0.39; "it's": 0.40; 'header:Received:5': 0.40; 'address': 0.61; '2011': 0.62; 'as:': 0.64; 'mar': 0.64; 'march': 0.66; 'share': 0.67; 'to:addr:googlegroups.com': 0.69; "today's": 0.69; 'lovely': 0.84; 'subject:Learn': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=N40+Ub1JS9Arv20XFLzhFAwyuRlNqIkScPKejMxIW5o=; b=fHVCEQbgo2ac3xHfJbWfP8b3zjqeMTC01BKUzy8lhUZIRu6YmxZ4J6K1tWAqi6U+7b /IFZf66VOROmqkXRsma46kRwh4ohXlyfXDGi+d2RZxUV4tbZWC957K5hJiQS0hnZs7D8 bZu3O+23VPHig3pdV1GKhLLUbadBNg4LwLbLs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=C+cAe1CbbAkbovCbREWQVxkaumSQSqfg7+reD9zxnB0zslhUYf/BwWUe/hQMbcZ8IQ MsRGoJyQOkMiKPXUZOF8h2+dPo7IdXhrHEL73Fz/q4J3am/sRv1UcR+csnDBjTv5K8YL mIA+1kmLVYb1NVCC6gRLyJrh77QZHP0r5RsmQ= MIME-Version: 1.0 In-Reply-To: <493bab97-ec24-450d-8366-5e8302b57181@glegroupsg2000goo.googlegroups.com> References: <493bab97-ec24-450d-8366-5e8302b57181@glegroupsg2000goo.googlegroups.com> Date: Thu, 31 Mar 2011 14:57:33 -0700 Subject: Re: Learn Python the Hardway exercise 11 question 4 From: geremy condra To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, "eryksun \(\)" 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: 42 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1301608656 news.xs4all.nl 41110 [::ffff:82.94.164.166]:54678 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2305 On Thu, Mar 31, 2011 at 2:43 PM, eryksun () wrote: > On Thursday, March 31, 2011 4:35:42 PM UTC-4, Chris Angelico wrote: >> >> I was trolling, I know the reasons behind it. Anyway, most people >> don't share code by email! (Actually, since you seem to be the author >> of that page - could you address that particular point? I think it's >> probably as big an issue as any of the others, to today's coders - >> "code semantics get destroyed by forums/email/etc/etc/etc".) >> >> Solution: All emailed code should begin with >> from __future__ import braces >> And there you are, out of your difficulty at once! > > You could paste it as a base64 stream, such as: > > >> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg >> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI=3D > > > Then decode and exec: > > In [1]: import base64 > > In [2]: %cpaste > Pasting code; enter '--' alone on the line to stop. > :code=3D"""> ZGVmIHNwYW0oKToNCiAgICBwcmludCAiU3BhbSEg > :> TG92ZWx5IHNwYW0hIExvdmVseSBzcGFtISI=3D""" > :-- > > In [3]: print base64.b64decode(code) > def spam(): > =A0 =A0print "Spam! Lovely spam! Lovely spam!" > > In [4]: exec(base64.b64decode(code)) > > In [5]: spam() > Spam! Lovely spam! Lovely spam! I know it's tongue-in-cheek, but please, please, please don't do this. Geremy Condra