[Tutor] Need help on a simple problem (i think)
Kalle Svensson
kalle@gnupung.net
Thu, 12 Apr 2001 00:06:45 +0200
Sez Marcus Konermann:
[snip problem description, basically a NameError]
> class operation(identification):
>
> def __init__(self,srchfiles,pattfile,splitfile):
> identification.__init__(self,srchfiles,pattfile,splitfile)
>
> def test(self):
> print'it is ok'
The problem seems to be here. test() is defined as a method of the class
operation, but you try to call it as a function.
Either move the test() function out of the class, or create a class instance
in mainko.py:
op = operation("f","g","h")
print op.test()
Also note that "from xxx import *" is generally considered bad practice.
A little more obvious indentation, four or eight spaces, wouldn't hurt
either, IMHO.
Peace,
Kalle
--
Email: kalle@gnupung.net | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
[ Not signed due to lossage. Blame Microsoft Outlook Express. ]