[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python/swig bindings.

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-10-02 18:32:04 CEST

On Fri, 2004-10-01 at 12:21, C. Michael Pilato wrote:
> 3. Callback function/baton pairs get reduced to just callback
> functions, and the benefit you get from batons is gotten
> instead through Python default arguments:
[...]
> def function(callback_arg1, ..., userdata1=whatever, ...):

Is the use of default arguments really necessary? Can't you just put
the "whatever" in the body of function? In my tests, an inner function
seems to be able to refer to the outer function's local variables just
fine; for instance, the following prints out "5":

def call(func):
  x = 3
  func()

def function():
  x = 5
  def subfunction():
    y = x
    print y
  call(subfunction)

function()

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 2 18:32:25 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.