In article <c6b9e335-a04d-44cb-b18e-18a52eef1...@k19g2000yqg.googlegroups.com>, Alia K <alia_kho...@yahoo.com> wrote: >Aahz wrote: >> >> Longer answer: the way in Python to achieve the full power of Ruby >> blocks is to write a function. > >You are most likely right... there is probably no need to introduce >ruby-like blocks to python where iteration comes naturally with list >comprehensions and generators. But for the simple case of entering a >block of code as one does with @contextmanager I suppose it would be >nice to make a generator with a single yield statement a >contextmanager by default such that [...]
There has been some discussion of this on the python-ideas mailing list; if this is a subject you care about, you may want to read up on the history and join the list. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson -- http://mail.python.org/mailman/listinfo/python-list