Re: [Python-3000] optional argument annotations

2006-11-27 Thread Brett Cannon
On 11/26/06, Tony Lownds <[EMAIL PROTECTED]> wrote: On Nov 26, 2006, at 1:10 PM, Brett Cannon wrote: On 11/24/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > > > Obviously signature objects would grow support for annotations, but I > > still need the information to be carried on the code object t

Re: [Python-3000] optional argument annotations

2006-11-26 Thread Tony Lownds
On Nov 26, 2006, at 1:10 PM, Brett Cannon wrote: On 11/24/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > Obviously signature objects would grow support for annotations, but I > still need the information to be carried on the code object to > incorporate into signature objects. > Signature obj

Re: [Python-3000] optional argument annotations

2006-11-26 Thread Brett Cannon
On 11/24/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > Obviously signature objects would grow support for annotations, but I > still need the information to be carried on the code object to > incorporate into signature objects. > Signature objects still need a way to know the nested parameters,

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Collin Winter
On 11/24/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > On Nov 24, 2006, at 8:30 AM, Guido van Rossum wrote: > > (It does imply that we can't use "-> None" to indicate "returns no > > value". We'd have to spell that as "-> type(None)" or find some other > > way. I think I don't care. Do others? Colli

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Tony Lownds
> Obviously signature objects would grow support for annotations, but I > still need the information to be carried on the code object to > incorporate into signature objects. > Signature objects still need a way to know the nested parameters, right? How about a co_argnames attribute? eg for def f

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Greg Ewing
Andrew Koenig wrote: > def foo(a: T1) -> T2: > > I am presumably going to accept an argument of type T1 or a type derived > from T1, You're making assumptions about the semantics of the annotations here, which I thought wasn't going to be done. -- Greg _

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Andrew Koenig
> Hm, I think it would be fine if there *was* no distinction. IOW if > > def foo(a: None) -> None: pass > > was indistinguishable from > > def foo(a): pass > > In fact I think I'd prefer it that way. Having an explicit way to say > "no type here, move along" sounds fine. I'd like to urge again

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Brett Cannon
On 11/24/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 11/24/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > > On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > On 11/23/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > > > > I have a working optional argument syntax implementation, I'm

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Tony Lownds
> f.func_annotations >> {'x': 1} > > Very cool! I agree that Phillip's idea for simplification is worth a > try. We're generally not too concerned over the cost of function > declarations since they typically execute only once per program. As > long as it's really cheap when no annotations are

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Tony Lownds
On Nov 24, 2006, at 8:30 AM, Guido van Rossum wrote: >> I would rather see it integrated into a Signature object (Brett >> had an >> implementation), instead of showing up as two separate attributes. > > Yes, you're right; I forgot about that. > I'd imagine that the Signature object would live

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Guido van Rossum
On 11/24/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > On 11/23/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > > > I have a working optional argument syntax implementation, I'm hoping > > > to get some direction on > > > the implementation de

Re: [Python-3000] optional argument annotations

2006-11-24 Thread Jim Jewett
On 11/23/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 11/23/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > > I have a working optional argument syntax implementation, I'm hoping > > to get some direction on > > the implementation decisions so far please see below. I would rather see it i

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Guido van Rossum
On 11/23/06, Tony Lownds <[EMAIL PROTECTED]> wrote: > I have a working optional argument syntax implementation, I'm hoping > to get some direction on > the implementation decisions so far please see below. Wow! > Python 3.0x (p3yk:52824M, Nov 23 2006, 09:22:23) > [GCC 3.4.4 20050721 (Red Hat

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Tony Lownds
On Nov 23, 2006, at 11:21 AM, Phillip J. Eby wrote: > Why not just have the generated bytecode construct the annotation > dictionary directly and assign it to the returned function's > func_annotations, and the same for func_return if needed? Then > there'd be no need to change the MAKE_FU

Re: [Python-3000] optional argument annotations

2006-11-23 Thread Phillip J. Eby
At 10:00 AM 11/23/2006 -0800, Tony Lownds wrote: >I have a working optional argument syntax implementation, I'm hoping >to get some direction on >the implementation decisions so far please see below. Why not just have the generated bytecode construct the annotation dictionary directly and ass

[Python-3000] optional argument annotations

2006-11-23 Thread Tony Lownds
I have a working optional argument syntax implementation, I'm hoping to get some direction on the implementation decisions so far please see below. Python 3.0x (p3yk:52824M, Nov 23 2006, 09:22:23) [GCC 3.4.4 20050721 (Red Hat 3.4.4-2)] on linux2 Type "help", "copyright", "credits" or "licens