Re: question about class, functions and scope

2006-08-28 Thread Gabriel Genellina
At Monday 28/8/2006 14:55, shawn bright wrote: would it be better to move all the functions i want to share into some class and have the class threads refer to them that way ? i mean, just to keep things seperate, but resuseable ? That really depends on your design. Python does not enforce th

Re: question about class, functions and scope

2006-08-28 Thread Gabriel G
At Saturday 26/8/2006 06:13, nephish wrote: 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

Re: question about class, functions and scope

2006-08-26 Thread nephish
[EMAIL PROTECTED] wrote: > nephish: > > one more question. > > the functions defined above the classes that the could be called from > > within the classes, they do not need a 'self' declaration because they > > are not part of a class, right? > > Class methods generally require the self as first

Re: question about class, functions and scope

2006-08-26 Thread bearophileHUGS
nephish: > one more question. > the functions defined above the classes that the could be called from > within the classes, they do not need a 'self' declaration because they > are not part of a class, right? Class methods generally require the self as first parameter, functions don't need the sel

Re: question about class, functions and scope

2006-08-26 Thread nephish
nephish wrote: > [EMAIL PROTECTED] wrote: > > nephish: > > > is this legal ? is it pythonic? > > > > It's legan and pythonic. Functions are here for a purpose. > > > > Bye, > > bearophile > > cool enough, and thanks for the quick reply. > > shawn one more question. the functions defined above the

Re: question about class, functions and scope

2006-08-26 Thread nephish
[EMAIL PROTECTED] wrote: > nephish: > > is this legal ? is it pythonic? > > It's legan and pythonic. Functions are here for a purpose. > > Bye, > bearophile cool enough, and thanks for the quick reply. shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: question about class, functions and scope

2006-08-26 Thread bearophileHUGS
nephish: > is this legal ? is it pythonic? It's legan and pythonic. Functions are here for a purpose. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

question about class, functions and scope

2006-08-26 Thread nephish
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 r