[pyar] Programación funcional en python
Martín Gaitán
gaitan en gmail.com
Mie Oct 23 14:00:55 ART 2013
2013/10/23 Elvio Rogelio Toccalino <elviotoccalino en gmail.com>
> En python, creo que hace justo eso: devuelve una lista.
devuelve tupla, string si S es tupla o string, o lista para cualquier otro
iterable
"""filter(function or None, sequence) -> list, tuple, or string"""
In [53]: filter(lambda a:a, (1,2,3))
Out[53]: (1, 2, 3)
In [54]: filter(lambda a:a, [1,2,3])
Out[54]: [1, 2, 3]
In [55]: filter(lambda a:a, iter([1,2,3]))
Out[55]: [1, 2, 3]
In [56]: filter(lambda a:a, "abc")
Out[56]: 'abc'
--
mgaitan.github.io
textosyprextextos.com.ar
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20131023/9ea4a5ef/attachment.html>
More information about the pyar
mailing list