def iter_length(iter):
    """
	>>> iter_length(iter([1,2,3]))
	3
	>>> iter_length(iter([]))
	0
	"""
    n = 0
    try:
        while True:
            next(iter)
            n += 1
    except StopIteration:
        return n
