Beginner Help - class problem or string copy semantics?

cmedcoff at my-dejanews.com cmedcoff at my-dejanews.com
Mon Apr 19 17:47:47 EDT 1999


As will soon be apparent I am totally new to Python. In the code fragment
below I expect to see the output "foobar", but I do not.  Can anyone tell me
why? All the bookstores seem to be out of "Learning Python".  Are they out of
print already or has the initial shipment still not released?

class Test:
    _name = ""
    def __init__(self, name):
        _name = name
    def show(self):
        print self._name


mytest = Test("foobar")
mytest.show()

Regards,
Chuck

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list