[Grace-core] Further questions on the specification

Michael Homer mwh at ecs.vuw.ac.nz
Wed May 25 15:53:30 PDT 2011


On Thu, May 26, 2011 at 10:35 AM, Andrew P. Black <black at cs.pdx.edu> wrote:
> On 25 May 2011, at 14:49 , Michael Homer wrote:
>> If the behaviour is restricted to literals only then that problem is
>> lessened, but it's a special case with odd corners of its own.
>
> So, my proposal is that this behavior is restricted to varargs parameters. It doesn't work on literals.  Yes, this is a special case, and I'm not sure that I like it.
So another way of looking at it would be that varargs processing
constructs a tuple if required (regardless of how the argument passing
"actually" works)? That doesn't seem like a problem.

>> Python disambiguates the 1-tuple case with a trailing comma, so (7) is
>> 7 and (7,) is the 1-tuple containing 7.
>
> Yes, I recall that now.  Apart from looking weird, this might be an alternative solution.
> Funny that we should go to great lengths to make trailing semicolons insignificant, and then give this role to the trailing comma!   Can I write (4,5,6,) and if so, is it the same as (4,5,6)?

Yes, you can have a single trailing comma in any tuple, and it always
means the same thing as the tuple without the comma for size >= 2. You
can also have the comma in list, dict, and set literals, and parameter
lists.
-Michael


More information about the Grace-core mailing list