class variable declarations...

Lee John Moore leej at dsl.pipex.com
Mon Jun 16 09:15:33 EDT 2003


Is using __init__() to force the setting of various class attributes really not
frowned upon?  Or is there another way of doing this that's considered more
acceptable?

class SpeedTouchComm:
	"Interface with the SpeedTouch router"
	def __init__(self, connect, uid, pwd, rtuid, rtpwd):
		self.connect = connect
		self.uid = uid
		self.pwd = pwd
		self.rtuid = rtuid
		self.rtpwd = rtpwd

It just seems against the law to be creating instances of SpeedTouchComm and
accessing class attributes that aren't even referred to outside the __init__()
function.

My biggest mental block with python seems to be undeclared variables.  A
declaration block alone is handy for reference.  Statically typed languages
have really messed me up.  Is there a therapy group for refugees?  ;-)
-- 
"However far you may travel in this world, you
will still occupy the same volume of space."
                - Traditional Ur-Bororo saying




More information about the Python-list mailing list