[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks a lot Guido and Emily for guidance on this issue. Happy to see this for alpha release :) -- ___ Python tracker ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Change by Emily Morehouse : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Emily Morehouse added the comment: New changeset ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24 by Emily Morehouse in branch 'master': bpo-35877: Add test for while loop named expression without parentheses (GH-11726)

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Emily Morehouse added the comment: Thanks, Karthikeyan! I added an additional test to make sure this gets coverage. I'll close out this issue once tests pass and I can merge that. -- ___ Python tracker

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Change by Emily Morehouse : -- pull_requests: +11608, 11609, 11610 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Change by Emily Morehouse : -- pull_requests: +11608 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Change by Emily Morehouse : -- pull_requests: +11608, 11609 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse
Emily Morehouse added the comment: New changeset d4fceaafb8e3f8700d9ec6ab37a51e903392f74f by Emily Morehouse (Xtreak) in branch 'master': bpo-35877: Make parenthesis optional for named expression in while statement (GH-11724) https://github.com/python/cpython/commit

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch, patch, patch pull_requests: +11603, 11604, 11605 stage: needs patch -> patch review ___ Python tracker ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch, patch pull_requests: +11603, 11604 stage: needs patch -> patch review ___ Python tracker ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +11603 stage: needs patch -> patch review ___ Python tracker ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: > Thanks, Karthikeyan! Can you submit that as a PR? Sure, I will submit the patch with tests for the same. Thanks -- ___ Python tracker

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks, Karthikeyan! Can you submit that as a PR? -- ___ Python tracker ___ ___

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: > Emily, I think this would be as simple as making a tiny change to > Grammar/Grammar and running make regen-grammar. Can you take care of that? Thanks, can confirm that this fixes the issue. I changed test to namedexpr_test for while sta

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Guido van Rossum
Guido van Rossum added the comment: Emily, I think this would be as simple as making a tiny change to Grammar/Grammar and running make regen-grammar. Can you take care of that? -- assignee: -> emilyemorehouse stage: -> needs patch ___ Python

