[Tutor] Defining a new class
Deirdre Saoirse
deirdre@deirdre.net
Mon, 19 Mar 2001 21:39:08 -0800 (PST)
On Mon, 19 Mar 2001, VanL wrote:
> def label(self):
> return self.label
> >>> Me = LinkedList('MyName')
> >>> MyFriend = LinkedList('HisName', Me)
> >>> print Me.label()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: call of non-function (type string)
>
> I'm a little confused about that. I'm calling a function, aren't I?
Well, insofar as you've defined a method AND a variable with the same
name, that would be interpreter dependent. Evidently it parses for the
variable first.
--
_Deirdre NEW Stash-o-Matic: http://fuzzyorange.com http://deirdre.net
"I love deadlines. I like the whooshing sound they make as they fly by."
- Douglas Adams