It has been nearly three decades since I have had to write in C, Stefan, but what I suggested jokingly is quite mild compared to what the winners of the obfuscated C Contest do:
https://www.ioccc.org/ Time for me to drop out of this thread. Personally I fully agree uses of "while' as described are perfectly understandable. Features that sophisticated programmers love tend to confuse novices. I recall my exposure to PERL where weird things seemed to just happen with no rhyme or reason or connections. Turned out just about everything puts things into or takes them out of hidden variables so much of the time, a string of commands just does what might be expected. Another variant on the elusive concept of a pipeline. But all the nice gimmicks and tricks make novices a bit puzzled. On the other hand, you can still write most programs the old fashioned way and sort of start normal then head off into hyperspace at warp speed. Python too has a way to write fairly unsophisticated programs as well as idioms and methods that rapidly become hard to comprehend. -----Original Message----- From: Python-list <python-list-bounces+avigross=verizon....@python.org> On Behalf Of Stefan Ram Sent: Monday, September 6, 2021 7:49 PM To: python-list@python.org Subject: Re: on writing a while loop for rolling two dice "Avi Gross" <avigr...@verizon.net> writes: > In languages like C/C++ there are people who make up macros like: >#define INDEFINITELY_LOOP while (true) >Or something like that and then allow the preprocessor to replace >INDEFINITELY_LOOP with valid C code. Those usually are beginners. >So, how to do something like that in python, is a challenge left to the >user Such a use of macros is frowned upon by most C programmers, because it renders the code unreadable. "while(1)" in C or "while True:" in Python is perfectly clear. Don't fix it if it ain't broke! -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list