Re: Python Idle not giving my prompt after If line

2018-04-09 Thread T Berger
On Monday, April 9, 2018 at 1:19:13 PM UTC-4, Terry Reedy wrote:
> On 4/9/2018 3:07 AM, Peter Otten wrote:
> > brg...@gmail.com wrote:
> > 
> >> I typed the If part of an If/Else statement, but did not get a prompt at
> >> the beginning of the next line when I hit return. Instead, the cursor
> >> lined up under the "p" of "print." Here is the line of text (it's part of
> >> a longer bit of coding, I copied out of a textbook).
> >>
> > if right_this_minute in odds:
> >> print("This minute seems a little odd.")[Return]
> >>
> >> You can't see it, but the cursor is blinking under the "p."
> >>
> >> Why is this happening and what's the fix?
> 
> > It works as designed; the interpreter has no way of knowing whether you are
> > about to write another line belonging to the if suite, like in
> > 
> > if foo:
> > print("clearing foo")
> > foo = False
> 
> To enter 'else', instead of another line under 'if', hit backspace.
> 
> > That's why you have to hit  twice to trigger execution of the code.
> 
> When you are done entering the complete multiline statement.
> 
> > By the way, when you copy (or write) a "longer bit" I recomend that you put
> > the code into a py file so that you don't have to retype it when you want to
> > make a small modification. Instead you can just hit F5 and see the effect of
> > your changes.
> 
> -- 
> Terry Jan Reedy

