[Python-3000] pep 3124 plans
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Jul 24 01:58:10 CEST 2007
Phillip J. Eby wrote:
> In order to follow things through with normal method calls, you have to
> know where a class is in the program, implying that you either search
> for it, or have read enough of the program to figure it out.
>
> Which of these two things is different with generic functions?
A class is defined in just one place, or a limited number
of places if it has base classes.
It also provides a convenient mental chunk under which to
group all the operations that it implements. With GFs, there
is no such obvious mental grouping.
> if you're going to be
> grepping for 'foo', it doesn't matter whether it's a method name or a
> generic function name -- you're still going to find all the definitions.
No, you're going to find every function whose name is 'foo',
whether it's a method of the particular GF you have in mind
or not. A considerably smarter tool than grep would be needed.
> Since they make my world simpler,
Are you talking about code that you've written yourself here,
or do you find they make code written by others easier to
understand as well?
I'd have to disagree with such a blanket statement.
> Grep (or whatever global search tool your
> editor provides) is your friend. It ain't perfect, but it's just as
> much required (and equally imperfect) for global analysis of a
> traditionally-OO program.
Most of the time I find that I don't need to perform global
analysis of a traditionally-OO paradigm. The conceptual
encapsulation provided by classes makes that unnecessary.
GF breaks that encapsulation, or at least to my mind it
seems to, and that makes me uncomfortable.
--
Greg
More information about the Python-3000
mailing list