PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Extend SymbolTable.lookup() with a "default value" argument to avoid need for try...except.

Open arporter opened this issue 1 year ago • 1 comments

Currently the lookup method of SymbolTable will raise a KeyError if a Symbol cannot be found (c.f. a Python dict). However, this leads to a lot of try..except blocks which could be avoided if we could just tell the method to return e.g. None if no Symbol is found. By adding an optional argument we can make this change backwards-compatible (which is good because it would otherwise touch a lot of code).

arporter avatar May 10 '24 14:05 arporter

Oops, just noticed you'd already implemented these w.r.t. #2588 @arporter. Branch 2585_symbol_table_lookup_default_value can thus be disregarded and/or deleted.

JulienRemy avatar Jun 21 '24 13:06 JulienRemy