A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021428.html below:

[Python-Dev] A Hygienic Macro System in Python?

[Python-Dev] A Hygienic Macro System in Python? [Python-Dev] A Hygienic Macro System in Python?Greg Ewing greg@cosc.canterbury.ac.nz
Tue, 19 Mar 2002 17:39:40 +1200 (NZST)
Tim Peters <tim.one@comcast.net>:

> Maybe Guido can introduce a canned "withlock" macro just
> for that <ahem>:
> 
>     withlock lock:
>         do stuff

Daniel Mahler <mahler@cyc.com>:

> There are many APIs that lead you to write code with certain fixed
> parts
> ...
> I think the thing worth noting here is that the introduced
> constructs would usually be colon&indent type entities

I've been trying to think of a Pythonic syntax for passing
code blocks to procedures. The best thing I've come up with
so far is something like

  lock.do:
    something()

which would be (sort of) equivalent to

  def thunk():
    do_something()
  lock.do(thunk)

except that the thunk would have to have write access to
the namespace it's embedded in, perhaps implemented by
sharing the stack frame.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4