[Python-Dev] defmacro (was: Anonymous blocks)

Shane Hathaway shane at hathawaymix.org
Mon Apr 25 21:14:47 CEST 2005


Michael Chermside wrote:
> In other words, rather than hearing what we'd like to be able to DO
> with blocks, I'd like to hear what we want to PROHIBIT DOING with
> blocks. I think this might be a fruitful way of thinking about the
> problem which might make it easier to evaluate syntax suggestions. And
> if the answer is that we want to prohibit nothing, then the right
> solution is macros.

One thing we don't need, I believe, is arbitrary transformation of code
objects.  That's actually already possible, thanks to Python's compiler
module, although the method isn't clean yet.  Zope uses the compiler
module to sandbox partially-trusted Python code.  For example, it
redirects all print statements and replaces operations that change an
attribute with a call to a function that checks access before setting
the attribute.

Also, we don't need any of these macros, AFAICT:

  http://gauss.gwydiondylan.org/books/drm/drm_86.html

Shane


More information about the Python-Dev mailing list