Storing objects required by functions.

John Roth newsgroups at jhrothjr.com
Tue Dec 30 10:58:13 EST 2003


"Aahz" <aahz at pythoncraft.com> wrote in message
news:bss5t7$1tf$1 at panix1.panix.com...
> In article <99dce321.0312300655.14c5a8db at posting.google.com>,
> David M. Wilson <dw-google.com at botanicus.net> wrote:
> >
> >g = re.compile('...')
> >
> >def uses_global_yuck(x):
> >    global g
> >    pass
>
> Why not just use the global?  Without the ``global`` statement, that is.
> Don't like that?  How's it any different from using a class instance?

You can't parameterize it. You've got one global, while
you can put different parameters in different class instances.
He isn't doing that here, but that's the major place where the
Function Object design pattern shines.

John Roth

> -- 
> Aahz (aahz at pythoncraft.com)           <*>
http://www.pythoncraft.com/






More information about the Python-list mailing list