[Tutor] "Overloading" methods
michael at trollope.org
Thu Sep 16 14:02:18 CEST 2010
Strictly speaking, this isn't overloading a method in the way we do it
in Java. But similar. Maybe.
I am writing a module for processing web server log files and one of
the methods I provide is to extract a given query parameter and its
value. Because there are several types of log files with different
line structures, I had the thought to write methods with descriptive
names that simply returned a generic method that processed the method
def setpattern_iis(self,pattern,parameter) :
In this case, creating a regular expression to parse the log lines for
a query parameter.
This is just a bit more "self documenting" than using the generic
method with the 'type' argument and requiring the user to enter the
type. At the same time, it allows me to put all the parsing code in
My question is, is this a bad thing to do in python?
Michael Powe michael at trollope.org Naugatuck CT USA
War is a sociological safety valve that cleverly diverts popular
hatred for the ruling classes into a happy occasion to mutilate or
kill foreign enemies. - Ernest Becker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the Tutor