Too Self Centered

Cliff Wells LogiplexSoftware at earthlink.net
Wed Jan 8 02:01:46 CET 2003


On Tue, 2003-01-07 at 12:53, beno wrote:
> Hi;
> I'm writing my first real script and running into what appears to be a 
> problem. Although this code works perfectly well, it seems to have way too 
> many uses of *self.* in it. But if I don't put them in, the runtime 
> compiler complains that various global names aren't defined. What to do? 

I'd be more concerned about lack of whitespace.  This is pretty hard to
read in its current state.

> Here's an example of the code.
> TIA,
> beno
> 
>   def __init__(self):
>    self.readFile = open('test1','r')
>    while self.readFile.readline() != '':
>     self.count = self.count + 1
>    self.total = self.count
>    self.readFile.close()
>   def firstRead(self):
>    self.readFile = open('test1','r')

[snip]

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308






More information about the Python-list mailing list