Simple Python class questions

David C. Ullrich dullrich at sprynet.com
Fri Jun 20 15:00:03 EDT 2008


In article 
<8549940b-e909-4bc6-b9a1-ea7d14284785 at z16g2000prn.googlegroups.com>,
 Lie <Lie.1296 at gmail.com> wrote:

> On Jun 19, 7:21 pm, Ulrich Eckhardt <eckha... at satorlaser.com> 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 automatic
> > > and implicit in using the class keyword). Let's call the class
> > > serial_link. So in comms.py I have:
> >
> > > class serial_link:
> > >     def __init__(self):
> > >         Try
> > >             Import serial # the pyserial library
> >
> > Stop, this can't work. Other than VB, Python actually is case sensitive, so
> > you must write 'try' and not 'Try' and also 'import' and not 'Import'.
> > Further, many (all?) statements that cause an indention are usually
> > terminated with a colon, so like with 'class ..:' and 'def ..:' you also
> > must use 'try:' and not just 'try'. Fix all these and try again, I guess
> > this will already help a lot.
> >[...]
> >
> > Uli
> >
> > --
> > Sator Laser GmbH
> > Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
> 
> I think it's not that hard to see that it's just a pseudo code

I would have _thought_ it wasn't hard to see that if a person
says he's totally new to the language, and even explicitly says
that the problem could be syntax errors, then he shouldn't
post pseudo code. How in the world is pseudo code going to
allow people to help him fix his syntax?

-- 
David C. Ullrich



More information about the Python-list mailing list