Chalarangelo / 30-seconds-of-python

Short Python code snippets for all your development needs
https://www.30secondsofcode.org/python/p/1
Creative Commons Attribution 4.0 International
8.83k stars 1.26k forks source link

Allow variable number of arguments to union function #398

Closed tanmay2004 closed 3 years ago

tanmay2004 commented 3 years ago

To me, it looks like the current definition of the union function is a copy of the union in sets, but for lists. However, it does not do so correctly. The set definition allows multiple sets to be passed as the parameters.

Logically, it follows that this union function for lists should do/allow the same thing. Allowing multiple lists as the input also expands on its functionality and makes it more useful while not hampering it's current capabilities.

I feel that this file/function could also be renamed to list_union.md instead, in order to differentiate it from the set union function. But, I leave that up to the other members of the community to decide....