3 ms·
http://prog21.dadgum.com/121.html http://prog21.dadgum.com/121.html
by snaky 10y ago
http://prog21.dadgum.com/121.html http://prog21.dadgum.com/121.html
- yummyfajitas 10y agoPython has the idiom he describes as a builtin. with open(filename) as f: ...your func goes here If you want to create your own custom one: @contextlib.contextmanager def with_a_foo(...): foo = ... yield foo ...cleanup the foo... It's less terse (and in my opinion more readable [1]) than J, but same idea. [1] I very rarely find point free programming to be comprehensible. This may be my mental limitation.