Tuples a first class feature, manu's new unary operator and named arguments
    Mark 
    smarksc at gmail.com
       
    Sun May 10 12:06:33 UTC 2020
    
    
  
On Sunday, 10 May 2020 at 03:14:08 UTC, Timon Gehr wrote:
> On 09.05.20 19:07, Mark wrote:
>> but the syntax is extremely terse (*mytuple).
>
> def foo(x, y):
>     return x + y
>
> print(map(foo, [(1, 2), (3, 4)])) # without unpacking, does not 
> work
>
> # manual unpacking, kind of not "extremely terse":
> print(list(map(lambda t: foo(*t), [(1, 2), (3, 4)])))
Hmmm, very good point.
The issue seems similar (at least in spirit) to that of implicit 
casting. Implicit casting is, in a sense, syntactic sugar, saving 
you from writing "cast(mytype) myval" all over the place. It's 
also a highly contentious issue; everyone seems to be have their 
opinion of the extent to which implicit casting is a good thing.
    
    
More information about the Digitalmars-d
mailing list