Re: Match statement with literal strings

2023-06-07 Thread Jason Friedman via Python-list
> > The bytecode compiler doesn't know that you intend RANGE > to be a constant -- it thinks it's a variable to bind a > value to. > > To make this work you need to find a way to refer to the > value that isn't just a bare name. One way would be to > define your constants using an enum: > > class

Re: Match statement with literal strings

2023-06-07 Thread Chris Angelico via Python-list
On Thu, 8 Jun 2023 at 08:19, Jason Friedman via Python-list wrote: > > This gives the expected results: > > with open(data_file, newline="") as reader: > csvreader = csv.DictReader(reader) > for row in csvreader: > #print(row) > match row[RULE_TYPE]: > case "RANGE": > print("range") > case

Re: Match statement with literal strings

2023-06-07 Thread Greg Ewing via Python-list
On 8/06/23 10:18 am, Jason Friedman wrote: SyntaxError: name capture 'RANGE' makes remaining patterns unreachable The bytecode compiler doesn't know that you intend RANGE to be a constant -- it thinks it's a variable to bind a value to. To make this work you need to find a way to refer to the

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 3:29 PM, Ethan Furman wrote: > On 8/19/20 12:40 PM, Tim Daneliuk wrote: >> On 8/19/20 2:00 PM, Karen Shaeffer wrote: > >>> Considering all your posts on this thread, it is reasonable to infer you >>> have some ideological motivations. >> >> My motivation was to demonstrate that if

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Calvin Spealman
Tim, Technology is political. Deal with it. Signed, Common Fucking Sense On Wed, Aug 19, 2020 at 4:02 PM Tim Daneliuk wrote: > On 8/19/20 1:10 PM, J. Pic wrote: > > Tim, don't you also think that statements should be backed by > > evidence, even more if they are particularly accusatory ? > >

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Ethan Furman
On 8/19/20 12:40 PM, Tim Daneliuk wrote: On 8/19/20 2:00 PM, Karen Shaeffer wrote: Considering all your posts on this thread, it is reasonable to infer you have some ideological motivations. My motivation was to demonstrate that if people of your ilk are free to peddle their worldview,

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 1:10 PM, J. Pic wrote: > Tim, don't you also think that statements should be backed by > evidence, even more if they are particularly accusatory ? > > We'll be lucky if S's editor doesn't sue the PSF for slandering for > publishing that S "upholds white supremacy". > As a general

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 2:00 PM, Karen Shaeffer wrote: > Where you conclude with: "Methinks there is an ideological skunk in the > parlor …” > > Considering all your posts on this thread, it is reasonable to infer you have > some ideological motivations. My motivation was to demonstrate that if people of

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread J. Pic
On Wed, Aug 19, 2020 at 3:33 AM Tim Daneliuk wrote: > On 8/18/20 6:34 PM, rmli...@riseup.net wrote: > > I would kindly recommend that folks just educate themselves on what > > ... > > Resources: > > The Invention of the White Race: Volume II: >

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Karen Shaeffer via Python-list
> On Aug 19, 2020, at 8:47 AM, Tim Daneliuk wrote: > > On 8/19/20 8:35 AM, Alexandre Brault wrote: >> I've not seen anyone objecting to the idea of removing the reference to >> Strunk and White in favour of the underlying message of "be understandable >> by others who may read your comments"

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread J. Pic
Tim, don't you also think that statements should be backed by evidence, even more if they are particularly accusatory ? We'll be lucky if S's editor doesn't sue the PSF for slandering for publishing that S "upholds white supremacy". -- https://mail.python.org/mailman/listinfo/python-list

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/18/20 12:18 PM, gia wrote: > That's why I picked Math, it is also universally accepted, it's very > strict, and it leaves the reader to decide its color based on themselves > (it's not white btw :) Sorry, but when it comes to the demands of the woke, you are not immune. Reported widely

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Tim Daneliuk
On 8/19/20 8:35 AM, Alexandre Brault wrote: > I've not seen anyone objecting to the idea of removing the reference to > Strunk and White in favour of the underlying message of "be understandable by > others who may read your comments" (there were at most a few philosophical > "what is

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread J. Pic
On Wed, Aug 19, 2020 at 4:06 PM Ethan Furman wrote: > The purported issue is that Strunk and White itself is doing the upholding. Still trying to find some actual evidence. -- ∞ -- https://mail.python.org/mailman/listinfo/python-list

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Ethan Furman
On 8/19/20 6:35 AM, Alexandre Brault wrote: What people *are* complaining about is the use of a commit message to stand on a soapbox and preach. The time to preach was when debating the change; commit messages, in many people's opinions, is not the time to espouse non-technical opinions An

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Alexandre Brault
On 2020-08-18 7:34 p.m., rmli...@riseup.net wrote: There are many reasons Elements is a terrible English style guide: https://www.pure.ed.ac.uk/ws/files/8520953/PULLUM_2010_The_land_of_the_free_and_the_elements_of_style.pdf I would kindly recommend that folks just educate themselves on what

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Ethan Furman
On 8/19/20 2:55 AM, J. Pic wrote: [...] but still, I don't understand how this sentence (changed by the patch): When writing English, follow Strunk and White. Does "uphold relics of white supremacy" (as per the commit message). Thanks in advance for your simple explanation (I'm not a

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread J. Pic
On Wed, Aug 19, 2020 at 3:33 AM Tim Daneliuk wrote: > > I would also like to help you become educated. Be sure to check > out these literary treasures - they are the foundation of the > worldview you are espousing: > > > The_Origin of the Family, Private Property, and the State - Engels > > Das

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread J. Pic
My origins are Jewish Algerian which is just hated by just all parties you could think off, but can not be considered as white. Nonetheless, I'm not angry in any way, rather amused, but still, I don't understand how this sentence (changed by the patch): > When writing English, follow Strunk and

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-19 Thread Robin Becker
On 18/08/2020 19:45, Tim Daneliuk wrote: On 8/18/20 12:28 PM, justin walters wrote: I apologize for being ageist earlier as well. That was out of line. I am likely older than you and there is no reason to apologise. Only the profoundly undeveloped psyche takes every opportunity to find

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Karen Shaeffer via Python-list
> On Aug 18, 2020, at 6:13 PM, Richard Damon wrote: > > On 8/18/20 7:34 PM, rmli...@riseup.net wrote: >> I would also caution against relying on the idea of human rights when >> defending against accusations of being political, since they too are >> political. Life is political. We continue to

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 6:34 PM, rmli...@riseup.net wrote: > I would kindly recommend that folks just educate themselves on what Speaking of being educated ... Could you please do an exposition for all us ignorant types on the books that really animate your worldview: The_Origin of the Family, Private

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 6:34 PM, rmli...@riseup.net wrote: > I would kindly recommend that folks just educate themselves on what I would also like to help you become educated. Be sure to check out these literary treasures - they are the foundation of the worldview you are espousing: The_Origin of the

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Richard Damon
On 8/18/20 7:34 PM, rmli...@riseup.net wrote: > I would also caution against relying on the idea of human rights when > defending against accusations of being political, since they too are > political. Life is political. We continue to this day trying to > redefine, as a society, what human rights

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread gia
> > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of Python-list digest..." > > > > Today's Topics: > > > >1. why the connection set with ?keep live? in urllib.request > > always set to be?cl

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread rmlibre
> always set to be?closed, thanks (xuanwu348) >2. Final statement from Steering Council on politically-charged > commit messages (Chris Angelico) >3. Re: Final statement from Steering Council on > politically-charged commit messages (Dylan Distasio) >

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Chris Angelico
On Wed, Aug 19, 2020 at 7:11 AM Kyle Stanley wrote: > > On Mon, Aug 17, 2020 at 2:37 PM Chris Angelico wrote: >> >> Yes. I was hoping for "we should rewrite that commit", and would have >> been content with "we won't rewrite it, but we don't want that >> repeated". But the SC said that it is

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Kyle Stanley
On Mon, Aug 17, 2020 at 2:37 PM Chris Angelico wrote: > Yes. I was hoping for "we should rewrite that commit", and would have > been content with "we won't rewrite it, but we don't want that > repeated". But the SC said that it is absolutely fine to write commit > messages like that. > While

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/18/20 12:28 PM, justin walters wrote: > I apologize for being ageist earlier as well. That was out of line. I am likely older than you and there is no reason to apologise. Only the profoundly undeveloped psyche takes every opportunity to find offense when none is intended. It is the sign

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread justin walters
I believe the commit message was written in bad faith. It reeks of virtue signaling. Commit messages should remain purely technical in nature. However, I do think the change itself is valid. I don't care about the style of comments as long as they are clear and communicate their message well. How

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread gia
That's why I picked Math, it is also universally accepted, it's very strict, and it leaves the reader to decide its color based on themselves (it's not white btw :) On Tue, Aug 18, 2020 at 11:36 AM Tim Daneliuk wrote: > On 8/17/20 1:26 PM, Chris Angelico wrote: > > For context, see this

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Tim Daneliuk
On 8/17/20 1:26 PM, Chris Angelico wrote: > For context, see this commit: > > https://github.com/python/peps/commit/0c6427dcec1e98ca0bd46a876a7219ee4a9347f4 > > The commit message is highly politically charged and is now a > permanent part of the Python commit history. The Python Steering >

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread J. Pic
I'm sorry Igor, I didn't mean to ruin your "conspiracy theories just hit the commit log day" -- https://mail.python.org/mailman/listinfo/python-list

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Igor Korot
Hi, On Tue, Aug 18, 2020 at 10:27 AM J. Pic wrote: > > I think this commit message is not enough: we should take it further > and demand that Elwyn Brooks White choose change their last name to > something less supremacist. > > Also: I've been waiting long enough to see this drama hit the chess

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Robin Becker
On 18/08/2020 04:53, thronobu...@gmail.com wrote: "Truth is a social construct." much as I deplore the politicization of computers, logic, maths and other areas of human interest by particular interest groups, according to some physicists, reality might be an observer based construct

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread J. Pic
I think this commit message is not enough: we should take it further and demand that Elwyn Brooks White choose change their last name to something less supremacist. Also: I've been waiting long enough to see this drama hit the chess world by itself so I'm explicitly making the suggestion here. --

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Chris Angelico
On Tue, Aug 18, 2020 at 11:12 PM Richard Damon wrote: > > On 8/18/20 1:22 AM, justin walters wrote: > > I for one don't want to see politics involved in PL development. However, > > inclusivity isn't a political issue, it's a human rights issue. > > > > Do I agree with the PR, not exactly.

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread Richard Damon
On 8/18/20 1:22 AM, justin walters wrote: > I for one don't want to see politics involved in PL development. However, > inclusivity isn't a political issue, it's a human rights issue. > > Do I agree with the PR, not exactly. However, I do think we as a community > should be accommodating to people

RE: Final statement from Steering Council on politically-charged commit messages

2020-08-18 Thread David Raymond
> Do I agree with the PR, not exactly. However, I do think we as a community > should be accommodating to people > Whose use of the English language differs from the standard as long as the > meaning is clear. Remember that the problem isn't the change in wording of the PEP. That's all well and

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread justin walters
I for one don't want to see politics involved in PL development. However, inclusivity isn't a political issue, it's a human rights issue. Do I agree with the PR, not exactly. However, I do think we as a community should be accommodating to people Whose use of the English language differs from the

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread thronobulax
On Monday, August 17, 2020 at 1:26:33 PM UTC-5, Chris Angelico wrote: > For context, see this commit: > > https://github.com/python/peps/commit/0c6427dcec1e98ca0bd46a876a7219ee4a9347f4 > > The commit message is highly politically charged and is now a > permanent part of the Python commit

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread thronobulax
On Monday, August 17, 2020 at 1:26:33 PM UTC-5, Chris Angelico wrote: > For context, see this commit: > > https://github.com/python/peps/commit/0c6427dcec1e98ca0bd46a876a7219ee4a9347f4 > > The commit message is highly politically charged and is now a > permanent part of the Python commit

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread gia
Math should stop being standardized, as it could alienate people of other colors to it. Commit should be rewritten as "Remove book advert from comments". On Mon, Aug 17, 2020 at 1:39 PM Chris Angelico wrote: > On Tue, Aug 18, 2020 at 4:34 AM Dylan Distasio > wrote: > > > > That's quite an

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread Chris Angelico
On Tue, Aug 18, 2020 at 4:34 AM Dylan Distasio wrote: > > That's quite an interesting ruling by the SC. I'm not surprised to see them > bend the knee to PC, but it is disheartening to see they're fine opening a > can of political worms in a programming language. I suspect they will > deplore

Re: Final statement from Steering Council on politically-charged commit messages

2020-08-17 Thread Dylan Distasio
That's quite an interesting ruling by the SC. I'm not surprised to see them bend the knee to PC, but it is disheartening to see they're fine opening a can of political worms in a programming language. I suspect they will deplore messages outside of their bubble though. On Mon, Aug 17, 2020 at

Re: Print statement

2020-01-28 Thread Frank Millman
On 2020-01-28 12:14 PM, L A Smit wrote: Please help me with this. squares =input("\nSquares: ") print(float((squares) *float(.15)) *(1.3)) Cant print answer.   print(float((squares) * float(.15)) *(1.3)) TypeError: can't multiply sequence by non-int of type 'float' You have some

Re: "Goto" statement in Python

2017-04-16 Thread Chris Angelico
On Sun, Apr 16, 2017 at 5:21 PM, Mikhail V wrote: > I am in the category "I just want to express some > algorithm and don't want to learn every year new concepts". > I tend to think that extremely restricted syntax, in the sence > of having only few flow control instructions

Re: "Goto" statement in Python

2017-04-16 Thread Mikhail V
On 14 April 2017 at 03:44, Steve D'Aprano wrote: > On Fri, 14 Apr 2017 12:52 am, bartc wrote: > >> I know this isn't the Python need-for-speed thread, but this is a >> classic example where the lack of one simple feature leads to using >> slower, more cumbersome ones.

Re: "Goto" statement in Python

2017-04-14 Thread Rob Gaddi
On 04/14/2017 07:19 AM, Dennis Lee Bieber wrote: On Fri, 14 Apr 2017 11:44:59 +1000, Steve D'Aprano declaimed the following: Even that's not enough for some. Donald Knuth, who supports the use of GOTO under some circumstances, maintains that any program using

Re: "Goto" statement in Python

2017-04-14 Thread Chris Angelico
On Sat, Apr 15, 2017 at 12:13 AM, Dennis Lee Bieber wrote: > On Thu, 13 Apr 2017 18:36:57 -0600, Ian Kelly > declaimed the following: > >> >>Well, you can do it in Assembly. And BASIC, if you count the primitive >>GOSUB-type subroutines, though

Re: "Goto" statement in Python

2017-04-14 Thread Chris Green
Bernd Nawothnig wrote: > On 2017-04-13, Mikhail V wrote: > > On 13 April 2017 at 18:48, Ian Kelly wrote: > >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > >>> Now I wonder, have we already collected *all* bells

Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Grant Edwards wrote: > On 2017-04-13, Rob Gaddi wrote: > >> No, C doesn't support exception handling. As a result, handling error >> conditions in C is a huge pain for which (forward-only) goto is often, >> while not the only remedy, the least

Re: "Goto" statement in Python

2017-04-14 Thread Bernd Nawothnig
On 2017-04-13, Mikhail V wrote: > On 13 April 2017 at 18:48, Ian Kelly wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >>> Now I wonder, have we already collected *all* bells and whistles of Python >>> in these two examples, or is there

Re: "Goto" statement in Python

2017-04-14 Thread bartc
On 14/04/2017 02:44, Steve D'Aprano wrote: On Fri, 14 Apr 2017 12:52 am, bartc wrote: I know this isn't the Python need-for-speed thread, but this is a classic example where the lack of one simple feature leads to using slower, more cumbersome ones. Dear gods, have I fallen back in time to

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Friday, April 14, 2017 at 7:15:11 AM UTC+5:30, Steve D'Aprano wrote: > On Fri, 14 Apr 2017 12:52 am, bartc wrote: > > > I know this isn't the Python need-for-speed thread, but this is a > > classic example where the lack of one simple feature leads to using > > slower, more cumbersome ones. >

Re: "Goto" statement in Python

2017-04-13 Thread Steve D'Aprano
On Fri, 14 Apr 2017 12:52 am, bartc wrote: > I know this isn't the Python need-for-speed thread, but this is a > classic example where the lack of one simple feature leads to using > slower, more cumbersome ones. Dear gods, have I fallen back in time to 1975 again? The Goto Wars are over, and

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 4:59 PM, bartc wrote: > On 13/04/2017 22:58, Ian Kelly wrote: >> >> On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber >> wrote: >>> >>> On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the >>> following: >>>

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 22:58, Ian Kelly wrote: On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber wrote: On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the following: 'goto' would be one easy-to-execute byte-code; no variables, objects or types to worry

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 3:27 PM, Dennis Lee Bieber wrote: > On Thu, 13 Apr 2017 15:52:24 +0100, bartc declaimed the > following: > >>'goto' would be one easy-to-execute byte-code; no variables, objects or >>types to worry about. If implemented properly

Re: "Goto" statement in Python

2017-04-13 Thread Marko Rauhamaa
Rob Gaddi : > On 04/13/2017 08:26 AM, Marko Rauhamaa wrote: >> I have occasionally felt the urge to try "goto" in my C code, but having >> written it, I have taken it out. It just doesn't make the code look more >> elegant or robust. Unlike "break" or "return,"

Re: "Goto" statement in Python

2017-04-13 Thread Grant Edwards
On 2017-04-13, Rob Gaddi wrote: > No, C doesn't support exception handling. As a result, handling error > conditions in C is a huge pain for which (forward-only) goto is often, > while not the only remedy, the least painful one. Indeed. That is almost the

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 19:38, Ian Kelly wrote: > On Thu, Apr 13, 2017 at 11:25 AM, Mikhail V wrote: >> On 13 April 2017 at 18:48, Ian Kelly wrote: >>> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote:

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 11:19:38 PM UTC+5:30, Ian wrote: > On Thu, Apr 13, 2017 at 11:39 AM, Rustom Mody wrote: > > My broader point (vive la Trump) was that if we learn to actively tolerate > > people with views wildly far from ours, the world would be a better place. > > I fail to see

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:39 AM, Rustom Mody wrote: > My broader point (vive la Trump) was that if we learn to actively tolerate > people with views wildly far from ours, the world would be a better place. I fail to see how my comment "Functions and exceptions are

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
On 04/13/2017 08:26 AM, Marko Rauhamaa wrote: Chris Angelico : Personally, I can't remember the last time I yearned for "goto" in Python, and the only times I've ever wished for it or used it in other languages have been multi-loop breaks or "for...else" blocks. And neither

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 10:56:53 PM UTC+5:30, Rob Gaddi wrote: > On 04/13/2017 10:13 AM, Rustom Mody wrote: > > On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: > >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > >>> Now I wonder, have we already collected *all* bells

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:25 AM, Mikhail V wrote: > On 13 April 2017 at 18:48, Ian Kelly wrote: >> On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >>> Now I wonder, have we already collected *all* bells and whistles of

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 11:13 AM, Rustom Mody wrote: > What to do?? > Ask Trump? > [I guess we now need a Godwin 2.0 with :s/Hitler/Trump ] Not even close. Whatever one's opinion may be of Trump, he hasn't murdered millions of people. --

Re: "Goto" statement in Python

2017-04-13 Thread Rob Gaddi
On 04/13/2017 10:13 AM, Rustom Mody wrote: On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: Now I wonder, have we already collected *all* bells and whistles of Python in these two examples, or is there something else for

Re: "Goto" statement in Python

2017-04-13 Thread Thomas Nyberg
On 04/12/2017 04:42 PM, Mikhail V wrote: > For me it looks clear and I'd say easy to comprehend, > Main critic would be obviously that it is not > a good, *scalable application*, but quite often I don't > even have this in mind, and just want to express a > step-by-step direct instructions. I

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 18:48, Ian Kelly wrote: > On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: >> Now I wonder, have we already collected *all* bells and whistles of Python >> in these two examples, or is there something else for expressing trivial

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 16:03, Ian Kelly wrote: On Thu, Apr 13, 2017 at 8:52 AM, bartc wrote: On 13/04/2017 15:35, Chris Angelico wrote: Personally, I can't remember the last time I yearned for "goto" in Python, and the only times I've ever wished for it or used it in other languages

Re: "Goto" statement in Python

2017-04-13 Thread Rustom Mody
On Thursday, April 13, 2017 at 10:19:33 PM UTC+5:30, Ian wrote: > On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > > Now I wonder, have we already collected *all* bells and whistles of Python > > in these two examples, or is there something else for expressing trivial > > thing. > >

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 10:23 AM, Mikhail V wrote: > Now I wonder, have we already collected *all* bells and whistles of Python > in these two examples, or is there something else for expressing trivial > thing. Functions and exceptions are considered "bells and whistles"?

Re: "Goto" statement in Python

2017-04-13 Thread Mikhail V
On 13 April 2017 at 02:17, Rob Gaddi wrote: > > def finder: > for s in S: > if s == 'i': > return 'found on stage 1' > > S = S + ' hello world' > for s in S: > if s == 'd': > return 'found on stage 2' > > raise ValueError('not found;

Re: "Goto" statement in Python

2017-04-13 Thread Marko Rauhamaa
Chris Angelico : > Personally, I can't remember the last time I yearned for "goto" in > Python, and the only times I've ever wished for it or used it in other > languages have been multi-loop breaks or "for...else" blocks. And > neither is very frequent. I have occasionally

Re: "Goto" statement in Python

2017-04-13 Thread Ian Kelly
On Thu, Apr 13, 2017 at 8:52 AM, bartc wrote: > On 13/04/2017 15:35, Chris Angelico wrote: >> Personally, I can't remember the last time I yearned for "goto" in >> Python, and the only times I've ever wished for it or used it in other >> languages have been multi-loop breaks or

Re: "Goto" statement in Python

2017-04-13 Thread bartc
On 13/04/2017 15:35, Chris Angelico wrote: On Thu, Apr 13, 2017 at 9:31 PM, alister wrote: I expect you could simulate most of these with a custom exception for example break from nested loop: class GoTo(Exception): pass try: for i in range(100):

Re: "Goto" statement in Python

2017-04-13 Thread Chris Angelico
On Thu, Apr 13, 2017 at 9:31 PM, alister wrote: > I expect you could simulate most of these with a custom exception > for example break from nested loop: > > class GoTo(Exception): > pass > > try: > for i in range(100): > print i > for j in range

Re: "Goto" statement in Python

2017-04-13 Thread alister
On Thu, 13 Apr 2017 01:42:01 +0200, Mikhail V wrote: > On 12 April 2017 at 02:44, Nathan Ernst wrote: >> goto is a misunderstood and much misaligned creature. It is a very >> useful feature, but like nearly any programming construct can be >> abused. >> >> Constructs like

Re: "Goto" statement in Python

2017-04-12 Thread Rob Gaddi
On 04/12/2017 04:42 PM, Mikhail V wrote: On 12 April 2017 at 02:44, Nathan Ernst wrote: goto is a misunderstood and much misaligned creature. It is a very useful feature, but like nearly any programming construct can be abused. Constructs like 'break', 'continue' or

Re: If statement with or operator

2017-02-22 Thread Rhodri James
On 22/02/17 17:38, Peter Pearson wrote: On Wed, 22 Feb 2017 22:33:31 +0530, Ganesh Pal wrote: [snip] I need suggestion on the if statement in the below code , all that I was trying to do was to add a check i.e if any one of the functions return True then break the loop. end_time =

Re: If statement with or operator

2017-02-22 Thread Peter Pearson
On Wed, 22 Feb 2017 22:33:31 +0530, Ganesh Pal wrote: [snip] > I need suggestion on the if statement in the below code , all that I was > trying to do was to add a check i.e if any one of the functions return > True then break the loop. > > end_time = time.time() + 300 > umount_completed

Re: If statement with or operator

2017-02-22 Thread alister
On Wed, 22 Feb 2017 22:33:31 +0530, Ganesh Pal wrote: > Hello Friends, > > I need suggestion on the if statement in the below code , all that I > was trying to do was to add a check i.e if any one of the functions > return True then break the loop. > > > end_time = time.time() + 300 >

Re: If statement issue driving me nuts

2014-04-06 Thread Gary Herron
On 04/05/2014 09:58 PM, Anthony Smith wrote: Hi I have a small project and I have been unable to get the following statement to work. Any help would great. User inputs can either self_sale_head which is a $ value,if a $ value is not add a self.estimated_weight_hd is used to get the total

Re: Print statement not printing as it suppose to

2013-09-20 Thread Tim Delaney
On 21 September 2013 07:57, Sam anasdah...@gmail.com wrote: hi everybody i am just starting to learn python, i was writing a simple i/o program but my print statement is acting weird. here is my code i want to know why it prints this way. thank you print(\nThe total amount required is ,

Re: Print statement not printing as it suppose to

2013-09-20 Thread Emiliano Carlos de Moraes Firmino
Remove both brackets in last line, You are creating a tuple in last statement not making a function call. 2013/9/20 Sam anasdah...@gmail.com hi everybody i am just starting to learn python, i was writing a simple i/o program but my print statement is acting weird. here is my code i want to

Re: Print statement not printing as it suppose to

2013-09-20 Thread John Gordon
In 05bbf1a3-6480-48ee-8984-2482b90c7...@googlegroups.com Sam anasdah...@gmail.com writes: print(\nThe total amount required is , total ) OUTPUT ('\nThe total amount required is ', 3534) In older versions of python (like the one you are using), 'print' is a statement instead of a function.

Re: Print statement not printing as it suppose to

2013-09-20 Thread Chris Angelico
On Sat, Sep 21, 2013 at 7:57 AM, Sam anasdah...@gmail.com wrote: car=int(input(Lamborghini tune-up:)) print(\nThe total amount required is , total ) OUTPUT ('\nThe total amount required is ', 3534) As others have said, this output indicates that you're running under a Python 2.x interpreter.

Re: Print statement not printing as it suppose to

2013-09-20 Thread Dave Angel
On 20/9/2013 17:57, Sam wrote: print(\nThe total amount required is , total ) ('\nThe total amount required is ', 3534) === the problem is obviously on the last print statement that is supposed to print the outut Others have pointed out the version discrepancy. But I'll also ask what

Re: Switch statement

2013-03-10 Thread Steven D'Aprano
On Sun, 10 Mar 2013 14:16:27 +, Joseph L. Casale wrote: I have a switch statement composed using a dict: switch = {     'a': func_a,     'b': func_b,     'c': func_c } switch.get(var, default)() As a result of multiple functions per choice, it migrated to: switch = {  

RE: Switch statement

2013-03-10 Thread Joseph L. Casale
switch = {  'A': functools.partial(spam, a), 'B': lambda b, c=c: ham(b, c), 'C': eggs, }    switch[letter](b) That's cool, never even thought to use lambdas. functools.partial isn't always applicable, but when it is, you should  prefer it over lambda since it will be very

Re: Switch statement

2013-03-10 Thread Mitya Sirenef
On 03/10/2013 10:16 AM, Joseph L. Casale wrote: I have a switch statement composed using a dict: switch = { 'a': func_a, 'b': func_b, 'c': func_c } switch.get(var, default)() As a result of multiple functions per choice, it migrated to: switch = { 'a': (func_a1, func_a2), 'b':

Re: Switch statement

2013-03-10 Thread Nicholas Cole
On Sun, Mar 10, 2013 at 8:42 PM, Mitya Sirenef msire...@lightbird.netwrote: On 03/10/2013 10:16 AM, Joseph L. Casale wrote: I have a switch statement composed using a dict: switch = { 'a': func_a, 'b': func_b, 'c': func_c } switch.get(var, default)() As a result of

Re: Switch statement

2013-03-10 Thread Terry Reedy
On 3/10/2013 11:18 AM, Steven D'Aprano wrote: On Sun, 10 Mar 2013 14:16:27 +, Joseph L. Casale wrote: I have a switch statement composed using a dict: switch = { 'a': func_a, 'b': func_b, 'c': func_c } switch.get(var, default)() As a result of multiple functions per

RE: Switch statement

2013-03-10 Thread Joseph L. Casale
Or could you do something like: arguments_to_pass = [list of some sort] switch.get(var, default)(*arguments_to_pass) Stevens lambda suggestion was most appropriate. Within the switch, there are functions called with none, or some variation of arguments. It was not easy to pass them in after

Re: Else statement executing when it shouldnt

2013-01-25 Thread Frank Millman
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

Re: Else statement executing when it shouldnt

2013-01-23 Thread Thomas Boell
On Tue, 22 Jan 2013 17:28:35 -0800 (PST) alex23 wuwe...@gmail.com wrote: On Jan 23, 1:48 am, Thomas Boell tbo...@domain.invalid 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

Re: Else statement executing when it shouldnt

2013-01-23 Thread Jussi Piitulainen
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 --

Re: Else statement executing when it shouldnt

2013-01-23 Thread Jerry Hill
On Wed, Jan 23, 2013 at 8:35 AM, Jussi Piitulainen jpiit...@ling.helsinki.fi 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.

  1   2   3   4   >