Fredrik Lundh wrote:
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.

umm. isn't that just an incredibly obscure way to write

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

but with more indentation?

If suites were commonly used as above to define properties, event handlers and other callbacks, then I think most people would be able to comprehend what the first example above is doing much more quickly than the second.


So, I don't find it obscure for any reason other than because no one does it.

Also, the two examples above are not exactly the same since the two functions are defined in a separate namespace in the top example.

-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