Neal Becker a écrit :
Maybe I'm missing something obvious here

def A (...):
#set a bunch of variables
  x = 1
  b = 2
  ...

  Do something with them

def B (...):
#set the same bunch of variables
  x = 1
  b = 2
  ...

  Do something with them

I want to apply DRY, and extract out the common setting of these variables into the local scope of the functions A and B. How to do this? (Other than just setting them in the module scope)

If your "variables" are literal constants common to the whole module, and are *not* modified within the functions, the obvious answer is to define them as module level (pseudo) symbolic constants.

Else, please provide more background.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to