On 23/01/2013 15:35, Jussi Piitulainen wrote:
Thomas Boell writes:
Using a keyword that has a well-understood meaning in just about
every other programming language on the planet *and even in
English*, redefining it to mean something completely different, and
then making the syntax look like th
On Wed, Jan 23, 2013 at 8:35 AM, Jussi Piitulainen
wrote:
>> The feature isn't bad, it's just very, very badly named.
>
> I believe it would read better - much better - if it was "for/then"
> and "while/then" instead of "for/else" and "while/else".
That's always been my opinion too. I'd remember
Thomas Boell writes:
> Using a keyword that has a well-understood meaning in just about
> every other programming language on the planet *and even in
> English*, redefining it to mean something completely different, and
> then making the syntax look like the original, well-understood
> meaning --
On Tue, 22 Jan 2013 17:28:35 -0800 (PST)
alex23 wrote:
> On Jan 23, 1:48 am, Thomas Boell wrote:
> > I must say, that's bound to be confusing for anyone who knows any
> > language other than Python (or none, even). Syntax like that is "an
> > accident waiting to happen"...
>
> No, ignorantly e
On Jan 23, 1:48 am, Thomas Boell wrote:
> I must say, that's bound to be confusing for anyone who knows any
> language other than Python (or none, even). Syntax like that is "an
> accident waiting to happen"...
No, ignorantly expecting every language to conform to every other is
the pending acci
it seems that lot of you are forgeting about this case:
for i in [1,2,3,4,5]:
print i
else:
print('this will be printed also because cycle wasnt broke')
so the one case when else branch is executed is when condition is not
satisfied and the other case is when there is no break executed du
On Tue, 22 Jan 2013 16:48:35 +0100, Thomas Boell wrote:
> On Wed, 23 Jan 2013 02:42:27 +1100
> Chris Angelico wrote:
>
>> On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell
>> wrote:
>> > Huh?! I would have expected all your examples to raise a SyntaxError
>> > or IndentationError. Why don't they? I
On Wed, Jan 23, 2013 at 2:48 AM, Thomas Boell wrote:
> On Wed, 23 Jan 2013 02:42:27 +1100
> Chris Angelico wrote:
>
>> On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell wrote:
>> > Huh?! I would have expected all your examples to raise a SyntaxError or
>> > IndentationError. Why don't they? Is 'else
On Wed, 23 Jan 2013 02:42:27 +1100
Chris Angelico wrote:
> On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell wrote:
> > Huh?! I would have expected all your examples to raise a SyntaxError or
> > IndentationError. Why don't they? Is 'else' not required to have a
> > matching 'if'?
>
> Other things
Duncan Booth wrote:
> Matching 'if' or 'for' or 'while'.
>
or of course 'try'.
--
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Boell wrote:
> Huh?! I would have expected all your examples to raise a SyntaxError or
> IndentationError. Why don't they? Is 'else' not required to have a
> matching 'if'?
>
Matching 'if' or 'for' or 'while'.
See
http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-sta
On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell wrote:
> Huh?! I would have expected all your examples to raise a SyntaxError or
> IndentationError. Why don't they? Is 'else' not required to have a
> matching 'if'?
Other things can have else, including 'for' and 'while' loops. :)
ChrisA
--
http:/
On Mon, 21 Jan 2013 06:07:08 +0100
René Klačan wrote:
> Examples:
>
> # else branch will be executed
> i = 0
> while i < 5:
> i += 1
> else:
> print('loop is over')
>
>
> # else branch will be executed
> i = 0
> while i < 5:
> i += 1
> if i == 7:
> print('i == 7')
>
On Tue, Jan 22, 2013 at 2:37 AM, eli m wrote:
> Thank you, that solved my problem. Sorry for my posts, i am a noob and this
> is my first time posting on here.
There's nothing wrong with being a noob, we all start out that way.
Want to be one of the people we love to help? Here are some tips:
h
On Sunday, January 20, 2013 9:56:59 PM UTC-8, alex23 wrote:
> On Jan 21, 2:40 pm, eli m wrote:
>
> > an else statement is running when it shouldnt be. It is
>
> > on the last line. Whenever i am in the math or game
>
> > function, when i type in main, it goes back to the start
>
> > of the pro
On Sun, 20 Jan 2013 22:00:10 -0800, alex23 wrote:
> On Jan 21, 2:54 pm, eli m wrote:
>> hint: Use the comments in the code to find out where my error is.
>
> Pro-tip: when people you're asking for help tell you how you can make it
> easier for them to help you, a snide response isn't the correct
On 01/20/2013 11:59 PM, eli m wrote:
>>
>>
>>
>> Your else is lined up with while, not with if.
>>
>>
>>
>> -m
>>
>>
>>
>>
>>
>> --
>>
>> Lark's Tongue Guide to Python: http://lightbird.net/larks/
>>
>>
>>
>> When a friend succeeds, I die a little. Gore Vidal
> Its lined up. It got messed up wh
On Jan 21, 2:54 pm, eli m wrote:
> hint: Use the comments in the code to find out where my error is.
Pro-tip: when people you're asking for help tell you how you can make
it easier for them to help you, a snide response isn't the correct
approach.
--
http://mail.python.org/mailman/listinfo/pytho
On Jan 21, 2:40 pm, eli m wrote:
> an else statement is running when it shouldnt be. It is
> on the last line. Whenever i am in the math or game
> function, when i type in main, it goes back to the start
> of the program, but it also says not a valid function.
> I am stumped!
Here is your code wi
On Jan 21, 2:59 pm, eli m wrote:
> Its lined up. It got messed up when i copied the code into the post.
Sorry, we're not going to take your word for it. Reduce it to the
minimal amount of code that reproduces your error and post that.
--
http://mail.python.org/mailman/listinfo/python-list
Examples:
# else branch will be executed
i = 0
while i < 5:
i += 1
else:
print('loop is over')
# else branch will be executed
i = 0
while i < 5:
i += 1
if i == 7:
print('i == 7')
break
else:
print('loop is over')
# else branch wont be executed
i = 0
while i
Examples:
# else branch will be executed
i = 0
while i < 5:
i += 1
else:
print('loop is over')
# else branch will be executed
i = 0
while i < 5:
i += 1
if i == 7:
print('i == 7')
break
else:
print('loop is over')
# else branch wont be executed
i = 0
while i
On 01/20/2013 11:40 PM, eli m wrote:
an else statement is running when it shouldnt be. It is on the last line. Whenever i am in the math
or game function, when i type in main, it goes back to the start of the
program, but it also says not a valid function. I am stumped!
> Here is my code:
> #C
On Sunday, January 20, 2013 8:52:12 PM UTC-8, Chris Angelico wrote:
> On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote:
>
> > an else statement is running when it shouldnt be. It is on the last line.
> > Whenever i am in the math or game function, when i type in main, it goes
> > back to the start
On Sunday, January 20, 2013 8:40:47 PM UTC-8, eli m wrote:
hint: Use the comments in the code to find out where my error is.
>
> Here is my code:
>
> #Cmd
>
> #Created By Eli M.
>
> #import modules
>
> import random
>
> import math
>
> gtn = 0
>
> print ("Type in help for a list of cmd fun
>
>
>
> Your else is lined up with while, not with if.
>
>
>
> -m
>
>
>
>
>
> --
>
> Lark's Tongue Guide to Python: http://lightbird.net/larks/
>
>
>
> When a friend succeeds, I die a little. Gore Vidal
Its lined up. It got messed up when i copied the code into the post.
--
ht
You have to break while loop not to execute else branch
Rene
On Mon, Jan 21, 2013 at 5:40 AM, eli m wrote:
> an else statement is running when it shouldnt be. It is on the last line.
> Whenever i am in the math or game function, when i type in main, it goes
> back to the start of the program, b
On Sunday, January 20, 2013 8:54:13 PM UTC-8, René Klačan wrote:
> You have to break while loop not to execute else branch
>
>
> Rene
>
>
>
Can you explain in more detail please.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jan 21, 2013 at 3:40 PM, eli m wrote:
> an else statement is running when it shouldnt be. It is on the last line.
> Whenever i am in the math or game function, when i type in main, it goes back
> to the start of the program, but it also says not a valid function. I am
> stumped!
Check
In article <2cc6791f-ba56-406c-a5b0-b23023caf...@googlegroups.com>,
eli m wrote:
> an else statement is running when it shouldnt be. It is on the last line.
> Whenever i am in the math or game function, when i type in main, it goes back
> to the start of the program, but it also says not a val
an else statement is running when it shouldnt be. It is on the last line.
Whenever i am in the math or game function, when i type in main, it goes back
to the start of the program, but it also says not a valid function. I am
stumped!
Here is my code:
#Cmd
#Created By Eli M.
#import modules
impo
31 matches
Mail list logo