Skip to content
Snippets Groups Projects
Commit f14957c9 authored by Christoph Groth's avatar Christoph Groth
Browse files

builder: simplify for_each_in_key

parent 94cb4ec2
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,6 @@ import abc
import sys
import operator
from itertools import izip, islice, chain
from collections import Iterable
import tinyarray as ta
import numpy as np
from . import system, graph
......@@ -415,9 +414,12 @@ def for_each_in_key(key, f_site, f_hopp):
if isinstance(key, Site):
f_site(key)
elif isinstance(key, tuple):
f_hopp(key)
elif isinstance(key, Iterable):
ikey = iter(key)
f_hopp(key)
else:
try:
ikey = iter(key)
except:
raise KeyError(key)
try:
first = next(ikey)
except StopIteration:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment