Daniel wrote:
> That's the form the specification is in, and it makes sense and is
> very readable.
> In pseudocode it looks like this, I am using @ to give loops a name:
>
> @loop1
> for c in configurations:
> @loop2
> while not_done:
> @loop3
> while step1_did_not_work:
I thought a bit about Carl's and Thomas' proposals, and it gave me an
idea how this problem could be approached:
Break is relatively easy to implement with a context manager that
returns an iterable that throws an exception specific to that context
manager:
with named_loop(i for i in range(10)) as
On Wednesday, August 31, 2011 8:51:45 AM UTC-7, Daniel wrote:
> Dear All,
>
> I have some complicated loops of the following form
>
> for c in configurations: # loop 1
> while nothing_bad_happened: # loop 2
> while step1_did_not_work: # loop 3
> for substeps in step1 # loo
On 9/1/2011 10:05 AM, Daniel wrote:
You seems to be requesting one of the options in
http://python.org/dev/peps/pep-3136/ Labeled break and continue
(The 'Other languages' section omits Fortran.)
The rejection post is at
http://mail.python.org/pipermail/python-3000/2007-July/008663.html
I basica
Am 01.09.2011 16:05 schrieb Daniel:
In pseudocode it looks like this, I am using @ to give loops a name:
@loop1
for c in configurations:
@loop2
while not_done:
@loop3
while step1_did_not_work:
@loop4
for substeps in step1 # loop 4a
Hi Steve,
Thanks for your comments, I appreciate any input.
> Do you think the software in the Apple iPod is "simple"? Or Microsoft
No, that's much more complicated that what I am doing.
But the iPod probably (?) doesn't get new algorithms based on a
specification discussed with non-programmers on
Chris Angelico wrote:
> Ah well, was worth a try. Raising exceptions smells wrong for this,
> but peppering your code with sentinel checks isn't much better. I
> don't really know what would be a good solution to this... except
> maybe this, which was proposed a few years ago and which I'd never
>
Daniel wrote:
> And I have to keep the code simple for non CS people to run
> the actual experiment.
Do you think the software in the Apple iPod is "simple"? Or Microsoft
Windows? No. You need to keep the *interface* simple. The internal details
can be as complicated as they are needed to be.
Sa
On Thu, Sep 1, 2011 at 5:07 AM, Daniel wrote:
>> Do you only ever have one top-level loop that you would be naming? If
> no, unfortunately not. The rough structure is several loops deep, and
> I need to break/continue/restart many of them.
> Continue is used more than break, because most of the ti
> Do you only ever have one top-level loop that you would be naming? If
no, unfortunately not. The rough structure is several loops deep, and
I need to break/continue/restart many of them.
Continue is used more than break, because most of the time that I find
some strange value, I'd just _continue
> one more idea, a kind of named loop:
interesting idea, thanks.
>
> When it become too complicate, I use state
> machine:http://en.wikipedia.org/wiki/Finite-state_machine
I unsuccessfully played a bit with a FSM, but there is a lot of data
that is passed around between the states and a lot of
On Thu, Sep 1, 2011 at 1:51 AM, Daniel wrote:
>
> Has anyone an idea on a nice way to write breaks/continues/redos for
> deeply
> nested loops?
>
Do you only ever have one top-level loop that you would be naming? If
so, put that loop into a function and use return instead of break.
Unfortunately
On Aug 31, 5:51 pm, Daniel wrote:
> Dear All,
>
> I have some complicated loops of the following form
>
> for c in configurations: # loop 1
> while nothing_bad_happened: # loop 2
> while step1_did_not_work: # loop 3
> for substeps in step1 # loop 4a
> # at t
13 matches
Mail list logo