[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan
using named expressions in while statement which makes some of the examples invalid like https://www.python.org/dev/peps/pep-0572/#sysconfig-py . From my limited knowledge while statement Grammar was not modified at https://github.com/python/cpython/pull/10497/files#diff

Re: About python while statement and pop()

2014-06-12 Thread hito koto
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print

Re: About python while statement and pop()

2014-06-12 Thread hito koto
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print

Re: About python while statement and pop()

2014-06-12 Thread hito koto
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print

Re: About python while statement and pop()

2014-06-12 Thread Mark H Harris
On 6/11/14 10:12 PM, hito koto wrote: i want to change this is code: def foo(x): y = [] while x !=[]: y.append(x.pop()) return y Consider this generator (all kinds of permutations on the idea): L1 [1, 2, 3, 4, 5, 6, 7] def poplist(L): while True:

Re: About python while statement and pop()

2014-06-12 Thread Mark H Harris
On 6/11/14 10:12 PM, hito koto wrote: def foo(x): y = [] while x !=[]: y.append(x.pop()) return y Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L =

Re: About python while statement and pop()

2014-06-12 Thread Chris Angelico
On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris harrismh...@gmail.com wrote: Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True

Re: About python while statement and pop()

2014-06-12 Thread Marko Rauhamaa
while done==False: Correction: while not done: Better Python and not bad English, either. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: About python while statement and pop()

2014-06-12 Thread Mark H Harris
On 6/12/14 11:55 AM, Marko Rauhamaa wrote: while not done: Better Python and not bad English, either. ... and taking Marko's good advice, what I think you really wanted: def poplist(L): done = False while not done: yield L[::-1][:1:] L =

Re: About python while statement and pop()

2014-06-12 Thread Mark H Harris
On 6/12/14 11:57 AM, Chris Angelico wrote: On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris harrismh...@gmail.com wrote: Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L =

Re: About python while statement and pop()

2014-06-12 Thread Mark H Harris
On 6/12/14 11:57 AM, Chris Angelico wrote: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True Why not just while L? OK, here it is with Chris' excellent

Python deepcopy to while statement

2014-06-12 Thread hito koto
Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x): if not isinstance(x, list): return x return [foo(y) for y in x

Re: Python deepcopy to while statement

2014-06-12 Thread hito koto
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto: Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x

Re: Python deepcopy to while statement

2014-06-12 Thread hito koto
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto: Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x

About python while statement and pop()

2014-06-11 Thread hito koto
Hello,all I'm first time, I want to make a while statement which can function the same x.pop () and without the use of pop、how can i to do? i want to change this is code: def foo(x): y = [] while x !=[]: y.append(x.pop()) return y -- https://mail.python.org/mailman

Re:About python while statement and pop()

2014-06-11 Thread Dave Angel
hito koto hitokoto2...@gmail.com Wrote in message: Hello,all I'm first time, I want to make a while statement which can function the same x.pop () and without the use of pop、how can i to do? No idea what the question means. Are you just trying to rewrite the loop in a python

Re: About python while statement and pop()

2014-06-11 Thread Vincent Vande Vyvre
Le 12/06/2014 05:12, hito koto a écrit : Hello,all I'm first time, I want to make a while statement which can function the same x.pop () and without the use of pop、how can i to do? i want to change this is code: def foo(x): y = [] while x !=[]: y.append(x.pop

Re: About python while statement and pop()

2014-06-11 Thread Chris Angelico
On Thu, Jun 12, 2014 at 1:40 PM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 12/06/2014 05:12, hito koto a écrit : Hello,all I'm first time, I want to make a while statement which can function the same x.pop () and without the use of pop、how can i to do? i want to change

Re: About python while statement and pop()

2014-06-11 Thread hito koto
2014年6月12日木曜日 12時58分27秒 UTC+9 Chris Angelico: On Thu, Jun 12, 2014 at 1:40 PM, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 12/06/2014 05:12, hito koto a écrit : Hello,all I'm first time, I want to make a while statement which can function the same x.pop

Re: About python while statement and pop()

2014-06-11 Thread Chris Angelico
On Thu, Jun 12, 2014 at 2:56 PM, hito koto hitokoto2...@gmail.com wrote: I want to use while statement, This sounds like homework. Go back to your teacher/tutor for assistance, rather than asking us to do the work for you; or at very least, word your question in such a way that we can help you

Re: About python while statement and pop()

2014-06-11 Thread Steven D'Aprano
On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print foo(a) [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] a [] but this is empty so,I want

[issue11433] syntax error at while statement in IDLE/python shell

2011-03-08 Thread SilentGhost
Changes by SilentGhost ghost@gmail.com: -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11433 ___ ___

[issue11433] syntax error at while statement in IDLE/python shell

2011-03-07 Thread Victor
directly under/in the block of while: which is not the intention. (According to the docs, while statement should work without the else option). Is this a bug? Thanks, Victor p.s. the example is taken from http://swaroopch.com/notes/Python_en:Control_Flow -- components: IDLE messages

[issue11433] syntax error at while statement in IDLE/python shell

2011-03-07 Thread SilentGhost
SilentGhost ghost@gmail.com added the comment: No this is not a bug. You're trying to execute two statements in one go in IDLE, which it doesn't support. You need to run your while loop as a single statement, then your print('Done'). -- nosy: +SilentGhost resolution: - invalid

Re: Error invalid syntax while statement

2011-01-08 Thread Terry Reedy
15 print(counter: , counter 16 17 while (end == 0): # ---returns syntax error on this while statement Among other responses, there is no indent after print. should be print() while x: #now

Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
): # ---returns syntax error on this while statement 18 if(count x): 19 20 sol = math.pow(count, 2) + math.pow(count1, 2) 21 count += 1 22 count1 -= 1 23

Re: Error invalid syntax while statement

2011-01-07 Thread Chris Rebert
):                              # ---returns syntax error on this while statement Always include the exact error message + traceback in the future. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Error invalid syntax while statement

