def safe_zip(*args):
 base = len(args[0])
 for (i, arg) in enumerate(args[1:]):
  if (len(arg) != base):
   raise ValueError(('Argument 0 has length %d but argument %d has length %d' % (base, (i + 1), len(arg))))
 return zip(*args)

def safe_zip ( * args ) : base = len ( args [ 0 ] ) for ( i , arg ) in enumerate ( args [ 1 : ] ) : if ( len ( arg ) != base ) : raise ValueError ( ( 'Argument 0 has length %d but argument %d has length %d' % ( base , ( i + 1 ) , len ( arg ) ) ) ) return zip ( * args )
like zip .