A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-July/127247.html below:

[Python-Dev] Rough idea for adding introspection information for builtins

[Python-Dev] Rough idea for adding introspection information for builtinsLarry Hastings larry at hastings.org
Sun Jul 7 19:20:02 CEST 2013
On 07/07/2013 01:42 PM, Ronald Oussoren wrote:
> On 7 Jul, 2013, at 13:35, Larry Hastings <larry at hastings.org> wrote:
>> On 07/07/2013 07:25 AM, Ronald Oussoren wrote:
>>> Signature objects use a name in angled brackets to indicate that a parameter is positional only, for example "input(<prompt>)". That might be an alternative to adding a "/" in the argument list in pydoc's output.
>>>
>> I wasn't aware that Signature objects currently had any support whatsoever for positional-only parameters.  Yes, in theory they do, but in practice they have never seen one, because positional-only parameters only occur in builtins and Signature objects have no metadata for builtins.  (The very problem Argument Clinic eventually hopes to solve!)
>>
>> Can you cite an example of this, so I may examine it?
> I have a branch of PyObjC that uses this: <https://bitbucket.org/ronaldoussoren/pyobjc-3.0-unstable/overview>. That branch isn't quite stable yet, but does add a __signature__ slot to objc.selector and objc.function (basicly methods of Cocoa classes and automaticly wrapped global functions), both of which only have positional-only arguments. With the patch for pydoc/inspect I mentioned earlier I can then generate somewhat useful documentation for Cocoa classes using pydoc.
>
> A word of warning though: the PyObjC source code isn't the most approachable, the code that generates the Signature object is actually in python (callable_signature in pyobjc-core/Lib/objc/_callable_docstr.py)

Ah.  In other words, you have proposed it yourself in an external 
project.  I thought you were saying this was something Python itself 
already did.

In that case, I think I will stick with Guido's suggested syntax. 
Consider window.border in the curses module: eight positional-only 
parameters, each in its own optional parameter group.  Adding sixteen 
angle-brackets to that already unreadable morass will make it even 
worse.  But with "/" we add only a single extra character, in an 
easy-to-find place (the end).


//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130707/3def6f7c/attachment-0001.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4