[Tutor] Classes Turn Strings Into Tuples for some reason

Gooch, John John.Gooch at echostar.com
Wed Oct 27 01:10:31 CEST 2004


With the class below:


#Define Classes 
class Record:
    def __init__(self, name ):
        self.name = name,
        self.lastlogon = ''
        self.ipaddress = "0"
        self.uptime = 0
        self.type = 0
        self.location = "0"
    def printName(self):
        return self.name
    def getName(self):
        print self.name
        return self.name
#End Class Record         


If I create an instance of the class like so -
	joe = Record( "joe") 
and then 
	print joe.name
	or
	pring joe.getName()
Instead of printing just the name, it prints 
	( 'joe', )

I have been reading up on functions and classes, and haven't found any
information to explain this behavior. I 
want the value to be a scalar string, and not a tuple. 


Any ideas? 








John A. Gooch
Systems Administrator
IT - Tools
EchoStar Satellite L.L.C.
9601 S. Meridian Blvd.
Englewood, CO  80112
Desk: 720-514-5708 


More information about the Tutor mailing list