Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-25 Thread Laura Creighton
All these overloads makes the code hard to read. The whole idea of 'i have to know which decorator got called before the other one' is a smell that you have too many decorators. This whole idea reeks 'i can be very, very clever here'. Laura ___ Python-

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-25 Thread Guido van Rossum
I've thought this over and I don't think it's worth it. We need to wait for a working proposal for multi-dispatch first. Otherwise we'll just end up having to support this interim syntax *and* whatever the new multi-dispatch is. Keeping @overload restricted to stub files makes it much more tractabl

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-25 Thread Guido van Rossum
On Fri, Oct 23, 2015 at 8:38 AM, Nick Coghlan wrote: > On 22 October 2015 at 19:51, Guido van Rossum wrote: > > On Thu, Oct 22, 2015 at 2:21 AM, Gregory P. Smith > wrote: > >> What would it Foo.__getitem__.__annotations__ contain in this situation? > >> It'd unfortunately be an empty dict if im

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-25 Thread Nick Coghlan
On 22 October 2015 at 19:51, Guido van Rossum wrote: > On Thu, Oct 22, 2015 at 2:21 AM, Gregory P. Smith wrote: >> What would it Foo.__getitem__.__annotations__ contain in this situation? >> It'd unfortunately be an empty dict if implemented in the most trivial >> fashion rather than a dict conta

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-22 Thread Guido van Rossum
On Thu, Oct 22, 2015 at 2:21 AM, Gregory P. Smith wrote: > > > On Wed, Oct 21, 2015 at 6:51 PM Guido van Rossum wrote: > >> Well the whole point is not to have to figure out how to implement that >> right now. >> >> On Wed, Oct 21, 2015 at 6:45 PM, Random832 >> wrote: >> >>> Guido van Rossum w

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-22 Thread Paul Moore
On 22 October 2015 at 10:21, Gregory P. Smith wrote: > On Wed, Oct 21, 2015 at 6:51 PM Guido van Rossum wrote: >> >> Well the whole point is not to have to figure out how to implement that >> right now. >> >> On Wed, Oct 21, 2015 at 6:45 PM, Random832 wrote: >>> >>> Guido van Rossum writes: >>>

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-22 Thread Gregory P. Smith
On Wed, Oct 21, 2015 at 6:51 PM Guido van Rossum wrote: > Well the whole point is not to have to figure out how to implement that > right now. > > On Wed, Oct 21, 2015 at 6:45 PM, Random832 wrote: > >> Guido van Rossum writes: >> > The proposal is to allow this to be written as follows in >> >

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-21 Thread Guido van Rossum
Well the whole point is not to have to figure out how to implement that right now. On Wed, Oct 21, 2015 at 6:45 PM, Random832 wrote: > Guido van Rossum writes: > > The proposal is to allow this to be written as follows in > > implementation (non-stub) modules: > > > > class Foo(Generic[T]): > >

Re: [Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-21 Thread Random832
Guido van Rossum writes: > The proposal is to allow this to be written as follows in > implementation (non-stub) modules: > > class Foo(Generic[T]): > @overload > def __getitem__(self, i: int) -> T: ... > @overload > def __getitem__(self, s: slice) -> Foo[T]: ... > def __getitem__(self, x): > > >

[Python-Dev] PEP 484 -- proposal to allow @overload in non-stub files

2015-10-21 Thread Guido van Rossum
PEP 484 (Type Hinting) currently disallows @overload outside stub files. The hope was that a PEP for multi-dispatch would emerge, but that's been slow coming. Meanwhile, over in https://github.com/ambv/typehinting/issues/72 a proposal has emerged to allow @overload in regular modules, as long as i