Re: [Tutor] Subclassing vs. stand alone functions

2007-06-16 Thread chrispython
Thanks again, this is exactly the kind of info I need to make the jump from procedural to OO design. I bookmarked your site for reference. On Saturday, June 16, 2007, at 09:30AM, "Kent Johnson" <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> Hi there, >> >> I am new to Python and tryin

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-16 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi there, > > I am new to Python and trying to get my head around the OO stuff. I > guess my question is - when do you go with subclassing vs. making a > standalone function? > Let's say you want to load a dictionary. Do I create a function that > accepts some argument

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-16 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote >>Just so you know, my day gig is maintaining a 30 year old COBOL app >>and >>writing custom RPGLE - http://en.wikipedia.org/wiki/RPGLE - on an >>IBM i5. >>So that's where I am coming from. Thats probably one of the hardest places to learn OOP from. COBOL, more than an

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-15 Thread chrispython
I am new to Python and trying to get my head around the OO stuff. I guess my question is - when do you go with subclassing vs. making a standalone function? OK, I'll take a slightly different approach than the other answers so far. First: procedural and OO styles of programming are diffrent

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-15 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > I am new to Python and trying to get my head around > the OO stuff. I guess my question is - when do you go > with subclassing vs. making a standalone function? OK, I'll take a slightly different approach than the other answers so far. First: procedural and OO st

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-15 Thread Senthil_OR
[EMAIL PROTECTED] wrote: > > Let's say you want to load a dictionary. Do I create a function that > accepts some argument (say a file name) and returns a dictionary, or > do I subclass dict and override the __init__ and __setitem__ > functions to make 'self-loading' dictionary? It seems the end r

Re: [Tutor] Subclassing vs. stand alone functions

2007-06-15 Thread Jorgen Bodde
Hi, Basically you write a (sub)class when you want to preserve state information of your instance. If the functionality in question lives longer then the scope of the function, and will be called from different methods to obtain the same information and state of the functionality at that time, it