Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Johan Martinez
On Tue, Nov 5, 2013 at 6:19 PM, Steven D'Aprano wrote: > On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: > > I need help in modifying my program. Right now it looks as follows: > [snip code] > > Can someone help me in improving my code? > > Yes! The first thing to do is get rid of

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Walter Prins
Hi, On 6 November 2013 08:58, Mark Lawrence wrote: > On 06/11/2013 02:19, Steven D'Aprano wrote: > >> On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: >> >>> I need help in modifying my program. Right now it looks as follows: >>> >> [snip code] >> >>> Can someone help me in impro

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Alan Gauld
On 06/11/13 02:19, Steven D'Aprano wrote: Yes! The first thing to do is get rid of the unnecessary class. This is not Java where you have to write classes for everything. From the sample code that you show below, using OOP here accomplishes nothing except making the code more complicated and les

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Mark Lawrence
On 06/11/2013 02:19, Steven D'Aprano wrote: On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: I need help in modifying my program. Right now it looks as follows: [snip code] Can someone help me in improving my code? Yes! The first thing to do is get rid of the unnecessary class

Re: [Tutor] Creating class / OOP structure

2013-11-05 Thread Steven D'Aprano
On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: > I need help in modifying my program. Right now it looks as follows: [snip code] > Can someone help me in improving my code? Yes! The first thing to do is get rid of the unnecessary class. This is not Java where you have to write cl

Re: [Tutor] Creating class / OOP structure

2013-11-05 Thread Alan Gauld
On 05/11/13 23:55, Johan Martinez wrote: I need help in modifying my program. Right now it looks as follows: class Filedict(): def __init__(self, fname): self.fname =fname def parse(self): with open(self.fname, 'r') as f: # some file

[Tutor] Creating class / OOP structure

2013-11-05 Thread Johan Martinez
I need help in modifying my program. Right now it looks as follows: class Filedict(): def __init__(self, fname): self.fname =fname def parse(self): with open(self.fname, 'r') as f: # some file search and parsing logic return parsed_fil