class variable declarations...

Aahz aahz at pythoncraft.com
Mon Jun 16 12:39:45 EDT 2003


[You'll need a fixed-width font for this]

In article <3EEDD08E.C973E017 at hotmail.com>,
Alan Kennedy  <alanmk at hotmail.com> wrote:
>
>How about this, using new style classes:-
>
>class SpeedTouchComm(object):
>    "Interface with the SpeedTouch router"
>    
>    __slots__ = ['connect', 'uid', 'pwd', 'rtuid', 'rtpwd']

 ____   ___  _   _ _ _____   ____   ___    _____ _   _    _  _____
|  _ \ / _ \| \ | ( )_   _| |  _ \ / _ \  |_   _| | | |  / \|_   _|
| | | | | | |  \| |/  | |   | | | | | | |   | | | |_| | / _ \ | |
| |_| | |_| | |\  |   | |   | |_| | |_| |   | | |  _  |/ ___ \| |
|____/ \___/|_| \_|   |_|   |____/ \___/    |_| |_| |_/_/   \_\_|

__slots__ are strictly an optimization technique; you *will* have
problems with subclasses of SpeedTouchComm unless you're *very* careful.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra




More information about the Python-list mailing list