Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread Thomas Passin
On 12/17/2025 10:43 PM, Gregg Drennan via Python-list wrote: The other recommendation i would make is to shorten the response the player needs to give when choosing their option. "R", "P", "S" is sufficient to determine the player's choice. Making the player enter the whole word introduces oppo

Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread Mats Wichmann
On 12/18/25 06:13, Thomas Passin wrote: On 12/17/2025 10:43 PM, Gregg Drennan via Python-list wrote: The other recommendation i would make is to shorten the response the player needs to give when choosing their option.  "R", "P", "S" is sufficient to determine the player's choice.  Making the p

Re: Python

2025-12-18 Thread rbowman
On Wed, 17 Dec 2025 23:02:24 -0500, c186282 wrote: >Oh, I usually write "i=i+2". It's a bit more clear and becomes the >same code anyway. += is more a 'C' thing. And Python, C#, JavaScript, C++, ... https://peps.python.org/pep-0008/ "assignment (+=, -= etc.), comparisons (==, <, >, !=,

Re: Python

2025-12-18 Thread rbowman
On Thu, 18 Dec 2025 08:03:47 +0100, Marc Haber wrote: > rbowman wrote: >>I keep it simple and use the first column, s/^/#/ in vim. s/^#// to >>make them go away. > > Ctrl-V, down, I, '# ', Escape. > > Those block commands are great! How have I ever lived without them? Learned something new.

Re: Python

2025-12-18 Thread rbowman
On Thu, 18 Dec 2025 04:25:35 -0500, c186282 wrote: > But isn't && and || more better ? If the >meaning is more obscure then it MUST be better ! Perfectly obvious. BTW any language that can't do bit operations should be drowned at birth. >'R' ??? You must have some very special nee

Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread MRAB
On 18/12/2025 18:34, Gregg Drennan via Python-list wrote: No chatbot involved. I was typing this on my phone in bed last night and didn't have a Python interpreter handy that I could verify this with. I will certainly check this. In any case, since verifying that a valid choice was made was ma

Re: Python

2025-12-18 Thread The Natural Philosopher
On 18/12/2025 10:19, Marc Haber wrote: The Natural Philosopher wrote: #define Bollocks #ifdef BOLLOCKS .. ... .. . #endif Has the disadvantage of being language specific. Almost everything is language specific. Its not as if you are writing for three different languages with the same

Re: Python

2025-12-18 Thread c186282
On 12/18/25 01:54, rbowman wrote: On Wed, 17 Dec 2025 23:02:24 -0500, c186282 wrote: Oh, I usually write "i=i+2". It's a bit more clear and becomes the same code anyway. += is more a 'C' thing. And Python, C#, JavaScript, C++, ... Well, I know it *works* ... I just choose not to

Re: Python

2025-12-18 Thread Marc Haber
rbowman wrote: >I keep it simple and use the first column, s/^/#/ in vim. s/^#// to make >them go away. Ctrl-V, down, I, '# ', Escape. Those block commands are great! How have I ever lived without them? Greetings Marc -- --

Re: Python

2025-12-18 Thread Marc Haber
The Natural Philosopher wrote: >#define Bollocks > >#ifdef BOLLOCKS >.. >... > >.. >. >#endif Has the disadvantage of being language specific. Greetings Marc -- Marc Haber | " Questions are the |

Re: Python

