32 lines
897 B
Plaintext
32 lines
897 B
Plaintext
From: cmedcoff at my-dejanews.com (cmedcoff at my-dejanews.com)
|
|
Date: Mon, 19 Apr 1999 21:47:47 GMT
|
|
Subject: Beginner Help - class problem or string copy semantics?
|
|
Message-ID: <7fg8a0$3ib$1@nnrp1.dejanews.com>
|
|
X-UID: 967
|
|
|
|
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
|
|
|
|
|
|
|
|
|