Charles Cazabon <[EMAIL PROTECTED]> wrote:
> Indeed. The original poster seems to want something that would work (not
> necessarily look) like this:
>
> do:
>
> while
>
> with executed once prior to first being tested. But the
> above is ugly, and you can get much the same effect
Nicolas Fleury <[EMAIL PROTECTED]> wrote:
> Guido van Rossum wrote:
> > Why are you so excited about having until indented? You didn't give
> > any examples with multiple occurrences. A single occurrence works just
> > fine unindented, as PEP 315 has already shown.
>
> FWIW, I must say I disagree
Guido van Rossum wrote:
> Why are you so excited about having until indented? You didn't give
> any examples with multiple occurrences. A single occurrence works just
> fine unindented, as PEP 315 has already shown.
FWIW, I must say I disagree (about "works just fine"). I find PEP 315
counter-in
> > I believe that Algol 68 loops looked like the following (in somewhat
> > more Python-like terms):
> >
> > [for [from ] [step ] to ]
> > [while ]
> > do od
> As far as I remember, it was:
> do
>
> while
>
> od
> It might be that this could be preceded by a 'for'
Guido van Rossum wrote:
> Why are you so excited about having until indented? You didn't give
> any examples with multiple occurrences. A single occurrence works just
> fine unindented, as PEP 315 has already shown.
I hadn't actually thought about the temptation to try and have
multiple 'until' s
Guido van Rossum wrote:
> On 6/14/05, Eric Nieuwland <[EMAIL PROTECTED]> wrote:
>> From Programming Languages 101 I remember this construct in Algol 68.
>> It was then claimed to be *the* universal loop construct. If that is
>> true __and__ it is easy to implement, I'd say +INF for PEP 315.
>
> It
On 6/14/05, Eric Nieuwland <[EMAIL PROTECTED]> wrote:
> From Programming Languages 101 I remember this construct in Algol 68.
> It was then claimed to be *the* universal loop construct. If that is
> true __and__ it is easy to implement, I'd say +INF for PEP 315.
It's true, but this both dates you
> > With PEP 315, a do-while loop would look like:
> >
> >do:
> >
> >while :
> >pass
> > But then, I'm reasonably happy with the 'break out of an infinite
> > loop' approach, so *shrug*.
> From Programming Languages 101 I remember this construct in Algol 68.
> It was then
On 6/14/05, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> Oh. I had the impression that the reason do-while's (or do-until's
> which I like more) wasn't implemented in the language was because it
> was impossible to find an acceptable looking syntax.
No, just because it's fairly redundant.
> > >
Nick Coghlan wrote:
> With PEP 315, a do-while loop would look like:
>
>do:
>
>while :
>pass
>
> But then, I'm reasonably happy with the 'break out of an infinite
> loop' approach, so *shrug*.
From Programming Languages 101 I remember this construct in Algol 68.
It was th
> > do:
> >
> > until
> >
> > Written like this it is not very obvious that the 'unil' is part of
> > the do-until suite. I also imagine it to be difficult to parse and it
> > breaks the rule that suites end when there is a dedentation. So, IMHO
> > using an indented 'until' is the least evil
[Bob]
> islice depends on __getitem__.
Incorrect. It uses the iterator protocol.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive
On Jun 14, 2005, at 2:25 AM, Raymond Hettinger wrote:
>> def readby(inp, blocksize=1024):
>> while True:
>> data = inp.read(blocksize)
>> if not data:
>> break
>> yield data
>>
>> for data in readby(inp, blocksize):
>> . . .
>>
>
> readby() relies
Jp Calderone writes:
> Anything can be a for loop.
>
> for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''):
> f2.write(chunk)
Raymond responds:
> It would be nice to have this encapsulated in a file method:
>
> for chunk in f1.iterblocks(CHUNK_SIZE):
> f2.write(chunk)
What ever
> def readby(inp, blocksize=1024):
> while True:
> data = inp.read(blocksize)
> if not data:
> break
> yield data
>
> for data in readby(inp, blocksize):
> . . .
readby() relies on the existence of a read() method for inp.
itertools work with gen
On Jun 14, 2005, at 1:25 AM, Raymond Hettinger wrote:
By the way, whatever happened to "and while"? i.e.:
while True:
data = inp.read(blocksize)
and while data:
out.write(data)
>>>
>>> My favourite version of this is
>>>
>>>
> >> By the way, whatever happened to "and while"? i.e.:
> >>
> >> while True:
> >> data = inp.read(blocksize)
> >> and while data:
> >> out.write(data)
> >>
> >
> > My favourite version of this is
> >
> >while:
> > data = inp.read(blocksize)
> >gives data:
On Jun 13, 2005, at 10:20 PM, Greg Ewing wrote:
> Phillip J. Eby wrote:
>
>
>> By the way, whatever happened to "and while"? i.e.:
>>
>> while True:
>> data = inp.read(blocksize)
>> and while data:
>> out.write(data)
>>
>
> My favourite version of this is
>
>while
Phillip J. Eby wrote:
> By the way, whatever happened to "and while"? i.e.:
>
> while True:
> data = inp.read(blocksize)
> and while data:
> out.write(data)
My favourite version of this is
while:
data = inp.read(blocksize)
gives data:
out.write(data)
[Jp Calderone]
> Anything can be a for loop.
>
> for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''):
> f2.write(chunk)
It would be nice to have this encapsulated in a file method:
for chunk in f1.iterblocks(CHUNK_SIZE):
f2.write(chunk)
Raymond
__
Jp Calderone writes:
> for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''):
> f2.write(chunk)
Phillip J. Eby responds:
> Showoff. ;)
>
> More seriously, I think your translation makes an excellent argument in
> *favor* of having a do/while statement for greater clarity. :)
Interesting... I
Michael McLay <[EMAIL PROTECTED]> writes:
> I think this would be feature creep. It complicates the language
> for a very small gain. While the added syntax would be intuitive, it
> only saves a line or two over the existing syntax.
FWIW, this is my opinion too (and I've written a bunch of while
On Monday 13 June 2005 08:07, Nick Coghlan wrote:
> Raymond Hettinger wrote:
> > [BJörn Lindqvist]
> >
> >>I would like to have do-while's like this:
> >>
> >>do:
> >>
> >>until
> >>
> >>But I'm sure that has problems too.
> >
> > That looks nice to me.
>
> And this could easily be extende
On 6/13/05, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
> do:
>
> until
>
> Written like this it is not very obvious that the 'unil' is part of
> the do-until suite. I also imagine it to be difficult to parse and it
> breaks the rule that suites end when there is a dedentation. So, IMHO
> usi
At 08:14 AM 6/13/2005 -0400, Jp Calderone wrote:
>On Mon, 13 Jun 2005 01:25:51 -0400, "Phillip J. Eby"
><[EMAIL PROTECTED]> wrote:
> >Block-copying a file with read() has the same pattern (e.g. in shutil), but
> >you can't make it a for loop.
>
>Anything can be a for loop.
>
> for chunk in iter(
> > >>do:
> > >>
> > >>until
> > >>
> > >>But I'm sure that has problems too.
> > >
> [Raymond Hettinger]
> > > That looks nice to me.
>
> [Nick Coghlan]
> > And this could easily be extended to allow code both before and after
> > the 'until', giving a fully general loop:
> >
> >do:
> > [BJörn Lindqvist]
> >
> >>I would like to have do-while's like this:
> >>
> >>do:
> >>
> >>until
> >>
> >>But I'm sure that has problems too.
> >
[Raymond Hettinger]
> > That looks nice to me.
[Nick Coghlan]
> And this could easily be extended to allow code both before and after
> the
On Mon, 13 Jun 2005 01:25:51 -0400, "Phillip J. Eby" <[EMAIL PROTECTED]> wrote:
>At 09:01 PM 6/12/2005 -0700, Guido van Rossum wrote:
>>If we have to do this, PEP 315 has my +0.
>>
>>It is Pythonically minimal and the motivation rings true: I've often
>>written code like this in the past:
>>
>>
Raymond Hettinger wrote:
> [BJörn Lindqvist]
>
>>I would like to have do-while's like this:
>>
>>do:
>>
>>until
>>
>>But I'm sure that has problems too.
>
>
> That looks nice to me.
And this could easily be extended to allow code both before and after
the 'until', giving a fully gene
>> do:
>>
>> until
> That looks nice to me.
Except this puts loop entry statement (do) and loop condition
test (until) on different levels of indentation, which is
I don't quite like.
Compared to the existing loop statements,
---
while Cond:
body
else:
exit
---
[BJörn Lindqvist]
> I would like to have do-while's like this:
>
> do:
>
> until
>
> But I'm sure that has problems too.
That looks nice to me.
Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listi
> In contrast, the dowhile solution only takes about 30 seconds to get
> used to. Maybe that idea should follow the path of the genexp PEP, get
> rejected now, and then get resurrected as a bright idea two years from
> now. Or maybe not.
dowhile foo != 42:
<10 lines of body>
foo = rando
> By the way, whatever happened to "and while"?
That is making something hard and weird out of something simple.
There were no shortage of odd suggestions to force the condition line
to appear lower in the block than the starting line. All of them
smelled of rotten eggs -- they just don't fit th
At 09:01 PM 6/12/2005 -0700, Guido van Rossum wrote:
>If we have to do this, PEP 315 has my +0.
>
>It is Pythonically minimal and the motivation rings true: I've often
>written code like this in the past:
>
> line = f.readline()
> while line:
>
> line = f.readline()
>
>But
Nick Coghlan <[EMAIL PROTECTED]> wrote:
>
> Raymond Hettinger wrote:
> > More than case-statement semantics or PEP343, I wish for a dowhile
> > statement.
> >
> > The most straight-forward way is to put the conditional expression at
> > the beginning of the block with the understanding that a do
On 6/12/05, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Raymond Hettinger wrote:
> > More than case-statement semantics or PEP343, I wish for a dowhile
> > statement.
> >
> > The most straight-forward way is to put the conditional expression at
> > the beginning of the block with the understanding th
Raymond Hettinger wrote:
> More than case-statement semantics or PEP343, I wish for a dowhile
> statement.
>
> The most straight-forward way is to put the conditional expression at
> the beginning of the block with the understanding that a dowhile keyword
> will evaluate the condition only after t
37 matches
Mail list logo