Have a registry of regions?
Would it be helpful to keep track of all region classes? We can do that with a simple meta-class (I could add it)
@astrofrog - What would be the purpose / use cases of a registry of regions?
If there's a use cases for it, then yes, it does sound like a nice thing to have.
I'm 👍 on having a registry of regions.
Probably we should also introduce a "region type" class-level attribute for each region, no?
Looks like shapely does this via the geom_type:
http://toblerity.org/shapely/manual.html#object.geom_type
Where possible we could use the STS-C names (see #21), so that this is also a first step towards supporting the STS-C region data model and serialisation format.
One possible use case for the registry would be to replace the lists of regions here: https://github.com/astropy/regions/blob/master/regions/shapes/tests/test_api.py and, in addition to being used in the tests, to also print a text or HTML summary report of which methods are implemented or not (using checks like what's currently done in the tests).
I don't know how to implement a registry well.
@astrofrog - Do you have time to contribute this? Or can you point to some other example of a registry how this should be implemented?
Moving to 0.3 milestone.
@astrofrog @larrybradley or anyone - Is there a standard pattern or even utilities to implement registries in Astropy core? (in a way that's simultaneously Python 2 and 3 compatible).
Just for references, this is what I came up with via a Google search so far: https://github.com/faif/python-patterns/blob/master/behavioral/registry.py http://www.effectivepython.com/2015/02/02/register-class-existence-with-metaclasses/
I don't think this is a blocker for the 0.3 release we wanted to make later this week. Moved to 0.4 milestone. If someone has time to implement this, it can go in any time of course. There was agreement in the discussion above that this would be nice to have.