Re: python contextmanagers and ruby blocks

2009-03-12 Thread Aahz
In article , Alia K 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 >comprehe

Re: python contextmanagers and ruby blocks

2009-02-22 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 09:42:02 -0800, Aahz wrote: > In article , > Alia K 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 fu

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Alia K
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 simp

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Aahz
In article , Alia K 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 (a...@p

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Alia K
Francesco wrote: > ... ruby code that shows the most twisted 'Hellow world' example I have > ever seen :-) ... and I was gunning for the simplest possible example (-: > ... python code doing the same thing - apparently - > of prevous ruby code, using context managers in a way that I believe the

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 00:46:08 -0800, Alia Khouri wrote: > As an exercise, I recently translated one of my python scripts (http:// > code.activestate.com/recipes/576643/) to haskell (a penultimate > version exists at > http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b

python contextmanagers and ruby blocks

2009-02-21 Thread Alia Khouri
As an exercise, I recently translated one of my python scripts (http:// code.activestate.com/recipes/576643/) to haskell (a penultimate version exists at http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b44244e# in case anyone is interested) with the result that haske