[Python-Dev] signature object issues (to discuss while I am out of contact)

Aahz aahz at pythoncraft.com
Mon May 1 21:25:27 CEST 2006


On Mon, May 01, 2006, Brett Cannon wrote:
>
> But there are two things that I can't quite decide upon.
>
> One is whether a signature object should be automatically created
> for every function.  As of right now the PEP I am drafting has it
> on a per-need basis and have it assigned to __signature__ through
> a built-in function or putting it 'inspect'.  Now automatically
> creating the object would possibly make it more useful, but it
> could also be considered overkill.  Also not doing it automatically
> allows signature objects to possibly make more sense for classes (to
> represent __init__) and instances (to represent __call__).  But having
> that same support automatically feels off for some reason to me.

My take is that we should do it automatically and provide a helper
function that does additional work.  The class case is already
complicated by __new__(); we probably don't want to automatically sort
out __init__() vs __new__(), but I think we do want regular functions and
methods to automatically have a __signature__ attribute.  Aside from the
issue with classes, are there any other drawbacks to automatically
creating __signature__?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Argue for your limitations, and sure enough they're yours."  --Richard Bach


More information about the Python-Dev mailing list