question about class, functions and scope
nephish
nephish at gmail.com
Sat Aug 26 05:13:22 EDT 2006
lo there all,
i have an app that runs three classes as threads in the same program.
some of them need to be able to share some functions. Can i set a
function before i define a class and have the class use it ? Kinda like
this.
def some_function(var1, var2):
do something with var1, var2
return result
class do_something1(threading.Thread):
def __init__(var):
do something
def run():
var1 = 3
var2 = 4
result = some_function(var1,var2)
is this legal ? is it pythonic?
i ask because i plan to do a big re-write soon, and want to get rid of
some repetition
thanks
More information about the Python-list
mailing list