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 class (except presumably >> in the most primitive base-class sense, which is presumably automatic >> and implicit in using the class keyword). > >No it's not :) It is recommended to always use new-style classes, and thus to >give the object base explicitely : > >class serial_link (object) : > ... Can I just confirm: between the parentheses should be the literal 'object' - ie (object) - you're not just using 'object' as a placeholder where there should be a more specific class name or object? -------------- On Thu, 19 Jun 2008 14:21:46 +0200, Ulrich Eckhardt <[EMAIL PROTECTED]> wrote: >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. Sorry - the original code was syntactically correct - I just re-keyed it rather quickly for the original newsgroup post here, rather than copy/paste a larger chunk. I'll try to be more careful with any future posts. >One more thing: you are abusing exceptions. Typically, in such a short >program you only have one try-except pair in the main entry function and >all other code only throws the exceptions. In particular the __init__ >function of a class should always signal errors using exceptions. However, >this is not a strict yes/no question but rather a stylistic one. Thanks - I need to think more clearly about the best way of doing this. JGD -- http://mail.python.org/mailman/listinfo/python-list