[Tutor] why "self" in methods? [compile-time vs run-time /pychecker]

Alan Gauld alan.gauld at blueyonder.co.uk
Mon Apr 5 19:36:45 EDT 2004


> one reason why Python doesn't report an error for noSelf() outright
is
> because it's not looking for parameter misuse at 'definition', or
> 'compile' time.
>

Good point Danny, I'd forgotten that feature. It makes Python
quite consistent after all. In combination with the staticmethod()
stuff Marlyn mentioned it all makes pefect sense - as usual! :-)

My holiday was obviously more relaxing than I thought!

> are tools that will try to infer buggy usage.  PyChecker, in
particular,
> is a code-checking utility that detects these sort of problems:
>
> [dyoo at tesuque dyoo]$ pychecker foo.py
> Processing foo...
>
> Warnings...
>
> foo.py:4: No method arguments, should have self as argument
> ###
>
>
> PyChecker can be found here:
>
>     http://pychecker.sourceforge.net/
>

And thanks for the reminder here too, I meant to check out
pychecker once before and never got round to it...

Alan G.




More information about the Tutor mailing list