Re: [Python-Dev] Positional-only parameters in Python

2018-01-22 Thread Nick Coghlan
On 20 January 2018 at 15:00, Guido van Rossum  wrote:
> On Fri, Jan 19, 2018 at 8:47 PM, Nick Coghlan  wrote:
>>
>> On 20 January 2018 at 07:49, Mario Corchero  wrote:
>> > I am happy to put some work into this (and Pablo Galindo in CC offered
>> > to
>> > pair on it) but it is not clear for me whether the next step is drafting
>> > a
>> > new PEP or this is just blocked on "re-evaluating" the current one.
>>
>> I think that would be a question for Larry,
>
> I think you meant for Guido. It's not Larry's language (yet :-).

I did mean Larry, but I was unduly vague about the specific question I
was referring to (I wasn't sure if Larry might want to repurpose PEP
457 itself for this proposal).

It sounds like we're going to go with the option of a new PEP though,
crediting Larry with the design, which seems like a good option to me.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-21 Thread Mario Corchero
Ups, indeed, totally missed it. Removed it from
https://github.com/mariocj89/peps/blob/pep-pos-only/pep-.rst

On 21 January 2018 at 21:44, Larry Hastings  wrote:

>
>
> On 01/21/2018 05:59 AM, Mario Corchero wrote:
>
> Credit for making left option groups higher precedence goes to
> Nick Coghlan. (Conversation in person at PyCon US 2013.)
>
>
> Actually Argument Clinic has always given left option groups higher
> precedence.  This theoretically allows Argument Clinic to elegantly support
> the range builtin as "range([start,] stop, [step])", although nobody has
> bothered to actually convert range() to Clinic.  (Which is reasonable--I
> don't think there's any reason to bother.)
>
> Anyway, this acknowledgement is the only mention of "option groups" in the
> document.  Perhaps this was in reference to the now-abandoned idea of
> adding "option groups" to the language?  If so, this acknowledgement should
> probably be removed too.
>
>
> */arry*
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-21 Thread Larry Hastings



On 01/21/2018 05:59 AM, Mario Corchero wrote:

Credit for making left option groups higher precedence goes to
Nick Coghlan. (Conversation in person at PyCon US 2013.)


Actually Argument Clinic has always given left option groups higher 
precedence.  This theoretically allows Argument Clinic to elegantly 
support the range builtin as "range([start,] stop, [step])", although 
nobody has bothered to actually convert range() to Clinic. (Which is 
reasonable--I don't think there's any reason to bother.)


Anyway, this acknowledgement is the only mention of "option groups" in 
the document.  Perhaps this was in reference to the now-abandoned idea 
of adding "option groups" to the language?  If so, this acknowledgement 
should probably be removed too.



//arry/
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-21 Thread Mario Corchero
Thanks, Oleg! Fixed that and a bunch more typos in the GitHub document.

https://github.com/mariocj89/peps/blob/pep-pos-only/pep-.rst

On 21 January 2018 at 14:16, Oleg Broytman  wrote:

