I think it is a bad idea.
Its a very odd use of meta classes which will contribute to confusion of anyone trying to follow your code. In order to make it worth using this technique, you need the advantages to outweigh that confusion.
As for your reasons:
- Creating an accesible Foo class that can be instantiated, but doesn't actually work like a typical object is much more prone to misuse than an internal class that you know you aren't supposed to call.
- Don't name the base class with an underscore. If its intended to be inherited by other modules, it shouldn't be named that way.
- There already is a method to implement static classes in python,
staticmethodorclassmethod. As noted, its not hard to implement astaticproperty
In general, there is a theme in your approach of trying to prevent client code from doing the wrong thing. That's not a pythonic attitude. The pythonic approach is to trust your client code. If they want to do something crazy, let them. Don't try to prevent client from instantiating your internal object, there may well be a good reason to do that.
I'm a bit of a purist and think that you shouldn't be storing state like this. So the very fact that you are asking the question means youryou're already doing it wrong. If you have state, I think it should be in an object. I think storing any sort of state at the module level should be avoided. I think its only a good idea to implement something like this if you have no changing state.
To close off, I'd like to plug the http://codereview.stackexchange.comCode Review Stack Exchange, where I'm a moderator. If you post your code there you can get suggestions on how to make it better. I think you may get some helpful suggestions for how to restructure your code to avoid this question from even coming up.