Paul Prescod <paul@prescod.net>: > Mixed feelings on that...not a big fan of the Ruby indiom: > > 5.dotimes(): > print "Hello"; My proposal has the (possibly minor) advantage over the Ruby syntax that it doesn't have the (), so that it more closely resembles the syntax of built-in control structures, and doesn't look so much like you're making a call with one less parameter than you really are. (Unfortunately, in the process, it manages to obscure that you're making a call at all. :-[) If you don't like the look of the dot-notation in that position, the lock example could be done using a procedure instead of a method of the lock object: withlock mylock: do_something() def withlock(lock, body): lock.acquire() try: body() finally: lock.release() > I sort of like the fact that Python figures out what control flow > features people need (e.g. foreach and simple generators) and just > implements. Yes, but the feature we're talking about is designed for those cases where you badly need a control structure that Guido hasn't thought of yet. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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