On Wed, Jun 26, 2013 at 10:47 AM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
On Tue, 25 Jun 2013 17:20:43 +1000, Neil Hodgson nhodg...@iinet.net.au
declaimed the following:
jim...@aol.com:
Syntax:
fwhile X in ListY and conditionZ:
There is precedent in Algol 68:
for i from 0 to n
On Wednesday, 26 June 2013 01:40:22 UTC+1, Dennis Lee Bieber wrote:
(hmmm, does any
language have a continue that can go to the next iteration of an outer
loop?)
Perl allows next with a label:
perldoc -f next
next LABEL
nextThe next command is like the continue statement in C; it
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my experience the sorts of people who preach one exit point are
also all about defining preconditions and postconditions and proving
that the postconditions follow from the preconditions. I think that
the two are linked, because
On 26 Jun 2013 11:45, jim...@aol.com wrote:
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my experience the sorts of people who preach one exit point are
also all about defining preconditions and postconditions and proving
that the postconditions follow from the
On Tue, 25 Jun 2013 12:39:53 -0400, jimjhb wrote:
I just checked and MISRA-C 2012 now allows gotos in specific, limited
circumstances. I think it was the MISRA-C 1998 standard that caused all
this trouble. So if MISRA now allows goto, why not Python :)
[humour]
You can! Just use the
On 2013-06-25, rusi rustompm...@gmail.com wrote:
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my experience the sorts of people who preach one exit point are
also all about defining preconditions and postconditions and proving
that the postconditions follow from the
On Wednesday, June 26, 2013 6:03:39 PM UTC+5:30, Steven D'Aprano wrote:
On Tue, 25 Jun 2013 12:39:53 -0400, jimjhb wrote:
I just checked and MISRA-C 2012 now allows gotos in specific, limited
circumstances. I think it was the MISRA-C 1998 standard that caused all
this trouble.
On Tuesday, June 25, 2013 10:09:53 PM UTC+5:30, jim...@aol.com wrote:
I just checked and MISRA-C 2012 now allows gotos in specific, limited
circumstances. I think it was the MISRA-C 1998 standard that caused all this
trouble. So if MISRA now allows goto, why not Python :)
Not sure who
On Jun 26, 2013, at 7:49 AM, Fábio Santos fabiosantos...@gmail.com wrote:
On 26 Jun 2013 11:45, jim...@aol.com wrote:
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my experience the sorts of people who preach one exit point are
also all about defining preconditions and
Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
On Mon, 24 Jun 2013 19:01:11 -0700 (PDT), rusi rustompm...@gmail.com
declaimed the following:
On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 5:52 AM, wrote:
(NOTE: Many people are being taught
On 26.06.2013 16:28, William Ray Wing wrote:
On Jun 26, 2013, at 7:49 AM, Fábio Santos fabiosantos...@gmail.com
mailto:fabiosantos...@gmail.com wrote:
On 26 Jun 2013 11:45, jim...@aol.com mailto:jim...@aol.com wrote:
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my
On Tuesday, June 25, 2013 4:44:44 AM UTC+5:30, alex23 wrote:
I'd probably just go with a generator expression to feed the for loop:
for X in (i for i in ListY if conditionZ):
Nice idiom -- thanks
Yes it does not correspond to a takewhile (or break in the control
On Tue, Jun 25, 2013 at 2:20 PM, Benjamin Kaplan
benjamin.kap...@case.edu wrote:
On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 25, 2013 at 12:01 PM, rusi rustompm...@gmail.com wrote:
On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote:
On
jim...@aol.com:
Syntax:
fwhile X in ListY and conditionZ:
There is precedent in Algol 68:
for i from 0 to n while safe(i) do .. od
which would also make a python proposal that needs no new key words:
for i in range(n) while safe(i): ..
The benefit of the syntax would be to
On 25 June 2013 00:13, Tim Chase python.l...@tim.thechases.com wrote:
On 2013-06-24 23:39, Fábio Santos wrote:
On 24 Jun 2013 23:35, Tim Chase wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement
On 24 June 2013 23:50, Chris Angelico ros...@gmail.com wrote:
In more free-form languages, I implement this by simply omitting a line-break:
...
Python could afford to lose a little rigidity here rather than gain
actual new syntax:
for i in range(10): if i%3:
print(i)
And there you
Syntax:
fwhile X in ListY and conditionZ:
There is precedent in Algol 68:
for i from 0 to n while safe(i) do .. od
which would also make a python proposal that needs no new key words:
for i in range(n) while safe(i): ..
The benefit of the syntax would be to concentrate the
On Mon, Jun 24, 2013 at 11:45:57PM +0100, MRAB wrote:
On 24/06/2013 23:35, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax
Ian,
Regarding your first message breaks are anathema (for many) and your other
alternative is complicated.
Regarding your second post, anding of lists is allowed, but generally returns
non-utile results, but point taken.
I guess technically it could be the last statement, with the condition
On 6/25/2013 7:17 AM, jim...@aol.com wrote:
for i in range(n) while safe(i): ..
Combined for-while and for-if statements have been proposed before and
rejected. We cannot continuously add simple compositions to the langauge.
I disagree. The problem IMO is that python 'for's are a
On Mon, Jun 24, 2013 at 2:33 PM, jim...@aol.com wrote:
Ian,
Regarding your first message breaks are anathema (for many) and your other
alternative is complicated.
Regarding your second post, anding of lists is allowed, but generally
returns non-utile results, but point taken.
I guess
On Tue, Jun 25, 2013 at 1:21 AM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 25, 2013 at 2:20 PM, Benjamin Kaplan
benjamin.kap...@case.edu wrote:
The reason I was given (which I promptly ignored, of course) is that
it's best practice to only have one exit point for a block of code.
On Tuesday, June 25, 2013 9:30:54 PM UTC+5:30, Ian wrote:
In my experience the sorts of people who preach one exit point are
also all about defining preconditions and postconditions and proving
that the postconditions follow from the preconditions. I think that
the two are linked, because the
Syntax:
fwhile X in ListY and conditionZ:
The following would actually exactly as: for X in ListY:
fwhile X in ListY and True:
fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.
The motivation is to be able to make use of all the great
On Mon, Jun 24, 2013 at 1:52 PM, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
The following would actually exactly as: for X in ListY:
fwhile X in ListY and True:
fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.
On Mon, Jun 24, 2013 at 1:52 PM, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
Also, this syntax is ambiguous. Take for example the statement:
fwhile X in ListA and ListB and ListC and ListD:
At which and does the iterable expression stop and the condition
expression
On Mon, Jun 24, 2013 at 8:52 PM, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
The following would actually exactly as: for X in ListY:
fwhile X in ListY and True:
fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.
On 24 June 2013 20:52, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
The following would actually exactly as: for X in ListY:
fwhile X in ListY and True:
fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.
The
: Is this PEP-able? fwhile
On 24 June 2013 20:52, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
The following would actually exactly as: for X in ListY:
fwhile X in ListY and True:
fwhile would act much like 'for', but would stop if the condition after
Your syntax makes great sense. Avoiding new keywords is obviously preferable.
-Original Message-
From: Fábio Santos fabiosantos...@gmail.com
To: jimjhb jim...@aol.com
Cc: python-list python-list@python.org
Sent: Mon, Jun 24, 2013 4:34 pm
Subject: Re: Is this PEP-able? fwhile
On Mon
On Mon, Jun 24, 2013 at 3:01 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos fabiosantos...@gmail.com
wrote:
This can probably be best achieved by adding to the existing for loop,
so maybe taking advantage of the existing for...if syntax and adding
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos fabiosantos...@gmail.com wrote:
This can probably be best achieved by adding to the existing for loop,
so maybe taking advantage of the existing for...if syntax and adding
for...while would be a better idea?
The for...if syntax only exists for
On Tue, Jun 25, 2013 at 5:52 AM, jim...@aol.com wrote:
(NOTE: Many people are being taught to avoid 'break' and 'continue' at all
costs...
Why? Why on earth should break/continue be avoided? I think that's the
solution: teach people that loops are there to be interrupted and
manipulated. And
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
break/continue when appropriate.
from minor_gripes import breaking_out_of_nested_loops_to_top_level
-tkc
--
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
break/continue when appropriate.
from
On Mon, Jun 24, 2013 at 4:41 PM, Fábio Santos fabiosantos...@gmail.com wrote:
On 24 Jun 2013 22:29, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos fabiosantos...@gmail.com
wrote:
This can probably be best achieved by adding to the existing for loop,
On 24 Jun 2013 23:35, Tim Chase python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
break/continue when appropriate.
from minor_gripes
On 24 Jun 2013 22:29, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos fabiosantos...@gmail.com
wrote:
This can probably be best achieved by adding to the existing for loop,
so maybe taking advantage of the existing for...if syntax and adding
for...while
On Mon, Jun 24, 2013 at 4:35 PM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it
On 24/06/2013 23:35, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
On 25 Jun 2013 00:04, MRAB pyt...@mrabarnett.plus.com wrote:
On 24/06/2013 23:35, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 8:30 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
On 24/06/2013 23:30, Tim Chase wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
break/continue when appropriate.
from minor_gripes import
On 2013-06-24 23:39, Fábio Santos wrote:
On 24 Jun 2013 23:35, Tim Chase wrote:
On 2013-06-25 07:38, Chris Angelico wrote:
Python has no issues with breaking out of loops, and even has
syntax specifically to complement it (the 'else:' clause). Use
break/continue when appropriate.
On Tue, Jun 25, 2013 at 8:43 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 24, 2013 at 4:41 PM, Fábio Santos fabiosantos...@gmail.com
wrote:
On 24 Jun 2013 22:29, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos fabiosantos...@gmail.com
wrote:
On 25 Jun 2013 00:06, Fábio Santos fabiosantos...@gmail.com wrote:
I like how discussions on this list tend to go off topic ;)
And now I'm off topic myself :(
--
http://mail.python.org/mailman/listinfo/python-list
On 25/06/2013 6:12 AM, Ian Kelly wrote:
On Mon, Jun 24, 2013 at 1:52 PM, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
fwhile would act much like 'for', but would stop if the condition after the
'and' is no longer True.
I would advocate using the break myself. Another
On 25 Jun 2013 00:31, alex23 wuwe...@gmail.com wrote:
On 25/06/2013 6:12 AM, Ian Kelly wrote:
On Mon, Jun 24, 2013 at 1:52 PM, jim...@aol.com wrote:
Syntax:
fwhile X in ListY and conditionZ:
fwhile would act much like 'for', but would stop if the condition after
the
'and' is no longer
On 25/06/2013 9:35 AM, Fábio Santos wrote:
I'd probably just go with a generator expression to feed the for loop:
for X in (i for i in ListY if conditionZ):
That is nice but it's not lazy. If the condition or the iterables took
too long to compute, it would be
On 25 Jun 2013 01:08, alex23 wuwe...@gmail.com wrote:
On 25/06/2013 9:35 AM, Fábio Santos wrote:
I'd probably just go with a generator expression to feed the for loop:
for X in (i for i in ListY if conditionZ):
That is nice but it's not lazy. If the condition or
On Tue, Jun 25, 2013 at 10:19 AM, Fábio Santos fabiosantos...@gmail.com
wrote:
for X in (i for i in open('largefile') if is_part_of_header(i)):
The above code would be wasting time on IO and processing. It would load
another line and calculate the condition for every line of the large file
On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 5:52 AM, wrote:
(NOTE: Many people are being taught to avoid 'break' and 'continue' at all
costs...
Why? Why on earth should break/continue be avoided?
Because breaks and continues are just
On Tue, Jun 25, 2013 at 12:01 PM, rusi rustompm...@gmail.com wrote:
On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 5:52 AM, wrote:
(NOTE: Many people are being taught to avoid 'break' and 'continue' at all
costs...
Why? Why on earth should
On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 25, 2013 at 12:01 PM, rusi rustompm...@gmail.com wrote:
On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote:
On Tue, Jun 25, 2013 at 5:52 AM, wrote:
(NOTE: Many people are being taught to
On Mon, Jun 24, 2013 at 6:41 PM, wu wei wuwe...@gmail.com wrote:
It's still possible by raising a StopIteration within the condition
function:
def is_part_of_header(x):
if header_condition:
return True
else:
raise StopIteration
Which is
54 matches
Mail list logo