FAQ

John Roth wrote:
"Greg Ewing (using news.cis.dfn.de)" <g2h5dqi002 at sneakemail.com> wrote in
message news:bmd3cv$lk51t$1 at ID-169208.news.uni-berlin.de...
Dave Benjamin wrote:
In that case, why do we eschew code blocks, yet have no problem with the
implicit invocation of an iterator,
I don't think code blocks per se are regarded as a bad thing.
The problem is that so far nobody has come up with an entirely
satisfactory way of fitting them into the Python syntax as
expressions.

I know. I played around with the idea a bit after it came up a couple
of weeks ago, and identified a number of issues. <<SNIP>>
So let's say I want to use a code block instead of
a lambda or a named function in a map:

foobar = map(def (x, y, z):
astatement
anotherstatement
list1, list2, list3) <<SNIP>>
A third item is that I don't really care if we use 'def'
or not. Borrowing the vertical bar from Ruby, the map
example becomes:

foobar = map(| x, y, z |
astatement
anotherstatement
list1, list2, list3)

I kind of like this better, except for one really unfortunate
issue: it's going to raise havoc with code coloring algorithms
for a while.

John Roth
Hmm,
How about just using the presence of (...):: as starting a code block?
A call to a function that might take two function args and something else:
foo = bar(func1, func2, nonfunc)
would become:
foo = bar( (a,b)::
astatement
somemorestatements
,(c,d,e)::
anotherstatement
yetmorestatements
,nonfunc)

I used the double colon after the closing bracket as the statements of
the enclosed statement block must be double indented w.r.t foo

I guess the indentation of the arguments of bar (not including the
statement blocks could have less restrictive indentation.
Just as you could write
foo = bar(
func1,
func2,
nonfunc)
the indentation rules would have to be that the statement block is
double indented on the line after ):: and the statement block ends on
the next line with LESS indentation (more indentation would be tart of
the statement block).

Pad.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 703 of 823 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedOct 3, '03 at 5:23a
activeNov 1, '03 at 4:27a
posts823
users150
websitepython.org

150 users in discussion

Andrew Dalke: 52 posts Pascal Costanza: 44 posts Lulu of the Lotus-Eaters: 37 posts Alex Martelli: 35 posts Kenny Tilton: 35 posts Raffael Cavallaro: 25 posts Pascal Bourguignon: 23 posts James anderson: 23 posts Alex Martelli: 22 posts Terry Reedy: 21 posts Prunesquallor: 20 posts Alexander Schmolck: 19 posts David Eppstein: 17 posts Marco Antoniotti: 17 posts Daniel P. M. Silva: 17 posts Bengt Richter: 15 posts Joe Marshall: 15 posts Doug Tolton: 13 posts Dave Benjamin: 13 posts Greg Ewing (using news.cis.dfn.de): 12 posts David Rush: 12 posts Jon S. Anthony: 11 posts Erann Gat: 11 posts Mark Wilson: 11 posts Edi Weitz: 10 posts Peter Seibel: 8 posts Hartmann Schaffer: 8 posts Hans Nowak: 8 posts Thomas F. Burdick: 7 posts Vis Mike: 7 posts Marcin 'Qrczak' Kowalczyk: 7 posts Matthias: 7 posts Kaz Kylheku: 7 posts Grzegorz Chrupała: 6 posts Jacek Generowicz: 6 posts Dave Benjamin: 6 posts Frode Vatvedt Fjeld: 6 posts Raffael Cavallaro: 6 posts Björn Lindberg: 5 posts Ketil+News: 5 posts Rayiner Hashem: 5 posts Ken Shan: 4 posts Ingvar Mattsson: 4 posts Jock Cooper: 4 posts Eli Barzilay: 4 posts Erann Gat: 4 posts Michele Dondi: 4 posts Paolo Amoroso: 3 posts David C. Ullrich: 3 posts Sean Ross: 3 posts Synthespian: 3 posts Mike420: 3 posts Robin Becker: 3 posts MetalOne: 3 posts Alex Shinn: 3 posts Dirk Thierbach: 3 posts Christos TZOTZIOY Georgiou: 3 posts Sander Vesik: 3 posts Albert Lai: 3 posts Rob Hunter: 3 posts Rainer Deyke: 3 posts Matthew Danish: 3 posts Raymond Wiker: 3 posts Andreas Rossberg: 3 posts Bruce Lewis: 2 posts Rob Warnock: 2 posts Mario S. Mommer: 2 posts Mark Brady: 2 posts Sampo Smolander: 2 posts Karl A. Krueger: 2 posts Daniel Berlin: 2 posts A.M. Kuchling: 2 posts Corey Coughlin: 2 posts Tim Hochberg: 2 posts Mike Rovner: 2 posts Toni Nikkanen: 2 posts Rainer Joswig: 2 posts Jeremy H. Brown: 2 posts Hannu Kankaanp??: 2 posts Vijay L: 2 posts Coby Beck: 2 posts Russell Wallace: 2 posts Matthias Blume: 2 posts Gerrit Holl: 2 posts Dewatf: 2 posts Brian McNamara!: 2 posts Christopher C. Stacy: 2 posts John Roth: 2 posts Oren Tirosh: 2 posts Michael Geary: 2 posts Paul F. Dietz: 2 posts Tomasz Zielonka: 2 posts Brian Downing: 1 post Christoph (news_chr): 1 post Christophe Rhodes: 1 post Alan Crowe: 1 post Erik Max Francis: 1 post Category 5: 1 post Alexey Dejneka: 1 post Steven E. Harris: 1 post Gregm: 1 post Paul Foley: 1 post Jason Creighton: 1 post Duane Rettig: 1 post Felix: 1 post Shriram Krishnamurthi: 1 post Ray Blaak: 1 post Roy Smith: 1 post Michael Chermside: 1 post Ville Vainio: 1 post Thomas F. Burdick: 1 post Cameron Laird: 1 post Adrian Hey: 1 post Oleg: 1 post Rune Steffensen: 1 post Donn Cave: 1 post Alan Gauld: 1 post Dominic: 1 post Rayiner Hashem: 1 post Thant Tessman: 1 post Neelakantan Krishnaswami: 1 post Dave Brueck: 1 post Jeremy Yallop: 1 post Ed Avis: 1 post Brian Quinlan: 1 post Ng Pheng Siong: 1 post Neil Hodgson: 1 post David Golden: 1 post Lothar Scholz: 1 post Shmuel (Seymour J.) Metz: 1 post Christian Szegedy: 1 post Michael Sperber: 1 post Mark Carter: 1 post Rene van Bevern: 1 post A. Lloyd Flanagan: 1 post Donald 'Paddy' McCarthy: 1 post Avi Blackmore: 1 post Matthew Kennedy: 1 post Marco Baringer: 1 post Steve Williams: 1 post Jan Rychter: 1 post Carlo v. Dango: 1 post Steve VanDevender: 1 post Luke Gorrie: 1 post Christian Tanzer: 1 post John M. Gamble: 1 post Jens Axel Søgaard: 1 post Henrik Motakef: 1 post Pekka P. Pirinen: 1 post Darius: 1 post

People

Translate

site design / logo © 2022 Grokbase