Mike Klaas wrote:
... A common pattern for me is to replace an instances method with a
lambda to add monitoring hooks or disable certain functionality:
   inst.get_foo = lambda: FakeFoo()
This is not replacable in one line with a def (or without locals() detritius). Assuming this is good style, it seems odd that
   inst.get_foo = lambda: FakeFoo()
is acceptible style, but
   get_foo = lambda: FakeFoo()
But surely, none of these are great style, and in fact the lambda
lures you into using it.

I'd propose a far better use is:
    inst.get_foo = FakeFoo
or
    get_foo = FakeFoo

--Scott David Daniels
[EMAIL PROTECTED]

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to