2011-01-07 Thread Ned Deily
In article aanlktik2eii-mwhg-eh_xe9kfhiylhyefzpvm7yzg...@mail.gmail.com, Garland Fulton stacks...@gmail.com wrote: I don't understand what I'm doing wrong i've tried several different cases for what i am doing here. Will someone please point my error out. 15 print(counter: , counter

Re: Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
while end == 0: # ---returns syntax error on this while statement 18 if(count x): 19 20 sol = math.pow(count, 2) + math.pow(count1, 2) 21 count += 1 22 count1

Re: Error invalid syntax while statement

2011-01-07 Thread Chris Rebert
On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton stacks...@gmail.com wrote: snip   1 #!/bin/bash/python snip What is wrong with my shebang line? Its path is invalid (unless you're using a *very* weird system). /bin/bash is the bash shell executable; bash is completely unrelated to Python.

Re: Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
On Fri, Jan 7, 2011 at 8:55 PM, Chris Rebert c...@rebertia.com wrote: On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton stacks...@gmail.com wrote: snip 1 #!/bin/bash/python snip What is wrong with my shebang line? Its path is invalid (unless you're using a *very* weird system).

While Statement

2009-05-22 Thread Joel Ross
Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage 0 : percentage = int(number/total*100) number-=1 char+=* print char

Re: While Statement

2009-05-22 Thread Kushal Kumaran
On Fri, May 22, 2009 at 2:47 PM, Joel Ross jo...@cognyx.com wrote: Hi all, I have this piece of code class progess():    def __init__(self, number,  char):        total = number        percentage = number        while percentage 0 :            percentage = int(number/total*100)      

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 11:17 AM, Joel Ross jo...@cognyx.com wrote: Hi all, I have this piece of code class progess():    def __init__(self, number,  char):        total = number        percentage = number        while percentage 0 :            percentage = int(number/total*100)      

Re: While Statement

2009-05-22 Thread Joel Ross
Joel Ross wrote: Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage 0 : percentage = int(number/total*100) number-=1 char+=*

Re: While Statement

2009-05-22 Thread Joel Ross
Andre Engels wrote: On Fri, May 22, 2009 at 11:17 AM, Joel Ross jo...@cognyx.com wrote: Hi all, I have this piece of code class progess(): def __init__(self, number, char): total = number percentage = number while percentage 0 : percentage =

RE: While Statement

