
A simple utility function to merge several lists in a single one, using the functional programming tools:
def merge(*input): return reduce(list.__add__, input, list())
Example:
>>> a = [0, 1, 2] >>> b = [2, 3, 4] >>> c = [4, 5, 6] >>> merge(a, b, c) [0, 1, 2, 2, 3, 4, 4, 5, 6]
The same but removing duplicates:
def merge_uniq(*input): return list(reduce(set.union, input, set()))
The same but removing duplicates later:
def merge_uniq(*input): return list(set(merge(input)))
Other (easier) ways to achieve the same?
Comentarios
hummmm
I'm curious, why write in english? I think it's the first post I see in that language (in that site of course). That's all.
_________________________________________________________________________________
"aviso: la dereferencia de punteros de tipo castigado romperá las reglas de alias estricto" --GCC 4.3.1
Copypaste
Je pense qu'il a écrit en Anglais parce qu'il l'a copié
Maybe.
Maybe.
Cree el ladrón...
"Cree el ladrón que todos son de su condición" refranero español
No soy portavoz de ningún colectivo, grupo o facción. Mi opinión es personal e intransferible.
"You know now... ehhh"
It's a requirement of the international projection strategy of CRySoL.
Cheers
No soy portavoz de ningún colectivo, grupo o facción. Mi opinión es personal e intransferible.
Al guano!
...ahora que estoy difundiendo crysol en centroamérica venés vos con esa onda? híjole!
------------------------------------------------------------
MiniHOW-TO: destroy your hard disk
# dd if=/dev/zero of=/dev/hda bs=1G count=10
------------------------------------------------------------
Yes, but reading English does
Yes, but reading English does make learning GNULinux a lot easier.
Yes
at least for english people.
No soy portavoz de ningún colectivo, grupo o facción. Mi opinión es personal e intransferible.
vaaaale
habrá que hacer contenido multilíngüe después de todo. ¡¡¡lucas!!!
No soy portavoz de ningún colectivo, grupo o facción. Mi opinión es personal e intransferible.