arbor-sim / arbor

The Arbor multi-compartment neural network simulation library.
https://arbor-sim.org
BSD 3-Clause "New" or "Revised" License
108 stars 60 forks source link

`label_dict` does not behave like a `dict` #1535

Open Helveg opened 3 years ago

Helveg commented 3 years ago
thorstenhater commented 3 years ago

Implemented in #1711

As label_dict is essentially frozen, we cannot implement

These remain open/untested, but I am less sure we need all of them

@Helveg does this fulfill your needs?

Helveg commented 3 years ago
val = labels.get("key", "(nil)")
try:
  val = labels["key"]
except KeyError:
  val = "(nil)"

Why not implement __delitem__? Imagine wanting to strip a certain set of keys from a factory label dict. I don't see a specific use case for pop(item) since it is unordered, but del certainly.