def safezip(*args):
 Nx = len(args[0])
 for (i, arg) in enumerate(args[1:]):
  if (len(arg) != Nx):
   raise ValueError((_safezip_msg % (Nx, (i + 1), len(arg))))
 return list(zip(*args))

def safezip ( * args ) : Nx = len ( args [ 0 ] ) for ( i , arg ) in enumerate ( args [ 1 : ] ) : if ( len ( arg ) != Nx ) : raise ValueError ( ( _safezip_msg % ( Nx , ( i + 1 ) , len ( arg ) ) ) ) return list ( zip ( * args ) )
make sure *args* are equal len before zipping .