2025-12-18 Thread rbowman
On Wed, 17 Dec 2025 22:18:39 -0500, c186282 wrote: >Both ''' and """ work ... but you need to close the comment block >with the same thing. > >ANYway, block-comments ARE (at least now) to be had in Python. > >Never used P1 or P2 worth anything, maybe they didn't have block >c

Re: Python

2025-12-18 Thread Scott Lurndal
rbowman writes: >On Thu, 18 Dec 2025 08:03:47 +0100, Marc Haber wrote: > >> rbowman wrote: >>>I keep it simple and use the first column, s/^/#/ in vim. s/^#// to >>>make them go away. >> >> Ctrl-V, down, I, '# ', Escape. >> >> Those block commands are great! How have I ever lived without them?

Re: Python

2025-12-18 Thread Peter Flass
On 12/18/25 11:00, Richard Kettlewell wrote: Peter Flass writes: I comment *A LOT*. When I had to go back and revisit some very old code, I wished I had commented more. I've almost never looked at a program and said "I wish it had fewer comments." Regrettably, I’ve encountered plenty of comme

Re: Python

2025-12-18 Thread Mats Wichmann
On 12/17/25 17:52, rbowman wrote: On Wed, 17 Dec 2025 22:13:21 +, Richard Kettlewell wrote: If you prefer the comment markers to match the indentation of the whole block, that works too: I keep it simple and use the first column, s/^/#/ in vim. s/^#// to make them go away. You can also

Re: Python

2025-12-18 Thread The Natural Philosopher
On 18/12/2025 07:03, Marc Haber wrote: rbowman wrote: I keep it simple and use the first column, s/^/#/ in vim. s/^#// to make them go away. Ctrl-V, down, I, '# ', Escape. Those block commands are great! How have I ever lived without them? Greetings Marc #define Bollocks #ifdef BOLLOCKS

Re: Python

2025-12-18 Thread Peter Flass
On 12/17/25 20:10, c186282 wrote: On 12/17/25 14:17, rbowman wrote: On Wed, 17 Dec 2025 03:11:09 -0500, c186282 wrote:     Probably 50% of the text in my code - doesn't matter which lang - is     'comments'. I looked at some of my code and it's pretty much comment free. There are a couple

Re: Python

2025-12-18 Thread rbowman
On Thu, 18 Dec 2025 15:43:49 GMT, Scott Lurndal wrote: > rbowman writes: >>On Thu, 18 Dec 2025 08:03:47 +0100, Marc Haber wrote: >> >>> rbowman wrote: I keep it simple and use the first column, s/^/#/ in vim. s/^#// to make them go away. >>> >>> Ctrl-V, down, I, '# ', Escape. >>> >>>

Re: Python

2025-12-18 Thread rbowman
On Thu, 18 Dec 2025 18:00:45 +, Richard Kettlewell wrote: > I’ve also encountered quite a few comments written by people who had > been instructed to add comments to under-commented code, but didn’t > really understand what they were looking at. The result generally > obscures more than it ill

Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread Gregg Drennan via Python-list
No chatbot involved. I was typing this on my phone in bed last night and didn't have a Python interpreter handy that I could verify this with. I will certainly check this. In any case, since verifying that a valid choice was made was made is done in the same IF statement as the check for None, i

Re: Python

2025-12-18 Thread Richard Kettlewell
Peter Flass writes: > I comment *A LOT*. When I had to go back and revisit some very old > code, I wished I had commented more. I've almost never looked at a > program and said "I wish it had fewer comments." Regrettably, I’ve encountered plenty of comments that don’t actually reflect the code (f

Re: Python

2025-12-18 Thread Alan Gauld via Python-list
On 18/12/2025 14:40, Peter Flass wrote: > ...I've almost never looked at a program and > said "I wish it had fewer comments." Sadly I have. In one notable example we sub-contracted the coding out to an external company and the contract specified some code "quality metrics" one of these was the r

Re: Python

2025-12-18 Thread dn via Python-list
On 19/12/2025 08:52, Peter Flass wrote: On 12/18/25 11:00, Richard Kettlewell wrote: Peter Flass writes: I comment *A LOT*. When I had to go back and revisit some very old code, I wished I had commented more. I've almost never looked at a program and said "I wish it had fewer comments." Regr

Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread Thomas Passin
On 12/18/2025 1:34 PM, Gregg Drennan wrote: No chatbot involved.  I was typing this on my phone in bed last night and didn't have a Python interpreter handy that I could verify this with.  I will certainly check this. I apologise. I thought your post sounded chatbotty, especially at the end.

Re: Rock Paper Scissors Code Bug?

2025-12-18 Thread MRAB
On 19/12/2025 02:51, Thomas Passin wrote: On 12/18/2025 1:34 PM, Gregg Drennan wrote: No chatbot involved.  I was typing this on my phone in bed last night and didn't have a Python interpreter handy that I could verify this with.  I will certainly check this. I apologise.  I thought your post

Re: Python

2025-12-18 Thread c186282
On 12/18/25 13:00, Richard Kettlewell wrote: Peter Flass writes: I comment *A LOT*. When I had to go back and revisit some very old code, I wished I had commented more. I've almost never looked at a program and said "I wish it had fewer comments." Regrettably, I’ve encountered plenty of comme

Re: Python

2025-12-18 Thread rbowman
On Thu, 18 Dec 2025 12:52:33 -0700, Peter Flass wrote: > Since documentation never gets updated, if it's even created at all, > comments are the best you can get most of the time. We had a tech writer who was notorious for copying the programmer's fix notes and calling it good. It was helpful in

Re: Python

2025-12-18 Thread c186282
On 12/18/25 09:40, Peter Flass wrote: On 12/17/25 20:10, c186282 wrote: On 12/17/25 14:17, rbowman wrote: On Wed, 17 Dec 2025 03:11:09 -0500, c186282 wrote:     Probably 50% of the text in my code - doesn't matter which lang - is     'comments'. I looked at some of my code and it's pretty