Skip to content
Snippets Groups Projects
  • thorstenhater's avatar
    More pythonic membership on mechanism_catalogue. (#1306) · d2623ecf
    thorstenhater authored
    Introduce two minor changes to the Python API
    to handle mechanism_catalogues idiomatically.
    
    Instead of
    
    import arbor as A
    
    cat = A.default_catalogue()
    
    if cat.has('hh'):
      print("Found HH.")
    
    for mech in cat.keys():
       print("*", mech)
    
    we can now write
    
    import arbor as A
    
    cat = A.default_catalogue()
    
    if 'hh' in cat:
      print("Found HH.")
    
    for mech in cat:
       print("*", mech)
    
    which is closer to the expectations of Python users.
    d2623ecf