> Jeremy wrote: > I tend to agree with you, Guido. I think we would do well to purposefully > omit continuations from the Python language. There seems to be little need > for a facility to implement arbitrary control structures in Python. If > Python support coroutines and microthreads, I am not sure what else would be > needed. I just finished reading Thomas and Hunt's "Programming Ruby" (the first book in English on the language). It's pretty clear that their favorite language feature in Ruby is the block, which is any group of statements inside either braces or do...end. Blocks are invoked using the 'yield' construct, and can take any number of arguments (enclosed in bars): def fibUpTo(max) i1, i2 = 1, 1 while i1 <= max yield i1 # 'call' the block i1, i2 = i2, i1 + i2 end end fibUpTo(1000) { |f| print f, " " } Most built-in types have iterators that understand blocks: [1, 3, 5].each { |i| puts i } # prints 1, 3, and 5 on separate lines Programmers can use blocks and 'yield' to create new control structures, subject to the limitation that a statement can only be given one block (which means that a multi-way interleaving loop can't be built out of blocks). It would be interesting to see how many of their examples can be done (easily) with stackless... Thanks, Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4