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/2015-April/139526.html below:

[Python-Dev] Surely "nullable" is a reasonable name?

[Python-Dev] Surely "nullable" is a reasonable name?Nick Coghlan ncoghlan at gmail.com
Sat Apr 25 06:45:49 CEST 2015
On 25 April 2015 at 14:44, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 22 April 2015 at 03:31, Larry Hastings <larry at hastings.org> wrote:
>>
>> On 04/21/2015 04:50 AM, Tal Einat wrote:
>>
>> As for the default set of accepted types for various convertors, if we
>> could choose any syntax we liked, something like "accept=+{NoneType}"
>> would be much better IMO.
>>
>>
>> In theory Argument Clinic could use any syntax it likes.  In practice, under
>> the covers we tease out one or two bits of non-Python syntax, then run
>> ast.parse over it.  Saved us a lot of work.
>>
>> "s: accept={str,NoneType}" is a legal Python parameter declaration; "s:
>> accept+={NoneType}" is not.  If I could figure out a clean way to hack in
>> support for += I'll support it.  Otherwise you'll be forced to spell it out.
>
> Ellipsis seems potentially useful here to mean "whatever the default
> accepted types are": "s: accept={...,NoneType}"

Ah, I misread Tal's suggestion. Using unary + is an even neater approach.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
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