The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Holy Red Snakes!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Holy Red Snakes! Posted: Apr 27, 2005 2:58 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Holy Red Snakes!
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

Gabriele Renzi wrote in about Guido van Rossum’s PEP #340 Anonymous Block Statements proposal announced today:

Think of PEPs as RCRs in python land. Notice this has just been written and is probably going to change a whole lot, but the core idea is: adding blocks to python.

Notice the great near-to-end phrase: Note: the syntactic extensions to yield make it use very similar to that in Ruby. This is intentional.

I can’t seem to find practical examples, but it appears that the block..as is the influenced syntax here:

 block with_file(filename) as f:
   for line in f:
     print process(line)

The above being the example of the non-looping case, much like we use File.open with a block that closes our file handles. And you can use yield inside the with_file definition very much like you do in Ruby.

About Ruby’s influence, Guido says:

I think we’re on to something. And I’m not too proud to say that Ruby has led the way here to some extent (even if Python’s implementation would be fundamentally different, since it’s based on generators, which has some different possibilities and precludes some Ruby patterns.)

Of course. Ahem. You’re all red. All of you.

Read: Holy Red Snakes!

Topic: Chicago Meetup with David Heinemeier Hansson Previous Topic   Next Topic Topic: A sucker for joe

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use