On Fri, Jan 18, 2013 at 7:38 PM, David Townshend <aquavitae69@gmail.com> wrote:
True. I was going for something which might work in modules too, but module-level descriptors would probably be a more consistent approach anyway. This is actually something I have needed in the past, and got around it by putting a class in sys.modules. Maybe finding a neat way to write module-level descriptors would be more useful, and cover the same use case as consts?
I think putting class objects in sys.modules *is* the way to get "module level" descriptors. The fact it feels like a hack is a positive in my book - techniques that are "always dubious, but sometimes necessary" *should* feel like hacks, so people stay away from them until they run out of other options :) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia