Paul McGuire wrote:
On Aug 17, 1:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
Kurien Mathew wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (
On Aug 17, 1:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
> Kurien Mathew wrote:
> > Hello,
>
> > Any suggestions on a good python equivalent for the following C code:
>
> > while (loopCondition)
> > {
> > if (condition1)
> > goto next;
> > if (condition2)
> > goto
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of Kurien Mathew
> Sent: Saturday, August 16, 2008 5:21 PM
> To: python-list@python.org
> Subject: Good python equivalent to C goto
>
> Hello,
>
> Any suggestions on a good python equivalent for
Kurien Mathew wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (condition3)
goto next;
stmt1;
stmt2;
next:
stmt3;
stmt4;
}
s
On Sun, 17 Aug 2008 09:08:35 -0500, Grant Edwards wrote:
> In Python one uses try/raise/except.
At the risk of introducing an anachronism and in deference to
Mr. "ElementTree" Lundh, I now invoke Godwin's Law (1990):
Isn't *try/except* kinda sorta like the musty, old *come from*
construct propos
as mentioned 'in complex code the goto statement is still the easiest
to code and understand'.
The examples are very small and do not require that at all. I agree
it's ugly.
Just to show a way to do it.
A very few functions where I use goto in C or C# are a few hundred
lines of code, difficult t
[EMAIL PROTECTED] wrote:
The goto code is the simpler way to do it.
We are not talking about simple if-else, but let say 20 if-else.
Many nested if-else are more difficult to understand and do not fit
better the semantics.
let's see...
$ cd ~/svn/python25
$ grep goto */*.c | wc
210770
On Aug 17, 9:23 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
> >> Kurien Mathew wrote:
> >>> Hello,
> >>> Any suggestions on a good python equivalent for the following C code:
> >>> while (loopCo
On Aug 16, 11:20 pm, Kurien Mathew <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Any suggestions on a good python equivalent for the following C code:
>
> while (loopCondition)
> {
> if (condition1)
> goto next;
> if (condition2)
> goto next;
> if (
[EMAIL PROTECTED] wrote:
On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
Kurien Mathew wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
On Aug 17, 8:09 pm, Matthew Fitzgibbons <[EMAIL PROTECTED]> wrote:
> Kurien Mathew wrote:
> > Hello,
>
> > Any suggestions on a good python equivalent for the following C code:
>
> > while (loopCondition)
> > {
> > if (condition1)
> > goto next;
> > if (condition2)
> > goto
Kurien Mathew wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (condition3)
goto next;
stmt1;
stmt2;
next:
stmt3;
stmt4;
}
On 2008-08-16, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>> Hello,
>>
>> Any suggestions on a good python equivalent for the following C code:
>>
>> while (loopCondition)
>>
On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew wrote:
> Any suggestions on a good python equivalent for the following C code:
>
> while (loopCondition)
> {
> if (condition1)
> goto next;
> if (condition2)
> goto next;
> if (condition3)
>
as an oldtimer, I know that in complex code the goto statement is
still the easiest to code and understand.
I propose this solution using exception.
The string exception is deprecated but is simpler for this example.
# DeprecationWarning: raising a string exception is deprecated
def Goto_is_n
On Aug 17, 12:35 am, Michael Torrie <[EMAIL PROTECTED]> wrote:
> However it's not necessary in python to do any of this, since you can
> define nested functions that have access to the parent scope. Anytime
> you need to clean up, just call the nested cleanup function and then return.
That is unn
Michael Torrie wrote:
> I think the most direct translation would be this:
Nevermind I forgot about the while loop and continuing on after it.
Guess the function doesn't quite fit this use case after all.
--
http://mail.python.org/mailman/listinfo/python-list
Kurien Mathew wrote:
> Hello,
>
> Any suggestions on a good python equivalent for the following C code:
>
> while (loopCondition)
> {
> if (condition1)
> goto next;
> if (condition2)
> goto next;
> if (condition3)
> goto next;
> st
Dennis Lee Bieber wrote:
> Nasty code even for C... I've never used goto in C... Options:
> convert the statements of next into a function, and put in an else
> clause...
I think the parent post's pseudocode example was too simple to show the
real benefits and use cases of goto in C. Obviou
Kurien Mathew wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
There are various ways to write your example in Python. For example
while loopCondition:
condition = 1
while condition:
if condition1:
break
if condition2:
Kurien Mathew schrieb:
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (condition3)
goto next;
stmt1;
stmt2;
next:
stmt3;
stmt4;
}
while
Kurien Mathew wrote:
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (condition3)
goto next;
stmt1;
stmt2;
next:
stmt3;
stmt4;
}
seems as
On Sat, 16 Aug 2008 23:20:52 +0200, Kurien Mathew <[EMAIL PROTECTED]> wrote:
Hello,
Any suggestions on a good python equivalent for the following C code:
while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (con
23 matches
Mail list logo