Storing objects required by functions.

John Roth newsgroups at
Tue Dec 30 16:58:13 CET 2003

"Aahz" <aahz at> wrote in message
news:bss5t7$1tf$1 at
> In article <99dce321.0312300655.14c5a8db at>,
> David M. Wilson < at> 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           <*>

More information about the Python-list mailing list