/[ambar]/ambar/utils.py
ViewVC logotype

Diff of /ambar/utils.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.2 by amoyav, Sun Nov 10 13:48:16 2002 UTC revision 2.3 by amoyav, Thu Jan 16 09:05:16 2003 UTC
# Line 201  def escribir_excepcion(): Line 201  def escribir_excepcion():
201               ": " + \               ": " + \
202               str(sys.exc_info()[1]))               str(sys.exc_info()[1]))
203    
204    
205    def izip(*args):
206        """Como la funcion estándar de python 'zip', pero devuelve
207        un indice en la primera posición de las tuplas.
208    
209        Ejemplo:
210            print izip(['a', 'b', 'c'])
211            [(0, 'a'), (1, 'b'), (2, 'c')]
212    
213        Útil para buscar la posición de un objeto en una lista:
214            for (i, obj) in izip(lista_de_objetos):
215                if cumple_condicion(obj):
216                    return i
217        """
218        return zip(range(len(args[0])), *args)
219    

Legend:
Removed from v.2.2  
changed lines
  Added in v.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26