Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Gora Mohanty
On 19 February 2014 17:01, Mukesh Yadav wrote: >> > I can change the class code and parameter as it is small script. >> >> I would think that this is terrible practice. >> > > Would love to more about it. Passing multiple arguments to the function seems to be the cleanest approach, as it separate

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Mukesh Yadav
> > I can change the class code and parameter as it is small script. > > I would think that this is terrible practice. > Would love to more about it. > > Regards, > Gora > ___ > BangPypers mailing list > BangPypers@python.org > https://mail.python.org/

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Mukesh Yadav
@Rohit thanks for **kwargs example. On Wed, Feb 19, 2014 at 4:36 PM, Rohit K wrote: > How about creating a class object > > *Class Params():* > > *def __init__(self, **kwargs):* > > *self.bucket = kwargs['bucket'] * > > > *self.value = kwargs["value"]*. > > and while y

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Gora Mohanty
On 19 February 2014 16:21, Mukesh Yadav wrote: >> Unless I am missing something, why can't you use: >> object.some_awesome_function( bucket ) >> > I can but in my case I have 5+ setting variables, which is not feasible to > pass it for each method which it is using. Why not? If you really wante

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Rohit K
How about creating a class object *Class Params():* *def __init__(self, **kwargs):* *self.bucket = kwargs['bucket'] * *self.value = kwargs["value"]*. and while you create instance for module class: # object = module.*Class_name*('value'); instead of this use below

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Mukesh Yadav
> Unless I am missing something, why can't you use: > object.some_awesome_function( bucket ) > > I can but in my case I have 5+ setting variables, which is not feasible to pass it for each method which it is using. Also, > as you are presumably writing these scripts after the > class code has a

Re: [BangPypers] Managing variable in small scripts.

2014-02-19 Thread Gora Mohanty
On 19 February 2014 15:37, Mukesh Yadav wrote: > Hi, >I normally create small scripts for crons, Sometime I do create multiple > modules. > My question is how to pass same variable to modules which is being used. > > e.g. > > script.py file contans following code > > *import module * > > *buck

[BangPypers] Managing variable in small scripts.

2014-02-19 Thread Mukesh Yadav
Hi, I normally create small scripts for crons, Sometime I do create multiple modules. My question is how to pass same variable to modules which is being used. e.g. script.py file contans following code *import module * *bucket* = 'some_bucket' object = module.*Class_name*('value'); object.