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


Groups > comp.lang.python > #89831

code blocks

Date 2015-05-02 13:30 -0500
Subject code blocks
From "Dr. John Q. Hacker" <zondervanz@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.49.1430633046.12865.python-list@python.org> (permalink)

Show all headers | 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