Mike Orr wrote: >> g should be renamed persist. The interesting thing about g isn't that it is >> global, rather that the variables attached to it persist across requests. > > The interesting thing about 'g' is, um... is there anything > interesting about it? > I've found two rare cases for it. One was for a reference object > that's built on application startup, which I could just have easily > put into a module global. The other was for the SQLAlchemy engine, > which also worked better as a module global instead. Oh, another time > I thought 'g' would be a good place for thread-unsafe objects, but > then found out it's shared between threads. So what good is it?
It just allows you to group together all the things you could otherwise have as module globals. All your initialisation then has easy access to the config options and you know precisely when all the objects set as attributes on g are created. You are right though, you could do without it if you really wanted to. Personally I like it but in hindsight I think Global is misleading and persistent is a better description. Cheers, James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en -~----------~----~----~----~------~----~------~--~---
