Shannon -jj Behrens wrote:
Have you guys considered the following syntax for anonymous blocks?  I
think it's possible to parse given Python's existing syntax:

  items.doFoo(
      def (a, b) {
          return a + b
      },
      def (c, d) {
          return c + d
      }
  )


There was a proposal in the last few days on comp.lang.python that allows you to do this in a way that requires less drastic changes to python's syntax. See the thread "pre-PEP: Suite-Based Keywords" (shamless plug) (an earlier, similar proposal is here: http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list %40python.org ).


In short, if doFoo is defined like:

def doFoo(func1, func2):
        pass

You would be able to call it like:

doFoo(**):
        def func1(a, b):
                return a + b
        def func2(c, d):
                return c + d

That is, a suite can be used to define keyword arguments.

-Brian
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to