Dannnno / Chemistry

Simulation of organic chemistry reactions has been moved here
https://github.com/PyCAOS/CAOS
Other
16 stars 7 forks source link

Bad getattr in Atom #30

Closed Dannnno closed 9 years ago

Dannnno commented 9 years ago

Right now Atom uses getattr to retrieve atomic data from the periodic_table module. It assumes that the dictionary keys in periodic_table are reasonable attribute names, which is incorrect. This needs to be resolved, in any of the following ways.

  1. Rename the keys in periodic_table. I'm not a fan of this, because their current keys maximize readability imo.
  2. Add an if/elif/else chain to getattr. I'm not a huge fan of this either, because if/elif/else chains are annoying to debug and just look ugly.
  3. Use a dictionary in getattr. This would map from the expected attribute names to the dictionary keys. This would be fine.

I'd strongly prefer option 3

Dannnno commented 9 years ago

Fixed in commit 4e90545c90e03900c2812dc8102d49f5a58a04ee