There's more than one way to do things | |
PerlMonks |
Re^4: RFC: Simulating Ruby's "yield" and "blocks" in Perl (Python)by LanX (Saint) |
on Apr 24, 2013 at 04:19 UTC ( [id://1030269]=note: print w/replies, xml ) | Need Help?? |
> FWIW, the equivalent in idiomatic Python3 is: Thanks, interesting idea to turn it inside out!¹ =) But why Python3, AFAIK generators were already introduced in 2. > while back a monstrosity was released... Thanks, even more fun! =) Especially the last line (after "bugs and limitations")
Oh, and almost forgot: We are sorry, Guido. So sorry. Grin! xD
Cheers Rolf ( addicted to the Perl Programming Language)
update¹) while its a bit cumbersome that you need to iterate over the yields... ... why not using a decorator to abstract the loop away?
updatethis worked for me in Py 2.5.2
In Section
Meditations
|
|