On Thu, 12 Mar 2015 22:04:30 +1100, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:
> >3-4 seconds to instantiate is a bit worrying, but you should look at >improving the efficiency of loading a map rather than insisting that there >should be only one map instance. Particularly in the map editor, what if >the user wants to copy parts of one map into a second map? I've often >wanted to do that with games. Every other editor, from music editors to >text editors, allows you to have multiple documents open. Why should game >level editors be stuck in the 1980s? > >While Map is a singleton, editing multiple maps at once is impossible (or at >least tiresomely difficult). Those scnearios don't apply here. And the map editor isn't even a first-class application in the system. Just a patch to corrupt map files that will thus stand a chance to be recovered. I can understand your resistance to the idea of yet another singleton being born to this world. I myself despise the pattern. I think the GoF were drunk by the time they reached the Singleton. The whole Creational Patterns section was really only going downhill, anyways. Starts strong and ends up with the justin bieber of patterns. And I'm not using it because of some ulterior design principle. I don't plan to justify it because I have a *real* reason to use a singleton. I don't. I'm just using it because it is really accomodating for me to have this global without having to trace it around function calls arguments. That's evil. I suppose I could just make it really global. But to me that's even more evil and I can't consider it. Of course. What is a singleton today can't be twins tomorrow, triplets the day after and a crowd the next. I realize this. But... yeah... I'm a sinner. Besides it's not that I never had to revisit my code before because of Best Practices (tm). In truth the road to damnation starts when we decide to write our first line of code. -- https://mail.python.org/mailman/listinfo/python-list