lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2012/12/14 spir <denis.spir@gmail.com>:
> On 14/12/2012 07:19, Dirk Laurie wrote:
>>
>> merge(...): returns a new table containing all the pairs from all the
>>     tables given as arguments. In particular, if there is only one
>>     argument, returns a shallow copy. In case of duplicate keys, later
>      values replace earlier ones. Nil arguments are treated as empty
>>     tables.
>>
>> The documentation is much longer than the code!
>
>
> That's python dict.update ;-)
>

No, Python's dict.update is object-oriented, mutates its object,
takes one or two arguments, behaves differently depending on
whether or not the first argument has a .keys() method — in fact,
it is a very typical example of the sort of feature that Python
lovers love and Python haters hate.

`merge` returns a new table. No argument table is changed.