<div>I&#39;ve now written my first set of Classes to do some fairly specific processing for work I do. I have a few questions.</div>
<div>&nbsp;</div>
<div>First, in looking through what I&#39;ve done, I basically just incorporated all my previous scripts into classes... they are still highly specific to my application, though I did try to make them somewhat &#39;reusable&#39; or general. It is difficult though, as portions required hardcoding. For that I used the __init__ method to define a bunch of &#39;hardcoded&#39; variables, that could then be set if they were passed on initiation.
</div>
<div>&nbsp;</div>
<div>I guess, I&#39;m writing because I&#39;m wondering now what people think about writing classes versus just using scripts for things that are so specific. It&#39;s hard for me to give&nbsp;an example, or show what I&#39;m doing, but I would appreciate thoughts on that matter.
</div>
<div>&nbsp;</div>
<div>One thing I am struggling with is how to assign *args and **kwargs if they are passed, and how to ignore them if they are not... right now I do this:</div>
<div>&nbsp;</div>
<div>def myfunc(self, *args,**kwargs):</div>
<div>&nbsp;&nbsp; a=self.a</div>
<div>&nbsp;&nbsp; b=self.b</div>
<div>&nbsp;&nbsp; kwa=self.kwa</div>
<div>&nbsp;&nbsp; kwb=self.kwb</div>
<div>&nbsp;&nbsp;&nbsp;try: </div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a=args[0]; b=args[1]</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kwa=kwargs[&#39;a&#39;]</div>
<div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kwb=kwargs[&#39;b&#39;]</div></div>
<div>&nbsp;&nbsp; except: pass</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>Where self.X is defined in the __init__ of the class. Is that correct?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>