Re: Refactoring Dilemma

2006-09-11 Thread Steven Bethard
Kamilche wrote: > Is there any reason NOT to do this that I may be unaware of? [snip] > # --- Module 2.py > # 'Self' module processing > import sys > var = 0 > self = sys.modules[__name__] > > def MyRoutine(): > self.var = 1 > > MyRoutine() > print var Looks basically fi

Re: Refactoring Dilemma

2006-09-10 Thread Carl Banks
George Sakkis wrote: > I prefer the the simple global statements if they aren't > that many, otherwise the assignment of the module to self is also fine. I replied to this article, and then canceled the reply (but that never works), thinking you were criticizing the general concept of "module as a

Re: Refactoring Dilemma

2006-09-10 Thread Carl Banks
George Sakkis wrote: > Carl Banks wrote: > > I don't see any major problem with it. In fact, I think it's a very > > good idea to do this, rather than use global statements, when using > > module as a singleton class. > > > > I recently made the same transition myself, though I solved it a bit >

Re: Refactoring Dilemma

2006-09-10 Thread George Sakkis
Carl Banks wrote: > Kamilche wrote: > > ''' > > I'm in the middle of a refactoring dilemma. > > I have several singletons that I'm turning into modules, for ease of > > access. > > The usual method is noted as 'Module 1' below. &g

Re: Refactoring Dilemma

2006-09-10 Thread Carl Banks
George Sakkis wrote: > Kamilche wrote: > > ''' > > I'm in the middle of a refactoring dilemma. > > I have several singletons that I'm turning into modules, for ease of > > access. > > The usual method is noted as 'Module 1' below

Re: Refactoring Dilemma

2006-09-10 Thread Carl Banks
Kamilche wrote: > ''' > I'm in the middle of a refactoring dilemma. > I have several singletons that I'm turning into modules, for ease of > access. > The usual method is noted as 'Module 1' below. > The new method is noted as 'Module 2&#x

Re: Refactoring Dilemma

2006-09-10 Thread George Sakkis
Kamilche wrote: > ''' > I'm in the middle of a refactoring dilemma. > I have several singletons that I'm turning into modules, for ease of > access. > The usual method is noted as 'Module 1' below. > The new method is noted as 'Module 2&#x

Refactoring Dilemma

2006-09-10 Thread Kamilche
''' I'm in the middle of a refactoring dilemma. I have several singletons that I'm turning into modules, for ease of access. The usual method is noted as 'Module 1' below. The new method is noted as 'Module 2'. Is there any reason NOT to do th