Hacker News new | ask | show | jobs
by Znafon 1032 days ago
You could modify it easily, for example the user could register an additional function to the mapping. That would not be as easy to do with a module and getattr().

You can also list the registered function with math_exprs.keys() and that might not be as easy with a module either.

1 comments

if all the keys are unknown until runtime then I guess the dict makes sense

I don't think it makes much sense in the example code given