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


Groups > comp.lang.python > #89831

code blocks

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!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <zondervanz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'subject:code': 0.07; 'string': 0.09; 'strings.': 0.09; 'python': 0.11; 'blocks': 0.16; 'blocks:': 0.16; 'variables,': 0.16; 'code.': 0.18; 'print': 0.22; 'tried': 0.27; 'programming.': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'block,': 0.31; 'invoke': 0.31; 'probably': 0.32; 'open': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'add': 0.35; 'skip:& 10': 0.38; 'generic': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'aside': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'around.': 0.60; 'ambiguous': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=KBKpGmvhZNhoEtrKtDp4RkdwLh8D5oPQMMWpcLLpYgE=; b=B/Lr1WA1FY/HCFiE12J+1DAPEHFD2nZtEAx2nSeP5kWSSFqFqmwS6Y3f72ZW8yfzEJ 84jarXCa8wLSw/8nAFrcqN5ccSHU/FjO+UzejAfGJKWC2NUAkwONTjO39uhcrmP6zGwe eOICAeMByhNM/K1oQvBgGQI5ZdDe32IjHk0CNjYh9gAxLb5vF1QKFUcJ7EMPtK+5Y+Bv 2M4qKrgXD9z/Y0wXe38lsmBal2vZkt1uFJEFn+fOJ1YqKNmmSfX2eBi3nHEVFPMFm/Ti WwPXqrndijHijoBi8AuJvYdiDjv/JVcHtyo/sUerzgzi8yExqcA48Lm5MN5SYsB97G88 xLTA==
MIME-Version 1.0
X-Received by 10.60.135.68 with SMTP id pq4mr12312530oeb.74.1430591421470; Sat, 02 May 2015 11:30:21 -0700 (PDT)
Date Sat, 2 May 2015 13:30:21 -0500
Subject code blocks
From "Dr. John Q. Hacker" <zondervanz@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=047d7b417ff97ee0d205151d85cc
X-Mailman-Approved-At Sun, 03 May 2015 08:04:04 +0200
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.49.1430633046.12865.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1430633046 news.xs4all.nl 2831 [2001:888:2000:d::a6]:56739
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 4705
X-Received-Body-CRC 4158315878
Xref csiph.com comp.lang.python:89831

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I'm thinking how interesting it would be to add code blocks to Python, so
that arbitrary strings of code can be passed around.   It would open up
some interesting possibilities for self-modifying code and generic
programming.

Since Python has already a plethora of ambiguous string designations, one
of them could be set aside specificially for code blocks:

"""for i in n: print i"""

For any variables, like "n", it would access the scope in which it was
running.  When you tried to print a triple-double-quoted code block,
perhaps it could invoke the code.

My suggestion would be to use triple double-quoted strings.

You probably already know that Ruby has code blocks.

zipher

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


Thread

code blocks "Dr. John Q. Hacker" <zondervanz@gmail.com> - 2015-05-02 13:30 -0500
  Re: code blocks Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-03 11:56 +0100
  Re: code blocks zipher <dreamingforward@gmail.com> - 2015-05-10 18:39 -0700
    Re: code blocks Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-10 21:31 -0600
      Re: code blocks Rustom Mody <rustompmody@gmail.com> - 2015-05-10 20:40 -0700
      Re: code blocks zipher <dreamingforward@gmail.com> - 2015-05-11 08:22 -0700
        Re: code blocks zipher <dreamingforward@gmail.com> - 2015-05-11 08:23 -0700
        Re: code blocks Chris Angelico <rosuav@gmail.com> - 2015-05-12 01:40 +1000
        Re: code blocks Peter Otten <__peter__@web.de> - 2015-05-11 18:01 +0200
        Re: code blocks Chris Angelico <rosuav@gmail.com> - 2015-05-12 02:07 +1000
          Re: code blocks zipher <dreamingforward@gmail.com> - 2015-05-11 09:51 -0700
        Re: code blocks Peter Otten <__peter__@web.de> - 2015-05-11 18:59 +0200
    Re: code blocks Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-10 21:36 -0600

csiph-web