3 ms·
Hard disagree. The reason why Lua can have this is because of the ergonomics of its table datatype. The table is used for both list-like and dictionary-like use
by chippiewill 3y ago
Hard disagree. The reason why Lua can have this is because of the ergonomics of its table datatype. The table is used for both list-like and dictionary-like usecases and has specific optimisations around iterating over integer keys in a table.
Python on the other hand has a clear separation between the two usecases as separate datatypes, so munging them like this would muddy the language.
- wheelerof4te 3y agoVery much agreed. As if Python wasn't muddied enough, people now want to tack on every bit of syntax sugar just to have...another different way to do the same thing. Urrrghh...
- qsort 3y agoYeah, this is dumb as rocks. On top of what you said, Python already has a mechanism to do what the author is claiming! >>> def f(x, y, a, b): ... print(x, y, a, b) ... >>> args = {'x': 98, 'y': 99, 'a': 1, 'b': 2} >>> f(**args) 98 99 1 2
- theptip 3y agoDoesn’t work with functions that take an arbitrary number of positional args. Not sure of any real examples of that function API but I suspect that’s what Ned is going for.
- deleted 3y ago[deleted]