[Python-3000] New section for PEP 3124
Phillip J. Eby
pje at telecommunity.com
Wed Jul 25 01:01:06 CEST 2007
At 03:16 PM 7/24/2007 -0700, Guido van Rossum wrote:
>I'm confused why you spend so much time refuting the argument,
The purpose was to capture the arguments on both sides for posterity
as part of the PEP.
> Also, the
>paragraph starting with "As a result, the vast majority of overloads
>can be found adjacent to..." sounds like it isn't a big loss to
>require explicit decoration.
Perhaps these two bits should have been closer together, then:
>On 7/24/07, Phillip J. Eby <pje at telecommunity.com> wrote:
>>The principal reasons to extend the behavior of a
>>function that has *not* been specifically made generic are to:
>>
>>* Add special cases not contemplated by the original function's author,
>> such as support for additional types.
>>
>>* Be notified of an action in order to cause some related operation to
>> be performed, either before the original operation is performed,
>> after it, or both. This can include general-purpose operations like
>> adding logging, timing, or tracing, as well as application-specific
>> behavior.
>>...
>>As a result, the vast majority of overloads can be found adjacent to
>>either the function being overloaded, or to a *newly-defined type for
>>which the overload is adding support*
Emphasis added to the last bit -- you can't add support for a
newly-defined type to a previously-existing function that was not
declared generic, unless arbitrary overloads are allowed.
For example, epydoc and pydoc contain functions that inspect the type
of their arguments in order to decide what to with them. While it's
arguable that in a GF world, the authors *should* have made those
functions overloadable, it isn't reasonable to expect everyone to
rewrite their code to make everything overloadable, nor to correctly
anticipate every function for which extension might be needed.
>As I tried to indicate with my "gut feelings" argument
>this is not something that's up to rational argument.
Of course... but the purpose was to document the experiences upon
which *my* gut feelings are based, since that aspect of the PEP was
not previously dealt with adequately.
In retrospect, the new section is weak mainly because it's phrased as
a defense to a critique, rather than being written as a motivation
for the proposed feature. So much for the attempt at a quick fix. :)
More information about the Python-3000
mailing list