Manuel Garcia wrote: > def _junk(): > a = long_expression01(x0, y0) > b = long_expression02(x1, y1) > c = long_expression03(x2, y2) > return min(a,b,c), max(a,b,c) > d, e = _junk() > del _junk() > > with the purpose being keeping a,b,c out of our nice clean namespace. Don't you mean _junk? a,b,c are locals. I suppose you could do something like this (though it may seem a bit perverse here): def d(): a = long_expression01(x0, y0) b = long_expression02(x1, y1) c = long_expression03(x2, y2) return min(a,b,c), max(a,b,c) d, e = d() > j = block: > def _get_j(self): return self._j > def _set_j(self, j): self._j = j > return property(_get_j, _set_j, None, 'dynamite!') This doesn't seem quite as bad to me, though (YMMV): def j(): def _get_j(self): return self._j def _set_j(self, j): self._j = j return property(_get_j, _set_j, None, 'dynamite!') j = j() Not that I have any issues with your suggestion. I especially like the fact it can be used to implement "real" lambdas. -Jerry
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4