Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52145

Re: new to While statements

From Vito De Tullio <vito.detullio@gmail.com>
Subject Re: new to While statements
Date 2013-08-07 20:05 +0200
References <69a10630-98dc-4a31-89ef-2770b3c1fd70@googlegroups.com> <CAN1F8qVtj3coXU_Q-VeJfvSmx3=C6q4QoJx5nOq0AUy_2Hb4QQ@mail.gmail.com> <mailman.296.1375852843.1251.python-list@python.org> <90lMt.30102$907.25512@fx17.iad>
Newsgroups comp.lang.python
Message-ID <mailman.325.1375898730.1251.python-list@python.org> (permalink)

Show all headers | View raw


Dan Sommers wrote:

>>>         while "asking for reponse":
>> 
>>>         while "adventuring":
>> 
>> that's a funny way to say `while True:`...
> 
> Funny, perhaps, the first time you see it, but way more informative than
> the other way to the next one who comes along and reads it.

While I understand that it's syntactically and semantically correct, my nose 
still doesn't like it.

It's not that's just not common... I just think it's a mishmash... it's not 
a "rule" thing, more a "feeling wrong" one.

Maybe it's better if I try to explain in another way...

My first instinct about it it's to think why the author choose this way to 
talk to the reader.

This message it's clearly meant to be read by another programmer, not by the 
user. But in my mind it should be a comment. In my mind code explain "what" 
is happening, comment say "why". (Sometimes talking to my colleagues we say 
comment is a way to ask to forgiveness for a particular obscure code, as in 
"sorry, I needed to flip-this and flop-that for such-and-such reason") 

Following this reasoning, I will found more readable something like

    # asking for response
    while True:
        ...

that

    while 'asking for response':
        ...

because in the latter case the "why" and the "how" are mixed. It's like 
you're talking with the interpreter, but the message is for the programmer..

I hope I explained myself...




-- 
By ZeD

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

new to While statements krismesenbrink@gmail.com - 2013-08-06 20:38 -0700
  Re: new to While statements snakeinmyboot <mikelhamer@gmail.com> - 2013-08-06 21:09 -0700
    Re: new to While statements krismesenbrink@gmail.com - 2013-08-06 21:13 -0700
  Re: new to While statements snakeinmyboot <mikelhamer@gmail.com> - 2013-08-06 21:17 -0700
  Re: new to While statements Joshua Landau <joshua@landau.ws> - 2013-08-07 05:37 +0100
  Re: new to While statements Vito De Tullio <vito.detullio@gmail.com> - 2013-08-07 07:20 +0200
  Re: new to While statements Dan Sommers <dan@tombstonezero.net> - 2013-08-07 05:35 +0000
    Re: new to While statements snakeinmyboot <mikelhamer@gmail.com> - 2013-08-06 22:42 -0700
      Re: new to While statements Dan Sommers <dan@tombstonezero.net> - 2013-08-07 05:52 +0000
        Re: new to While statements krismesenbrink@gmail.com - 2013-08-06 23:26 -0700
    Re: new to While statements Vito De Tullio <vito.detullio@gmail.com> - 2013-08-07 20:05 +0200
    Re: new to While statements Dave Angel <davea@davea.name> - 2013-08-08 01:31 +0000
  Re: new to While statements Larry Hudson <orgnut@yahoo.com> - 2013-08-07 20:21 -0700

csiph-web