Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-10 Thread Guido van Rossum
On Wed, Feb 10, 2016 at 10:01 AM, Phil Thompson wrote: > On 10 Feb 2016, at 5:52 pm, Guido van Rossum wrote: [...] > That should do it, thanks. A followup question... > > Is... > > def foo(bar: str = Optional[str]) > > ...valid? In other words, bar can be omitted, but if specified must be a s

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-10 Thread Phil Thompson
On 10 Feb 2016, at 5:52 pm, Guido van Rossum wrote: > > On Wed, Feb 10, 2016 at 1:11 AM, Phil Thompson > wrote: >> I understand now. The documentation, as it stands, is correct and consistent >> but (to me) the meaning of Optional is completely counter-intuitive. What >> you suggest with str =

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-10 Thread Guido van Rossum
On Wed, Feb 10, 2016 at 1:11 AM, Phil Thompson wrote: > I understand now. The documentation, as it stands, is correct and consistent > but (to me) the meaning of Optional is completely counter-intuitive. What you > suggest with str = ... is exactly what I need. Adding a section to the docs > de

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-10 Thread Nick Coghlan
On 10 February 2016 at 06:54, Guido van Rossum wrote: > [Just adding to Andrew's response] > > On Tue, Feb 9, 2016 at 9:58 AM, Andrew Barnert via Python-Dev > wrote: >> On Feb 9, 2016, at 03:44, Phil Thompson wrote: >>> >>> There are a number of things I'd like to express but cannot find a way t

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-10 Thread Phil Thompson
> On 9 Feb 2016, at 11:48 pm, Guido van Rossum wrote: > > [Phil] I found the documentation confusing regarding Optional. Intuitively it seems to be the way to specify arguments with default values. However it is explained in terms of (for example) Union[str, None] and I (intuiti

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-09 Thread Ethan Furman
On 02/09/2016 03:48 PM, Guido van Rossum wrote: > (Assuming you meant Option*al*.) There seems to be an utter confusion > of the two uses of the term "optional" here. An "optional argument" > (outside PEP 484) is one that has a default value. The "Optional[T]" > notation in PEP 484 means "Union[T

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-09 Thread Guido van Rossum
[Phil] >>> I found the documentation confusing regarding Optional. Intuitively it >>> seems to be the way to specify arguments with default values. However it is >>> explained in terms of (for example) Union[str, None] and I (intuitively but >>> incorrectly) read that as meaning "a str or None"

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-09 Thread Phil Thompson
On 9 Feb 2016, at 8:54 pm, Guido van Rossum wrote: > > [Just adding to Andrew's response] > > On Tue, Feb 9, 2016 at 9:58 AM, Andrew Barnert via Python-Dev > wrote: >> On Feb 9, 2016, at 03:44, Phil Thompson wrote: >>> >>> There are a number of things I'd like to express but cannot find a way

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-09 Thread Guido van Rossum
[Just adding to Andrew's response] On Tue, Feb 9, 2016 at 9:58 AM, Andrew Barnert via Python-Dev wrote: > On Feb 9, 2016, at 03:44, Phil Thompson wrote: >> >> There are a number of things I'd like to express but cannot find a way to do >> so... >> >> - objects that implement the buffer protocol

Re: [Python-Dev] Experiences with Creating PEP 484 Stub Files

2016-02-09 Thread Andrew Barnert via Python-Dev
On Feb 9, 2016, at 03:44, Phil Thompson wrote: > > There are a number of things I'd like to express but cannot find a way to do > so... > > - objects that implement the buffer protocol That seems like it should be filed as a bug with the typing repo. Presumably this is just an empty type that