python contextmanagers and ruby blocks

Aahz aahz at pythoncraft.com
Sat Feb 21 12:42:02 EST 2009


In article <aac004f8-2077-4e53-a865-47c24f7f523a at t3g2000yqa.googlegroups.com>,
Alia K  <alia_khouri at yahoo.com> wrote:
>
>Nevertheless, I remain curious about whether once can use the
>contextmanager in python to achieve the full power of ruby's blocks...

Short answer: no

Longer answer: the way in Python to achieve the full power of Ruby
blocks is to write a function.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-list mailing list