* Shawn Walker <[EMAIL PROTECTED]> [2008-09-09 00:11]: > Shawn Walker wrote: > > Danek Duvall wrote: > >> history.py: > >> > >> - I'm curious why you went with module-level functions, rather than > >> wrapping everything in a class. That would help get rid of all the > >> "global" declarations. > > > > Because this way, the object doesn't have to be passed around. You can > > call history from anywhere, any module, at any time, and be guaranteed > > that anything you do is for the current operation. > > > > This particular data structure is a recommendation from one of the > > authors of Python (Alex Martelli), that you can find in the Python > > Cookbook, recipe 6.16, "In most cases, you don't need either of them > > [singleton or borg]. Just write a Python module, with functions and > > module-global variables, instead of defining a class, with methods and > > per-instance attributes." > > To be clear, the whole point of doing this was so that, later on, when > we go to implement bugs such as 2022 (client should provide operational > intent to server), I didn't want to have to pass around an object to > every place where we might need to get intent information. > > By using a module, I was able to get all the benefits of a singleton > (shared state, single instance) without complex mechanisms. > > This allows the client to get access to intent information at any place > throughout the code just by using history.method() without having to > rely on the caller to pass in a reference to it.
I understand that. How do you suggest I diff two image's histories? - Stephen -- [EMAIL PROTECTED] http://blogs.sun.com/sch/ _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
