Jason Tackaberry wrote: > On Tue, 2007-01-23 at 14:17 +0100, Dirk Meyer wrote: >> + def __call__(self): >> + if self._singleton is None: >> + self._singleton = self._class() >> + return self._singleton > > This doesn't allow passing args to the constructor.
Yes, it does not. If it is needed later we can add it. But with args it is a harder to provide a singleton if you set different args every time. >> + def __getattr__(self, attr): >> + if self._singleton is None: >> + return Singleton.Memberfunction(self, attr) >> + return getattr(self, _singleton, attr) > > Why the need for the Memberfunction class? Why not just instantiate the > class here as well if self._singleton is None? See freevo/ui/src/[audio|video]/player.py: | # create singleton object | player = kaa.utils.Singleton(Player) | | # create functions to use from the outside | play = player.play | stop = player.stop Now the player.py provides play and stop but the player itself will created when needed. Dischi -- This file will self-destruct in five minutes.
pgp4f4IfTXEGN.pgp
Description: PGP signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel