Re: help with my first use of a class

2006-10-22 Thread bruno de chez modulix en face
Fulvio a écrit : > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Saturday 21 October 2006 02:01, James Stroud wrote: > > I think the trick is to identify when a class would make more sense than > > a collection of subroutines > > I do be

Re: help with my first use of a class

2006-10-21 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Saturday 21 October 2006 02:01, James Stroud wrote: > I think the trick is to identify when a class would make more sense than > a collection of subroutines I do believe that's a bit of forecasting, i

Re: help with my first use of a class

2006-10-20 Thread Simon Brunning
On 10/20/06, James Stroud <[EMAIL PROTECTED]> wrote: > > I don't really have formal programming training, but it is increasingly > becoming my experience that OOP is but one ingredient in a good program. > It can be left out or it can be mixed with other ingredients for a nice > effect. Indeed. Py

Re: help with my first use of a class

2006-10-20 Thread James Stroud
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Friday 20 October 2006 14:34, James Stroud wrote: >> You really don't need classes for this > > I'm in that matter too. Doesn't classes make the main program neater? > Fundam

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Friday 20 October 2006 14:34, James Stroud wrote: >> You really don't need classes for this > > I'm in that matter too. Doesn't classes make the main program neater? Depends

Re: help with my first use of a class

2006-10-20 Thread Fulvio
*** Your mail has been scanned by InterScan MSS. *** On Friday 20 October 2006 14:34, James Stroud wrote: > You really don't need classes for this I'm in that matter too. Doesn't classes make the main program neater? Fundamentally OOP is the way to assembl

Re: help with my first use of a class

2006-10-20 Thread BartlebyScrivener
Thank you all! My main problem is going away from Python and programming for weeks or months at a time, then picking up where I left off. But Python is much better in this regard than Perl. I appreciate the help. rd - Dennis Lee Bieber wrote: > If using a db-api compliant ada

Re: help with my first use of a class

2006-10-20 Thread BartlebyScrivener
Thanks, Bruno. Very educational. rd Bruno Desthuilliers wrote: > Think of a class as both a "blueprint" for objects and a factory > creating these objects. The class lets you define the attributes and > behaviors of it's instances. > > First, notice that you *don't* need a class here to avoid gl

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
Fredrik Lundh wrote: > Bruno Desthuilliers wrote: > >> First, notice that you *don't* need a class here to avoid globals. >> Learning to use function as *functions* (ie: taking arguments and >> returning values) instead of procedure would help: >> >> def random_quote(cursor): >> c.execute ("SELEC

Re: help with my first use of a class

2006-10-20 Thread Fredrik Lundh
Bruno Desthuilliers wrote: > First, notice that you *don't* need a class here to avoid globals. > Learning to use function as *functions* (ie: taking arguments and > returning values) instead of procedure would help: > > def random_quote(cursor): > c.execute ("SELECT COUNT(Quote) FROM PythonQuote

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
BartlebyScrivener wrote: > Whoah. At least I got the connection. I think. Maybe I can figure more > on my own. Any help appreciated. > > Thanks > > - > > class Connection: > def __init__(self, aDatasource): > self.db = aDatasource > self.conn = odbc.DriverConnect(self

Re: help with my first use of a class

2006-10-20 Thread Bruno Desthuilliers
BartlebyScrivener wrote: > I am a mere hobbyist. Spent several hours trying to make a class, > because I think this is an occasion where I need one. But I can't make > it work. > > This code "works" (only because of the global c, which I know I'm > supposed to avoid, by using a Class). I edited th

Re: help with my first use of a class

2006-10-19 Thread BartlebyScrivener
Wow, That's great, James. Thanks. I shall put it together. Appreciate it. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: help with my first use of a class

2006-10-19 Thread James Stroud
BartlebyScrivener wrote: > I am a mere hobbyist. Spent several hours trying to make a class, > because I think this is an occasion where I need one. But I can't make > it work. > > This code "works" (only because of the global c, which I know I'm > supposed to avoid, by using a Class). I edited th

Re: help with my first use of a class

2006-10-19 Thread [EMAIL PROTECTED]
BartlebyScrivener wrote: > I am a mere hobbyist. Spent several hours trying to make a class, > because I think this is an occasion where I need one. But I can't make > it work. > > This code "works" (only because of the global c, which I know I'm > supposed to avoid, by using a Class). I edited the

Re: help with my first use of a class

2006-10-19 Thread BartlebyScrivener
Whoah. At least I got the connection. I think. Maybe I can figure more on my own. Any help appreciated. Thanks - class Connection: def __init__(self, aDatasource): self.db = aDatasource self.conn = odbc.DriverConnect(self.db) self.conn.cursor() def random_quo