Why can't I run this test class?

Chris Rebert clp2 at rebertia.com
Fri Sep 11 03:33:10 EDT 2009


On Fri, Sep 11, 2009 at 12:30 AM, Kermit Mei <kermit.mei at gmail.com> wrote:
> Dear all,
>    I'm a newbie for python, and I write a program to test how to
> implement a class:
>> #!/usr/bin/env
> python
>> class Test:
>    'My Test class'
>    def __init__(self):
>        self.arg1 = 1
>>    def first(self):
>        return self.arg1
>> t1 = Test

You missed the parentheses to call the constructor. That line should be:
t1 = Test()
Cheers,
Chris
--
http://blog.rebertia.com


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /