[IronPython] avoiding using the keyword 'self'
fuzzyman at voidspace.org.uk
Sat Aug 4 13:30:04 CEST 2007
> I have a python class which inherits from some other (c#) class. Something
> from MyNamespace import MyClass
> class PyClass(MyClass)
> def myMethod(self)
> return self.PropertyFormInheritedClass
You appear to have a syntax error here (which may be the answer to your
previous question about why your inheritance doesn't work).
The class declaration must be terminated with a colon:
> I don't understand why I have to write the "self." prefix - the context is
> the inherited class. Is there a way to avoid this prefix?
Please read the Python FAQ about self (Python is not C#).
'Why must 'self' be used explicitly in method definitions and calls?'
More information about the Ironpython-users