uwoseis / zephyr

Open-source seismic waveform modelling and inversion code written in Python
https://zephyr.space
MIT License
17 stars 8 forks source link

[CLOSED] Change AttributeMapper to use metaclasses #1

Closed bsmithyman closed 8 years ago

bsmithyman commented 8 years ago

Issue by bsmithyman Thursday Nov 05, 2015 at 19:52 GMT Originally opened as https://github.com/uwoseis/anemoi/pull/1


Overall, I think this is an improvement. It adds:

  1. Subclasses of AttributeMapper only have to specify what's new about their requirements; if they inherit from something like BaseDiscretization and it has an initMap attribute, they will automatically inherit whichever keys they don't override.
  2. The key initialization code runs before __init__ in the subclass, which means that it is not necessary to call super(SubClass, self).__init__(systemConfig, *args, **kwargs) just to add some code to __init__; though, fair to say, it may still be a good idea depending on the circumstances.

Suggest merging whenever we're comfortable with the changes.


bsmithyman included the following code: https://github.com/uwoseis/anemoi/pull/1/commits

bsmithyman commented 8 years ago

Comment by ShaunHadden Friday Nov 06, 2015 at 16:19 GMT


Looks great!