Open pmolodo opened 8 years ago
From tdor...@zindagigames.com on April 10, 2013 14:32:16
I agree that you can simplify it by adding the replace keyword, but I think a better question is should this be common use? The argument could be made that you should only create the window once, populate it, and then re-use it on future runs of the code. Your common pattern becomes:
self.win = getWindow(self.NAME)
where getWindow will either return the existing window or build one. This could have the side effect of encouraging MVC patterns (which I find to be a good thing) by having the getWindow function act as the view creator.
An argument against this is that during development you often need to rebuild the window but that can be solved by a small alternation to getWindow that wouldn't go into production.
Has a decision been made regarding these design choices? I really love the idea of having a replace=True
kwarg. Truely a common idiom, those 3 lines you pointed out, Chad.
From chad...@gmail.com on April 10, 2013 13:44:09
this is a common python idiom:
we could simplify this with a replace flag that performs the same behavior:
Original issue: http://code.google.com/p/pymel/issues/detail?id=297