Skip to main content
3 events
when toggle format what by license comment
Feb 18, 2019 at 22:25 comment added 301_Moved_Permanently @LetMeSOThat4U Well, if you want to keep the default_factory parameter, you won't be able to use a module globals to store your singleton. So you're left with overriding __new__ or using the borg pattern. At this point this is stylistic preferences to me, as the overhead of creating a new borg each time is way less than a blocking lock. I do agree, however, that if you go the dict.get route, a module globals is way simpler and more adapted. See for instance Django's settings or tornado's options.
Feb 18, 2019 at 16:55 comment added LetMeSOThat4U Thank you for pointing out that problem with default_factory. Re Borg pattern: well, I started with it.. until I've ran into severe criticisms of Borg pattern as such, see e.g. stackoverflow.com/questions/34568923/borg-design-pattern At this point I'm not really sure what to think about it..
Feb 18, 2019 at 13:27 history answered 301_Moved_Permanently CC BY-SA 4.0