Re: Simple Python class questions

2008-06-20 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Lie <[EMAIL PROTECTED]> wrote: > On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > > John Dann wrote: > > > Let's say I define the class in a module called comms.py. The class > > > isn't really going to inherit from any other class (except presumab

Re: Simple Python class questions

2008-06-20 Thread Lie
On Jun 19, 10:49 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > Lie wrote: > > I think it's not that hard to see that it's just a pseudo code > > "...in comms.py I have: ..." actually explicitly says that it is actual code > from a file. > > *shrug* > > Uli > I'm not sure how you think saying 'i

Re: Simple Python class questions

2008-06-20 Thread Duncan Booth
John Dann <[EMAIL PROTECTED]> wrote: > Yes I was wondering about that, but I wasn't clear about when 'body' > code (ie not contained within a def block) in the module might run > under Python. So it seemed to be safer to place the import statement > inside the 'constructor' to get the earliest war

Re: Simple Python class questions

2008-06-20 Thread cokofreedom
> > Yes I was wondering about that, but I wasn't clear about when 'body' > code (ie not contained within a def block) in the module might run > under Python. So it seemed to be safer to place the import statement > inside the 'constructor' to get the earliest warning of non-visibility > of pyserial

Re: Simple Python class questions

2008-06-20 Thread John Dann
Many thanks for the further comments: On Thu, 19 Jun 2008 21:24:31 -0400, Terry Reedy <[EMAIL PROTECTED]> wrote: >> def __init__(self): >> Try >> Import serial # the pyserial library >The import should be at module level. You only want to do it once, not

Re: Simple Python class questions

2008-06-19 Thread Terry Reedy
John Dann wrote: Let's say I define the class in a module called comms.py. The class isn't really going to inherit from any other class (except presumably in the most primitive base-class sense, which is presumably automatic and implicit in using the class keyword). Let's call the class serial

Re: Simple Python class questions

2008-06-19 Thread Ulrich Eckhardt
Lie wrote: > I think it's not that hard to see that it's just a pseudo code "...in comms.py I have: ..." actually explicitly says that it is actual code from a file. *shrug* Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/ma

Re: Simple Python class questions

2008-06-19 Thread Lie
On Jun 19, 7:21 pm, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: > John Dann wrote: > > Let's say I define the class in a module called comms.py. The class > > isn't really going to inherit from any other class (except presumably > > in the most primitive base-class sense, which is presumably automat

Re: Simple Python class questions

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 15:13:39 John Dann, vous avez écrit : > Many thanks for the speedy replies. > > On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <[EMAIL PROTECTED]> > > wrote: > >Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit : > >> Let's say I define the class in a module

Re: Simple Python class questions

2008-06-19 Thread John Dann
Many thanks for the speedy replies. On Thu, 19 Jun 2008 14:14:02 +0200, Cédric Lucantis <[EMAIL PROTECTED]> wrote: >Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit : >> Let's say I define the class in a module called comms.py. The class >> isn't really going to inherit from any other

Re: Simple Python class questions

2008-06-19 Thread Ulrich Eckhardt
John Dann wrote: > Let's say I define the class in a module called comms.py. The class > isn't really going to inherit from any other class (except presumably > in the most primitive base-class sense, which is presumably automatic > and implicit in using the class keyword). Let's call the class > s

Re: Simple Python class questions

2008-06-19 Thread Lie
On Jun 19, 6:54 pm, John Dann <[EMAIL PROTECTED]> wrote: > A Python newbie, but some basic understanding of how classes, objects > etc work in eg VB.Net. However, I'm struggling a little to translate > this knowledge into the Python context. > > I'm trying to teach myself this aspect of Python by w

Re: Simple Python class questions

2008-06-19 Thread Cédric Lucantis
Le Thursday 19 June 2008 13:54:03 John Dann, vous avez écrit : > A Python newbie, but some basic understanding of how classes, objects > etc work in eg VB.Net. However, I'm struggling a little to translate > this knowledge into the Python context. > > Maybe I could provide some outline code as an i

Simple Python class questions

2008-06-19 Thread John Dann
A Python newbie, but some basic understanding of how classes, objects etc work in eg VB.Net. However, I'm struggling a little to translate this knowledge into the Python context. I'm trying to teach myself this aspect of Python by working up a trial project, part of which calls for pulling in data