[Python-Dev] A Desperate Plea For Introspection (aka: BDFAP Needed)

Guido van Rossum guido at python.org
Fri Jun 22 20:52:03 CEST 2012


This looks great, much better than the version I reviewed half a year
ago! Thanks you and others (especially Yuri) for all your efforts in
guiding the discussion and implementing as the discussion went along;
also thanks to Nick for participating to intensely.

Quick review notes:

(1) I don't like APIs that require you to use hasattr(), which you use
for return_annotation. Since you have Signature.empty to remove it,
why not set it to Signature.empty when not set? Ditto for other values
that are currently not set when they don't apply (Parameter.empty I
think.)

(2) Could use an example on how to remove and add parameters using replace().

(3) You are using name(arg1, *, arg2) a lot. I think in most cases you
mean for arg2 to be an optional keyword arg, but this notation doesn't
convey that it is optional. Can you clarify?

(4) "If the object is a method" -- shouldn't that be "bound method"?
(Unbound methods are undetectable.) Or is there some wider definition
of method? What does it do for static or class methods?

(5) Too bad there's no proposal for adding signatures to builtin
functions/methods, but understood.

Of these, only (1) is a blocker for PEP acceptance -- I'd either like
to see this defended vigorously (maybe it was discussed? then please
quote, I can't go back and read the threads) or changed.

Otherwise it looks great!

--Guido

On Fri, Jun 22, 2012 at 11:36 AM, Guido van Rossum <guido at python.org> wrote:
> I'll review it right now.
>
> On Fri, Jun 22, 2012 at 11:31 AM, Larry Hastings <larry at hastings.org> wrote:
>>
>>
>> Here's PEP 362:
>>
>> http://www.python.org/dev/peps/pep-0362/
>>
>> It adds easy introspection abilities to Python callables.  After a whirlwind
>> of activity over the past several weeks we think it's ready.
>>
>> All it needs now is an official pronouncement from some seasoned veteran of
>> the Python community.  But that's where it's hit an impasse.  Nick Coghlan
>> has recused himself because he was heavily involved in shaping it.  And
>> obviously the authors (including myself, in a small way) are ineligible.
>> Nobody else has stepped forward.  Yet the feature freeze for 3.3 fast
>> approaches--ominous, unstoppable, like a big round boulder headed straight
>> for Indiana Jones.  Time is running out.
>>
>> If you're BDFAP material, why not spend an enjoyable hour today perusing the
>> fine work of these capable folks?  Then naturally all you'd need do is haul
>> out your rubber stamp.  Mere moments later you'd be on your way, whistling a
>> happy tune, a new spring in your step, knowing in your heart you'd made the
>> world a better place.
>>
>> The reference implementation for CPython trunk is here:
>>
>> https://bitbucket.org/1st1/cpython/changesets/tip/branch(%22pep362%22)
>>
>> And here's the bug tracker issue:
>>
>> http://bugs.python.org/issue15008
>>
>>
>> So shines a good deed in a weary world,
>>
>>
>> /arry
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev at python.org
>> http://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)



-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list