October 21, 2009
Leandro Lucarella wrote:
> grauzone, el 21 de octubre a las 22:12 me escribiste:
>> Or even:
>>
>> a, b = foo();
>>
>> or
>>
>> a, _ = foo();
>>
>> Works in Python (tm)
> 
> _ is a regular symbol (variable name in this case), there is nothing
> special about the second form, which is exactly the same as the first. And


I didn't even know this. In Python, it doesn't matter anyway, because it is dynamically typed, and you can assign arbitrary values to the same variable.

Apparently, writing foreach (index,_;something) in D isn't a special case either; it just declares a variable named _. Several nested loops using _ are not possible.

PS: let's hope Walter recognizes the need of *good* syntax for a simple, basic language construct like tuples. Just look at language_fan's D code and compare it with the corresponding Python code posted afterward. The D code looks so ridiculous.

> BTW, the trailing ; is not needed ;)
> 
October 21, 2009
grauzone, el 21 de octubre a las 23:32 me escribiste:
> Leandro Lucarella wrote:
> >grauzone, el 21 de octubre a las 22:12 me escribiste:
> >>Or even:
> >>
> >>a, b = foo();
> >>
> >>or
> >>
> >>a, _ = foo();
> >>
> >>Works in Python (tm)
> >
> >_ is a regular symbol (variable name in this case), there is nothing special about the second form, which is exactly the same as the first. And
> 
> 
> I didn't even know this. In Python, it doesn't matter anyway, because it is dynamically typed, and you can assign arbitrary values to the same variable.
> 
> Apparently, writing foreach (index,_;something) in D isn't a special case either; it just declares a variable named _. Several nested loops using _ are not possible.

Using _ is a bad idea if you use gettext though ;)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
El techo de mi cuarto lleno de estrellas
1 2 3 4 5 6
Next ›   Last »