Thanks, Terry, for your help. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread T Berger
On Monday, April 9, 2018 at 1:34:04 PM UTC-4, Peter Otten wrote:
> brg...@gmail.com wrote:
> 
> > On Monday, April 9, 2018 at 3:08:28 AM UTC-4, Peter Otten wrote:
> >> brg...@gmail.com wrote:
> >> 
> >> > I typed the If part of an If/Else statement, but did not get a prompt
> >> > at the beginning of the next line when I hit return. Instead, the
> >> > cursor lined up under the "p" of "print." Here is the line of text
> >> > (it's part of a longer bit of coding, I copied out of a textbook).
> >> > 
> >>  if right_this_minute in odds:
> >> >print("This minute seems a little odd.")[Return]
> >> > 
> >> > You can't see it, but the cursor is blinking under the "p."
> >> > 
> >> > Why is this happening and what's the fix?
> >> > 
> >> > Thanks,
> >> > 
> >> > Tamara
> >> 
> >> It works as designed; the interpreter has no way of knowing whether you
> >> are about to write another line belonging to the if suite, like in
> >> 
> >> if foo:
> >>print("clearing foo")
> >>foo = False
> >> 
> >> That's why you have to hit  twice to trigger execution of the
> >> code.
> >> 
> >> By the way, when you copy (or write) a "longer bit" I recomend that you
> >> put the code into a py file so that you don't have to retype it when you
> >> want to make a small modification. Instead you can just hit F5 and see
> >> the effect of your changes.
> > 
> > Thanks, Peter, for your quick reply. But here's what happened. When I hit
> >  twice, the cursor did go back to the margin, but skipped two
> > lines before doing so. Then when I hit  after "else:" I got an
> > error message again. What did I do wrong? 
> 
> I'm sorry, I did not read your question carefully enough, and missed the 
> "else" part. Please read Terry's correction of my advice.
> 
> > Also, could you please tell me
> > how to create a py file. Thanks.
> 
> Choose "New File" in the "File" menu, then write your code in the window 
> that pops up, save with "Save" (pick a meaningful name that does not collide 
> with any name in Python's standard library) and finally run with "Run 
> Module" in the "Run" menu.

Thanks, Peter, for your help. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread Peter Otten
brg...@gmail.com wrote:

> On Monday, April 9, 2018 at 3:08:28 AM UTC-4, Peter Otten wrote:
>> brg...@gmail.com wrote:
>> 
>> > I typed the If part of an If/Else statement, but did not get a prompt
>> > at the beginning of the next line when I hit return. Instead, the
>> > cursor lined up under the "p" of "print." Here is the line of text
>> > (it's part of a longer bit of coding, I copied out of a textbook).
>> > 
>>  if right_this_minute in odds:
>> >print("This minute seems a little odd.")[Return]
>> > 
>> > You can't see it, but the cursor is blinking under the "p."
>> > 
>> > Why is this happening and what's the fix?
>> > 
>> > Thanks,
>> > 
>> > Tamara
>> 
>> It works as designed; the interpreter has no way of knowing whether you
>> are about to write another line belonging to the if suite, like in
>> 
>> if foo:
>>print("clearing foo")
>>foo = False
>> 
>> That's why you have to hit  twice to trigger execution of the
>> code.
>> 
>> By the way, when you copy (or write) a "longer bit" I recomend that you
>> put the code into a py file so that you don't have to retype it when you
>> want to make a small modification. Instead you can just hit F5 and see
>> the effect of your changes.
> 
> Thanks, Peter, for your quick reply. But here's what happened. When I hit
>  twice, the cursor did go back to the margin, but skipped two
> lines before doing so. Then when I hit  after "else:" I got an
> error message again. What did I do wrong? 

I'm sorry, I did not read your question carefully enough, and missed the 
"else" part. Please read Terry's correction of my advice.

> Also, could you please tell me
> how to create a py file. Thanks.

Choose "New File" in the "File" menu, then write your code in the window 
that pops up, save with "Save" (pick a meaningful name that does not collide 
with any name in Python's standard library) and finally run with "Run 
Module" in the "Run" menu.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread Terry Reedy

On 4/9/2018 3:07 AM, Peter Otten wrote:

brg...@gmail.com wrote:


I typed the If part of an If/Else statement, but did not get a prompt at
the beginning of the next line when I hit return. Instead, the cursor
lined up under the "p" of "print." Here is the line of text (it's part of
a longer bit of coding, I copied out of a textbook).


if right_this_minute in odds:

print("This minute seems a little odd.")[Return]

You can't see it, but the cursor is blinking under the "p."

Why is this happening and what's the fix?



It works as designed; the interpreter has no way of knowing whether you are
about to write another line belonging to the if suite, like in

if foo:
print("clearing foo")
foo = False


To enter 'else', instead of another line under 'if', hit backspace.


That's why you have to hit  twice to trigger execution of the code.


When you are done entering the complete multiline statement.


By the way, when you copy (or write) a "longer bit" I recomend that you put
the code into a py file so that you don't have to retype it when you want to
make a small modification. Instead you can just hit F5 and see the effect of
your changes.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread brgrt2
On Monday, April 9, 2018 at 3:08:28 AM UTC-4, Peter Otten wrote:
> brg...@gmail.com wrote:
> 
> > I typed the If part of an If/Else statement, but did not get a prompt at
> > the beginning of the next line when I hit return. Instead, the cursor
> > lined up under the "p" of "print." Here is the line of text (it's part of
> > a longer bit of coding, I copied out of a textbook).
> > 
>  if right_this_minute in odds:
> >print("This minute seems a little odd.")[Return]
> > 
> > You can't see it, but the cursor is blinking under the "p."
> > 
> > Why is this happening and what's the fix?
> > 
> > Thanks,
> > 
> > Tamara
> 
> It works as designed; the interpreter has no way of knowing whether you are 
> about to write another line belonging to the if suite, like in
> 
> if foo:
>print("clearing foo")
>foo = False
> 
> That's why you have to hit  twice to trigger execution of the code.
> 
> By the way, when you copy (or write) a "longer bit" I recomend that you put 
> the code into a py file so that you don't have to retype it when you want to 
> make a small modification. Instead you can just hit F5 and see the effect of 
> your changes.

Thanks, Peter, for your quick reply. But here's what happened. When I hit 
 twice, the cursor did go back to the margin, but skipped two lines 
before doing so. Then when I hit  after "else:" I got an error message 
again. What did I do wrong? 
Also, could you please tell me how to create a py file. Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread Peter Otten
brg...@gmail.com wrote:

> I typed the If part of an If/Else statement, but did not get a prompt at
> the beginning of the next line when I hit return. Instead, the cursor
> lined up under the "p" of "print." Here is the line of text (it's part of
> a longer bit of coding, I copied out of a textbook).
> 
 if right_this_minute in odds:
>print("This minute seems a little odd.")[Return]
> 
> You can't see it, but the cursor is blinking under the "p."
> 
> Why is this happening and what's the fix?
> 
> Thanks,
> 
> Tamara

It works as designed; the interpreter has no way of knowing whether you are 
about to write another line belonging to the if suite, like in

if foo:
   print("clearing foo")
   foo = False

That's why you have to hit  twice to trigger execution of the code.

By the way, when you copy (or write) a "longer bit" I recomend that you put 
the code into a py file so that you don't have to retype it when you want to 
make a small modification. Instead you can just hit F5 and see the effect of 
your changes.

-- 
https://mail.python.org/mailman/listinfo/python-list