2009-05-22 Thread Andreas Tawn
Im using 2.6 python and when running this class progess(): def __init__(self, number, total, char): percentage = float(number/total*100) percentage = int(round(percentage)) char = char * percentage print char progess(100, 999,

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 12:35 PM, Joel Ross jo...@cognyx.com wrote: Im using 2.6 python and when running this class progess():    def __init__(self, number, total,  char):        percentage = float(number/total*100)        percentage = int(round(percentage))        char = char *

Re: While Statement

2009-05-22 Thread Joel Ross
Andre Engels wrote: On Fri, May 22, 2009 at 12:35 PM, Joel Ross jo...@cognyx.com wrote: Im using 2.6 python and when running this class progess(): def __init__(self, number, total, char): percentage = float(number/total*100) percentage = int(round(percentage)) char

Re: While Statement

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change float(number/total*100) to float(number)/total*100 and it should work: I'd use: (number * 100.)/total - works because int *

Re: While Statement

2009-05-22 Thread Dave Angel
Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change float(number/total*100) to float(number)/total*100 and it should work: I'd use: (number * 100.)/total

Re: While Statement

2009-05-22 Thread Joel Ross
Dave Angel wrote: Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change float(number/total*100) to float(number)/total*100 and it should work: I'd use:

Re: While Statement

2009-05-22 Thread Tim Wintle
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote: Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: Change float(number/total*100) to float(number)/total*100 and it should work: I'd use: (number * 100.)/total - works because int * float =

Re: While Statement

2009-05-22 Thread J. Cliff Dyer
On Fri, 2009-05-22 at 09:59 -0400, Dave Angel wrote: Tim Wintle wrote: On Fri, 2009-05-22 at 13:19 +0200, Andre Engels wrote: number/total = 998/999 = 0 number/total*100 = 0*100 = 0 float(number/total*100) = float(0) = 0.0 Change float(number/total*100) to

Re: While Statement

2009-05-22 Thread Mike Kazantsev
On Fri, 22 May 2009 21:33:05 +1000 Joel Ross jo...@cognyx.com wrote: changed it to float(number)/total*100 and it worked thanks for all your help appreciated I believe operator.truediv function also deserves a mention here, since line op.truediv(number, total) * 100 somehow seem to make more

Re: having problems with a multi-conditional while statement

2009-01-07 Thread Hendrik van Rooyen
Philip Semanchuk ph...@nchuk.com wrote: 8 nice explanation Change the and to an or and you'll get the result you expected. Also google for De Morgan, or De Morgan's laws Almost everybody stumbles over this or one of it's corollaries at least once in their

having problems with a multi-conditional while statement

2009-01-06 Thread bowman.jos...@gmail.com
Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2: print 'conditions met' if condition1: condition2

Re: having problems with a multi-conditional while statement

2009-01-06 Thread Philip Semanchuk
On Jan 6, 2009, at 7:18 PM, bowman.jos...@gmail.com wrote: Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2

Re: having problems with a multi-conditional while statement

2009-01-06 Thread Ned Deily
In article 40a44d6b-c638-464d-b166-ef66496a0...@l16g2000yqo.googlegroups.com, bowman.jos...@gmail.com bowman.jos...@gmail.com wrote: Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5

Re: having problems with a multi-conditional while statement

2009-01-06 Thread bowman.jos...@gmail.com
,  bowman.jos...@gmail.com bowman.jos...@gmail.com wrote: Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2

[perl-python] 20050112 while statement

2005-01-13 Thread Xah Lee
# here's a while statement in python. a,b = 0,1 while b 20: print b a,b = b,a+b --- # here's the same code in perl ($a,$b)=(0,1); while ($b20) { print $b, \n; ($a,$b)= ($b, $a+$b); } Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org

Re: [perl-python] 20050112 while statement

2005-01-13 Thread Michael Hoffman
Xah Lee wrote: # here's a while statement in python. [...] # here's the same code in perl [...] So? -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050112 while statement

2005-01-13 Thread brianr
Xah Lee [EMAIL PROTECTED] writes: # here's a while statement in python. a,b = 0,1 while b 20: print b a,b = b,a+b --- # here's the same code in perl ($a,$b)=(0,1); while ($b20) { print $b, \n; ($a,$b)= ($b, $a+$b); } That python code produces a syntax error: File

Re: [perl-python] 20050112 while statement

2005-01-13 Thread Peter Maas
[EMAIL PROTECTED] schrieb: Xah Lee [EMAIL PROTECTED] writes: [...] (As a matter of interest, is this sequence of posts intended to demonstrate ignorance of both languages, or just one?) :) This sequence of posts is intended to stir up a debate just for the sake of a debate. It's a time sink. It's

Re: [perl-python] 20050112 while statement

2005-01-13 Thread Peter Hansen
Steven Bethard wrote: Xah Lee wrote: [some Python code] Because you're posting this to newsgroups, it would be advisable to use only spaces for indentation -- tabs are removed by a lot of newsreaders, which means your Python readers are going to complain about IndentationErrors. Unfortunately,

Re: [perl-python] 20050112 while statement

2005-01-13 Thread Steven Bethard
Xah Lee wrote: # here's a while statement in python. a,b = 0,1 while b 20: print b a,b = b,a+b --- # here's the same code in perl ($a,$b)=(0,1); while ($b20) { print $b, \n; ($a,$b)= ($b, $a+$b); } Because you're posting this to newsgroups, it would be advisable to use only spaces

Re: [perl-python] 20050112 while statement

2005-01-13 Thread Abigail
Xah Lee ([EMAIL PROTECTED]) wrote on CLIII September MCMXCIII in URL:news:[EMAIL PROTECTED]: .. # here's a while statement in python. .. .. a,b = 0,1 .. while b 20: .. print b IndentationError: expected an indented block .. a,b = b,a+b You have already proven you don't know Perl