[Python-ideas] Optional parameters without default value

M.-A. Lemburg mal at egenix.com
Thu Mar 2 10:04:39 EST 2017


On 02.03.2017 14:08, Serhiy Storchaka wrote:
> On 02.03.17 12:04, M.-A. Lemburg wrote:
>> This is not new syntax, nor is it a keyword. It's only a
>> new singleton and it is well usable outside of function
>> declarations as well, e.g. for class attributes which are
>> not yet initialized (and which can accept None as value).
> 
> If it is not a keyword, it could be used in expressions, e.g. assigned
> to a variable or passed to a function. It could be monkey-patched or
> hidden by accident (as True and False in Python 2).

Yes, sure.

My proposal was just to address the problems of
changing Python syntax and making it possible to define
positional only arguments in Python functions/methods in
a backwards compatible way.

The same could be had by adding a C function proxy to Python
which then takes care of the error handling, since we already
have the logic for C functions via PyArg_ParseTuple*().
A decorator could then apply the proxy as needed or ignore this
for older Python versions without breaking compatibility
(or a PyPI extension could provide the same proxy logic for
older versions).

FWIW: I don't think the use case for positional only arguments
to Python functions is strong enough to warrant breaking
backwards compatibility by introducing new syntax.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, Mar 02 2017)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...           http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
________________________________________________________________________

::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
                      http://www.malemburg.com/



More information about the Python-ideas mailing list