Fuzzyman wrote:
It wasn't that part of the example that I thought was over complex.
(although it's not a 'pattern' I use often). You suggested that if we
had dynamic evaluation of default values, you would have to replace it
with :

class foo(object):
   matcher=re.compile(r'...')
   def __new__(self, bar, baz, matcher=None):
       if matcher is None:
           matcher = self.matcher
       ...
       text = matcher.sub(r'...', text)
       ...


Now that I thought was over complex... when all you wanted to do was
put a constant into your default value !

Ahh. Yeah, the thing above is a bit complex, but it keeps the same namespaces -- matcher is only available to foo, not the enclosing class/module. Point taken of course. ;)


Steve
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to