I am filtering a subset of edges so I can iterate through them. In this case, I am excluding the "end edges", which are the final edges along a chain:

```
import networkx as nx

graph = nx.Graph()
graph.add_edges_from([(0, 1), (1, 2), (2, 3), (3, 4)])
end_nodes = [n for n in graph.nodes if nx.degree(graph, n) == 1]
end_edges = graph.edges(end_nodes)
print(f"end edges: {end_edges}")
for edge in graph.edges:
    if edge not in end_edges:
        print(f"edge {edge} is not an end edge.")
    else:
        print(f"edge {edge} is an end edge.")

```

However, when you run this code, you get the following output:

```
end edges: [(0, 1), (4, 3)]
edge (0, 1) is an end edge.
edge (1, 2) is an end edge.
edge (2, 3) is an end edge.
edge (3, 4) is an end edge.

```

Edges `(1, 2)` and `(2, 3)` are not in `end_edges`, yet it returns `False` when the conditional `edge not in end_edges` is checked (seeming to imply that it is in fact included, when it seems to not be).

What is going on, and how can I filter this properly?

Python version is 3.7, NetworkX is 2.4.