AttributeError - a dumb question
Oleg Broytmann
phd at emerald.netskate.ru
Tue Jul 6 11:45:29 EDT 1999
On Tue, 6 Jul 1999, Johann Spies wrote:
> Why does the following code produce an attribute error?
> class F:
> def __init__(self):
> x = self.Krylys()
This will create local var x. I am pretty sure you wanted to write it
self.x = self.Krylys()
> def KryLys(self):
> l = [1,2,3,4,5]
> return l
>
>
> l = F
You've created reference to the class definition, instead of creating
class instance:
l = F()
> Johann
>
>
> --------------------------------------------------------------------------
> | Johann Spies Windsorlaan 19 |
> | jhspies at futurenet.co.za 3201 Pietermaritzburg |
> | Tel/Faks Nr. +27 331-46-1310 Suid-Afrika (South Africa) |
> --------------------------------------------------------------------------
>
> "Ask, and it shall be given you; seek, and ye shall
> find; knock, and it shall be opened unto you."
> Matthew 7:7
Oleg.
----
Oleg Broytmann Netskate/Inter.Net.Ru phd at emerald.netskate.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-list
mailing list