[Python-Dev] Dotted/indexed defs ? Re: PEP 8: Discourage named lambdas? (original) (raw)
Boris Borcic bborcic at gmail.com
Mon May 5 12:43:14 CEST 2008
- Previous message: [Python-Dev] PEP 8: Discourage named lambdas?
- Next message: [Python-Dev] Dotted/indexed defs ? Re: PEP 8: Discourage named lambdas?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mike Klaas wrote:
Another thing to consider is that the def() pattern is only possible when the bound variable has no dots. A common pattern for me is to replace an instances method with a lambda to add monitoring hooks or disable certain functionality:
inst.getfoo = lambda: FakeFoo()
Good point. That one may write eg
for inst.bar in range(10) : do_something()
makes one wonder whether
def inst.bar(...) : ...
or even
def fn[k](...) : ...
should be similarly permitted. Has this ever been discussed ?
Regards, BB
- Previous message: [Python-Dev] PEP 8: Discourage named lambdas?
- Next message: [Python-Dev] Dotted/indexed defs ? Re: PEP 8: Discourage named lambdas?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]