> Hi! A few minor corrections below.
>
> On Sun, Jan 21, 2018 at 01:59:49PM +, Mario Corchero <
> marioc...@gmail.com> wrote:
> > Author: Larry Hastings , Pablo Galindo
> > , Mario Corchero  
>  ^
> Add a space or a few here - this is the way for line wrapping in long
> headers.
>
> > introduces an asymetry on how parameter behavior is declared. Also, as
> the `\`
>
>\ -> /
>
> Oleg.
> --
>  Oleg Broytmanhttp://phdru.name/p...@phdru.name
>Programmers don't die, they just GOSUB without RETURN.
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> mariocj89%40gmail.com
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-21 Thread Oleg Broytman
Hi! A few minor corrections below.

On Sun, Jan 21, 2018 at 01:59:49PM +, Mario Corchero  
wrote:
> Author: Larry Hastings , Pablo Galindo
> , Mario Corchero  
 ^
Add a space or a few here - this is the way for line wrapping in long
headers.

> introduces an asymetry on how parameter behavior is declared. Also, as the `\`

   \ -> /

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-21 Thread Mario Corchero
Here is the proposal we have worked on (Pablo and I).

I've added Larry as co-author given that a good chunk of the content and
the idea comes from his PEP. Larry, if you don't want to appear as such
please let us know.

Thanks!

Rendered content:
https://github.com/mariocj89/peps/blob/pep-pos-only/pep-.rst


PEP: 
Title: Python Positional-Only Parameters
Version: $Revision$
Last-Modified: $Date$
Author: Larry Hastings , Pablo Galindo
, Mario Corchero  
Discussions-To: Python-Dev 
Status:
Type:
Content-Type: text/x-rst
Created: 20-Jan-2018



Overview


This PEP proposes a syntax for positional-only parameters in Python.
Positional-only parameters are parameters without an externally-usable
name; when a function accepting positional-only parameters is called,
positional arguments are mapped to these parameters based solely on
their position.

=
Rationale
=

Python has always supported positional-only parameters.
Early versions of Python lacked the concept of specifying
parameters by name, so naturally all parameters were
positional-only.  This changed around Python 1.0, when
all parameters suddenly became positional-or-keyword.
This allowed users to provide arguments to a function both
positionally or referencing the keyword used at the definition
of it. But, this is not always desired nor even available as
even in current versions of Python, many CPython
"builtin" functions still only accept positional-only arguments.

Even if positional arguments only in a function can be achieved
via using``*args`` parameters and extracting them one by one,
the solution is far from ideal and not as expressive as the one
proposed in this PEP, which targets to provide syntax to specify
accepting a specific number of positional-only parameters.
Additionally, this will bridge the gap we currently find between
builtin functions that today allows to specify positional-only
parameters and pure Python implementations that lack the
syntax for it.

-
Positional-Only Parameter Semantics In Current Python
-

There are many, many examples of builtins that only
accept positional-only parameters.  The resulting
semantics are easily experienced by the Python
programmer--just try calling one, specifying its
arguments by name::


>>> help(pow)
...
pow(x, y, z=None, /)
...
>>> pow(x=5, y=3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: pow() takes no keyword arguments

Pow clearly expresses that its arguments are only positional
via the `/` marker, but this is at the moment only documentational,
Python developers cannot wright such syntax.

In addition, there are some functions with particularly
interesting semantics:

* ``range()``, which accepts an optional parameter
  to the *left* of its required parameter. [#RANGE]_

* ``dict()``, whose mapping/iterator parameter is optional and
  semantically must be positional-only.  Any externally
  visible name for this parameter would occlude
  that name going into the ``**kwarg`` keyword variadic
  parameter dict! [#DICT]_

Obviously one can simulate any of these in pure Python code
by accepting ``(*args, **kwargs)`` and parsing the arguments
by hand.  But this results in a disconnect between the
Python function signature and what it actually accepts,
not to mention the work of implementing said argument parsing.

==
Motivation
==

The new syntax will allow developers to further control how their
api can be consumed. It will allow to restrict the usage of keyword
Specify arguments by adding the new type of positional-only ones.

A similar PEP with a broader scope (PEP 457) was proposed
to define the syntax. This PEP builds on top of part of it
to define and provide an implementation for the ``/`` syntax on
function signatures.

=
The Current State Of Documentation For Positional-Only Parameters
=

The documentation for positional-only parameters is incomplete
and inconsistent:

* Some functions denote optional groups of positional-only arguments
  by enclosing them in nested square brackets. [#BORDER]_

* Some functions denote optional groups of positional-only arguments
  by presenting multiple prototypes with varying numbers of
  arguments. [#SENDFILE]_

* Some functions use *both* of the above approaches. [#RANGE]_ [#ADDCH]_

One more important idea to consider: currently in the documentation
there's no way to tell whether a function takes positional-only
parameters.  ``open()`` accepts keyword arguments, ``ord()`` does
not, but there is no way of telling just by reading the
documentation that this is true.


Syntax And Semantics



Re: [Python-Dev] Positional-only parameters in Python

2018-01-20 Thread Guido van Rossum
On Sat, Jan 20, 2018 at 1:25 AM, Mario Corchero  wrote:

> OK, if no one has anything against, Pablo and I can start a PEP just for
> the ‘/‘ simple syntax (without the argument group part).
>

Go for it!

Note that your target will be Python 3.8.

-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-20 Thread Mario Corchero
OK, if no one has anything against, Pablo and I can start a PEP just for
the ‘/‘ simple syntax (without the argument group part).

On Sat, 20 Jan 2018 at 07:17, Larry Hastings  wrote:

>
>
> On 01/19/2018 08:47 PM, Nick Coghlan wrote:
>
> - proposing the full PEP 547, including the "argument groups" feature
> (which is a bigger change, but allows the expression of signatures
> like "range([start,] stop, [step,] /)")
>
>
> I hope we don't go down that route.
>
> I added support for "argument groups" to Argument Clinic in an attempt to
> support legacy functions with crazy argument signatures that count their
> arguments.  (For example, curses.window.overlay() takes either one or seven
> arguments exactly--not two!, and not six!.)  I have deeply mixed feelings
> about the result, and I would hate to see support for it added to the
> language.  If I had my way I'd rewrite or replace those functions and have
> only modern Pythonic signatures in the standard library.
>
>
> */arry*
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Larry Hastings



On 01/19/2018 08:47 PM, Nick Coghlan wrote:

- proposing the full PEP 547, including the "argument groups" feature
(which is a bigger change, but allows the expression of signatures
like "range([start,] stop, [step,] /)")


I hope we don't go down that route.

I added support for "argument groups" to Argument Clinic in an attempt 
to support legacy functions with crazy argument signatures that count 
their arguments.  (For example, curses.window.overlay() takes either one 
or seven arguments exactly--not two!, and not six!.)  I have deeply 
mixed feelings about the result, and I would hate to see support for it 
added to the language.  If I had my way I'd rewrite or replace those 
functions and have only modern Pythonic signatures in the standard library.



//arry/
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Guido van Rossum
On Fri, Jan 19, 2018 at 8:47 PM, Nick Coghlan  wrote:

> On 20 January 2018 at 07:49, Mario Corchero  wrote:
> > I am happy to put some work into this (and Pablo Galindo in CC offered to
> > pair on it) but it is not clear for me whether the next step is drafting
> a
> > new PEP or this is just blocked on "re-evaluating" the current one.
>
> I think that would be a question for Larry,
>

I think you meant for Guido. It's not Larry's language (yet :-).


> since there are two main options here:
>
> - proposing just the "/" part of PEP 457 (which allows positional-only
> arguments, but doesn't allow the expression of all builtin and
> standard library signatures)
> - proposing the full PEP 547,
>

I assume you meant PEP 457 again. :-)


> including the "argument groups" feature
> (which is a bigger change, but allows the expression of signatures
> like "range([start,] stop, [step,] /)")
>
> One key benefit I'd see to a new subset-of-457 PEP is that it would
> allow a decision to be made on the basic "/" proposal without deciding
> one way or the other on whether or not to provide a native way to
> express signatures like the one for range().


I personally don't think such signatures are common enough to warrant
special syntax, and I don't want to encourage them. The few we have
(basically range(), slice() and a few functions in the curses module) don't
inspire a lot of copy-cat APIs.

OTOH the more plain positional-only arguments are a pretty common need --
for example, for methods that are conventionally used that way, and
overridden with disregard for argument names.

(IOW I agree with you here. ;-)

-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Nick Coghlan
On 20 January 2018 at 07:49, Mario Corchero  wrote:
> I am happy to put some work into this (and Pablo Galindo in CC offered to
> pair on it) but it is not clear for me whether the next step is drafting a
> new PEP or this is just blocked on "re-evaluating" the current one.

I think that would be a question for Larry, since there are two main
options here:

- proposing just the "/" part of PEP 457 (which allows positional-only
arguments, but doesn't allow the expression of all builtin and
standard library signatures)
- proposing the full PEP 547, including the "argument groups" feature
(which is a bigger change, but allows the expression of signatures
like "range([start,] stop, [step,] /)")

One key benefit I'd see to a new subset-of-457 PEP is that it would
allow a decision to be made on the basic "/" proposal without deciding
one way or the other on whether or not to provide a native way to
express signatures like the one for range().

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Guido van Rossum
Not so fast. I think a PEP is still needed. This change has more
repercussions than argument clinic, e.g. it affects 3rd party tooling and
bytecode.

On Jan 19, 2018 17:00, "Terry Reedy"  wrote:

> On 1/19/2018 4:49 PM, Mario Corchero wrote:
>
>> I am happy to put some work into this (and Pablo Galindo in CC offered to
>> pair on it) but it is not clear for me whether the next step is drafting a
>> new PEP or this is just blocked on "re-evaluating" the current one.
>>
>> If someone can clarify we can put something together.
>>
>
> My understanding is that extending the current use of '/' has already been
> approved in principle. I personally think that this just needs an issue, if
> there is not one already, and a PR.  I think we need that, or the effort to
> produce one, to reveal any remaining issues.
>
> --
> Terry Jan Reedy
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%
> 40python.org
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Terry Reedy

On 1/19/2018 4:49 PM, Mario Corchero wrote:
I am happy to put some work into this (and Pablo Galindo in CC offered 
to pair on it) but it is not clear for me whether the next step is 
drafting a new PEP or this is just blocked on "re-evaluating" the 
current one.


If someone can clarify we can put something together.


My understanding is that extending the current use of '/' has already 
been approved in principle. I personally think that this just needs an 
issue, if there is not one already, and a PR.  I think we need that, or 
the effort to produce one, to reveal any remaining issues.


--
Terry Jan Reedy

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-19 Thread Mario Corchero
I am happy to put some work into this (and Pablo Galindo in CC offered to
pair on it) but it is not clear for me whether the next step is drafting a
new PEP or this is just blocked on "re-evaluating" the current one.

If someone can clarify we can put something together.

Thanks!

On 18 January 2018 at 14:40, Nick Coghlan  wrote:

> On 18 January 2018 at 19:26, Larry Hastings  wrote:
> > Would we be adding yet a third argument-parsing function,
> > PyArg_ParseTupleAndKeywordsWithPositionalOnly()?
>
> Checking the docs, it turns out PyArg_ParseTupleAndKeywords already
> gained positional-only argument support in 3.6 by way of empty strings
> in the keyword array.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> mariocj89%40gmail.com
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-18 Thread Nick Coghlan
On 18 January 2018 at 19:26, Larry Hastings  wrote:
> Would we be adding yet a third argument-parsing function,
> PyArg_ParseTupleAndKeywordsWithPositionalOnly()?

Checking the docs, it turns out PyArg_ParseTupleAndKeywords already
gained positional-only argument support in 3.6 by way of empty strings
in the keyword array.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-18 Thread Victor Stinner
2018-01-18 10:26 GMT+01:00 Larry Hastings :
> Why did Argument Clinic choose that syntax?  It was suggested by one Guido
> van Rossum in March 2012: (...)
> I'm not wading into the debate over what syntax Python should use if it adds
> positional-only parameters, except to say that I think "/" is reasonable.
> If Python winds up using a different syntax, I'd look into modifying
> Argument Clinic so that it accepts both this hypothetical new syntax and the
> existing syntax using "/".

The "/" syntax is used since Python 3.5, at least in some function docstrings:
---
$ python3.5
Python 3.5.4+ (heads/3.5:fd8614c5c5, Dec 18 2017, 12:53:10)
>>> help(abs)
Help on built-in function abs in module builtins:

abs(x, /)
Return the absolute value of the argument.
---

inspect.signature() is able to parse this syntax, but currently, it is
only used to parse __text_signature__ attribute of builtin functions.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-18 Thread Larry Hastings



On 01/17/2018 08:29 AM, Ethan Furman wrote:

On 01/17/2018 08:14 AM, Serhiy Storchaka wrote:

17.01.18 16:34, Victor Stinner пише:

In Februrary 2017, I proposed on python-ideas to change the Python
syntax to allow to declare positional-only parameters in Python:

https://mail.python.org/pipermail/python-ideas/2017-February/044879.html 


https://mail.python.org/pipermail/python-ideas/2017-March/044956.html


The main problem -- designing a syntax that does not look ugly.


The syntax question is already solved:

   def some_func(a, b, /, this, that, *, the_other):
   # some stuff

Everything before the slash is positional-only, between the slash and 
star is positional-or-keyword, and after the star is keyword-only.  
This is what is in our generated help(), and there is a nice symmetry 
between '/' and '*' being opposites, and positional/keyword being 
opposites.  And slash is certainly no uglier than star.  ;)


To clarify: this is the syntax used by "Argument Clinic", both as its 
input language, and as part of its output, exposed via the 
__text_signature__ attribute on builtins.


Why did Argument Clinic choose that syntax?  It was suggested by one 
Guido van Rossum in March 2012:


   https://mail.python.org/pipermail/python-ideas/2012-March/014364.html
   https://mail.python.org/pipermail/python-ideas/2012-March/014378.html
   https://mail.python.org/pipermail/python-ideas/2012-March/014417.html


I'm not wading into the debate over what syntax Python should use if it 
adds positional-only parameters, except to say that I think "/" is 
reasonable.  If Python winds up using a different syntax, I'd look into 
modifying Argument Clinic so that it accepts both this hypothetical new 
syntax and the existing syntax using "/".




Would we be adding yet a third argument-parsing function, 
PyArg_ParseTupleAndKeywordsWithPositionalOnly()?  I would actually 
propose a different approach: modify Argument Clinic so it generates 
custom argument-parsing code for each function, adding a new call type 
(which I propose calling "METH_RAW" or "METH_STACK") where the stack is 
passed in directly.  I spent some time on this in the past, though I got 
distracted and now haven't touched it in years.




Cheers,


//arry/
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Nick Coghlan
On 18 January 2018 at 03:16, Sanyam Khurana  wrote:
> On Wed, Jan 17, 2018 at 8:04 PM, Victor Stinner
>  wrote:
>> It seems like a PEP is needed.
>
> I followed the threads mentioned above, which led me to PEP 457:
> https://www.python.org/dev/peps/pep-0457/
>
> I didn't find a clear indication if it was still to be modified,
> approved or rejected. Can anyone help?

Effectively deferred, since Guido decided we didn't need a PEP for the
__text_signature__ syntax in the inspect module:

>>> import inspect
>>> inspect.signature(ord)

>>> ord.__text_signature__
'($module, c, /)'

(The motivation was to give Argument Clinic a way to communicate C
level signatures up to Python code)

A PEP for Python level positional-only argument syntax would be able
to rely on Signature.__repr__ and __text_signature__ as precedent for
using "/" to indicate that the preceding parameters are
positional-only, though.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Sanyam Khurana
Hi,

On Wed, Jan 17, 2018 at 8:04 PM, Victor Stinner
 wrote:
> Hi,
>
> In Februrary 2017, I proposed on python-ideas to change the Python
> syntax to allow to declare positional-only parameters in Python:
>
> https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
> https://mail.python.org/pipermail/python-ideas/2017-March/044956.html
>
> There are already supported at the C level, but not at the Python level.
>
> Our BDFL approved the idea:
>
> https://mail.python.org/pipermail/python-ideas/2017-March/044959.html
>
> But I didn't find time to implement it. Does someone want to work on
> an implementation of the idea?
>
> March 2, 2017 7:16 PM, "Brett Cannon"  wrote:
>> It seems all the core devs who have commented on this are in the positive
>> (Victor, Yury, Ethan, Yury, Guido, Terry, and Steven; MAL didn't explicitly
>> vote). So to me that suggests there's enough support to warrant writing a
>> PEP. Are you up for writing it, Victor, or is someone else going to write
>> it?
>
> It seems like a PEP is needed.

I followed the threads mentioned above, which led me to PEP 457:
https://www.python.org/dev/peps/pep-0457/

I didn't find a clear indication if it was still to be modified,
approved or rejected. Can anyone help?

Also, on a second note, I can help with writing a PEP (would prefer
co-authoring with someone ), but this would be my first time and
I would really appreciate guidance of core-developers.


-- 
Mozilla Rep
http://www.SanyamKhurana.com
Github: CuriousLearner
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Guido van Rossum
Let's aim for 3.8 here. We're already cramming in a lot of stuff for the
feature freeze.

On Wed, Jan 17, 2018 at 8:52 AM, Barry Warsaw  wrote:

> On Jan 17, 2018, at 08:14, Serhiy Storchaka  wrote:
> >
> > The main problem -- designing a syntax that does not look ugly. I think
> there are too small time is left before features freezing for experimenting
> with it. It would be better to make such changes at the early stage of
> development.
>
> A PEP is definitely needed.  Can someone get a PEP written, approved, with
> the feature implemented in 12 days?  As much as I like the idea, I think
> it’s unlikely.  But hey, you never know so if someone is really motivated,
> go for it!  The effort won’t be wasted in any case, since 3.8’s right
> around the corner .
>
> -Barry
>
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>
>


-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Barry Warsaw
On Jan 17, 2018, at 08:14, Serhiy Storchaka  wrote:
> 
> The main problem -- designing a syntax that does not look ugly. I think there 
> are too small time is left before features freezing for experimenting with 
> it. It would be better to make such changes at the early stage of development.

A PEP is definitely needed.  Can someone get a PEP written, approved, with the 
feature implemented in 12 days?  As much as I like the idea, I think it’s 
unlikely.  But hey, you never know so if someone is really motivated, go for 
it!  The effort won’t be wasted in any case, since 3.8’s right around the 
corner .

-Barry



signature.asc
Description: Message signed with OpenPGP
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Oleg Broytman
On Wed, Jan 17, 2018 at 08:29:16AM -0800, Ethan Furman  
wrote:
>def some_func(a, b, /, this, that, *, the_other):
># some stuff
> 
> Everything before the slash is positional-only, between the slash and star
> is positional-or-keyword, and after the star is keyword-only.

   Is there syntax to combine

def some_func(a, b, /, *, the_other):

   ??? May be

def some_func(a, b, /*, the_other):

   ???

> And slash is
> certainly no uglier than star.  ;)

   I tend to agree. Both are absolutely but equally ugly. :-(

> --
> ~Ethan~

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Ethan Furman

On 01/17/2018 08:14 AM, Serhiy Storchaka wrote:

17.01.18 16:34, Victor Stinner пише:

In Februrary 2017, I proposed on python-ideas to change the Python
syntax to allow to declare positional-only parameters in Python:

https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
https://mail.python.org/pipermail/python-ideas/2017-March/044956.html


The main problem -- designing a syntax that does not look ugly. I

> think there are too small time is left before features freezing for
> experimenting with it. It would be better to make such changes at the
> early stage of development.

The syntax question is already solved:

   def some_func(a, b, /, this, that, *, the_other):
   # some stuff

Everything before the slash is positional-only, between the slash and star is positional-or-keyword, and after the star 
is keyword-only.  This is what is in our generated help(), and there is a nice symmetry between '/' and '*' being 
opposites, and positional/keyword being opposites.  And slash is certainly no uglier than star.  ;)


--
~Ethan~
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Serhiy Storchaka

17.01.18 16:34, Victor Stinner пише:

In Februrary 2017, I proposed on python-ideas to change the Python
syntax to allow to declare positional-only parameters in Python:

https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
https://mail.python.org/pipermail/python-ideas/2017-March/044956.html

There are already supported at the C level, but not at the Python level.

Our BDFL approved the idea:

https://mail.python.org/pipermail/python-ideas/2017-March/044959.html

But I didn't find time to implement it. Does someone want to work on
an implementation of the idea?


The main problem -- designing a syntax that does not look ugly. I think 
there are too small time is left before features freezing for 
experimenting with it. It would be better to make such changes at the 
early stage of development.


___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Mario Corchero
Hi Victor,

I'd like to work on it if you accept "a random person" to work on it
(saying it in case the mail was directed to core developers).

Regards,
Mario

On 17 January 2018 at 14:34, Victor Stinner 
wrote:

> Hi,
>
> In Februrary 2017, I proposed on python-ideas to change the Python
> syntax to allow to declare positional-only parameters in Python:
>
> https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
> https://mail.python.org/pipermail/python-ideas/2017-March/044956.html
>
> There are already supported at the C level, but not at the Python level.
>
> Our BDFL approved the idea:
>
> https://mail.python.org/pipermail/python-ideas/2017-March/044959.html
>
> But I didn't find time to implement it. Does someone want to work on
> an implementation of the idea?
>
> March 2, 2017 7:16 PM, "Brett Cannon"  wrote:
> > It seems all the core devs who have commented on this are in the positive
> > (Victor, Yury, Ethan, Yury, Guido, Terry, and Steven; MAL didn't
> explicitly
> > vote). So to me that suggests there's enough support to warrant writing a
> > PEP. Are you up for writing it, Victor, or is someone else going to write
> > it?
>
> It seems like a PEP is needed.
>
> Victor
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> mariocj89%40gmail.com
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Positional-only parameters in Python

2018-01-17 Thread Victor Stinner
Hi,

In Februrary 2017, I proposed on python-ideas to change the Python
syntax to allow to declare positional-only parameters in Python:

https://mail.python.org/pipermail/python-ideas/2017-February/044879.html
https://mail.python.org/pipermail/python-ideas/2017-March/044956.html

There are already supported at the C level, but not at the Python level.

Our BDFL approved the idea:

https://mail.python.org/pipermail/python-ideas/2017-March/044959.html

But I didn't find time to implement it. Does someone want to work on
an implementation of the idea?

March 2, 2017 7:16 PM, "Brett Cannon"  wrote:
> It seems all the core devs who have commented on this are in the positive
> (Victor, Yury, Ethan, Yury, Guido, Terry, and Steven; MAL didn't explicitly
> vote). So to me that suggests there's enough support to warrant writing a
> PEP. Are you up for writing it, Victor, or is someone else going to write
> it?

It seems like a PEP is needed.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com