Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73439
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? |
| Date | 2014-06-19 19:17 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <lnv5ui$s1h$1@dont-email.me> (permalink) |
| References | (1 earlier) <mailman.11114.1403087670.18130.python-list@python.org> <4d7c474a-b88e-4dea-b74c-ed34f4969310@googlegroups.com> <mailman.11128.1403134697.18130.python-list@python.org> <lnu2sb$r3d$1@dont-email.me> <mailman.11135.1403163773.18130.python-list@python.org> |
Am 19.06.14 09:42, schrieb Chris Angelico:
> On Thu, Jun 19, 2014 at 5:18 PM, Christian Gollwitzer <auriocus@gmx.de> wrote:
>> Am 19.06.14 01:38, schrieb Chris Angelico:
>>
>>> a good console UI just requires this:
>>>
>>> something = raw_input("Enter something: ")
>>> print("Result: "+result)
>>
>>
>> That is actually one of the worst console UIs possible....
> I disagree. It may not be the *best* console UI, but it's not as bad
> as you think. Yes, what I wrote was a massive oversimplification, but
> compare this:
>
> https://github.com/Rosuav/runningtime/blob/master/runningtime.py#L44
>
> That's a simple, straight-forward UI. If you put the .py file onto
> your desktop and double-click it, you'll see a series of prompts, and
> this works on Windows, OS/2, probably Mac OS, and quite a few Linux
> desktops.
While I don't understand the purpose of the program (is it a game?), it
shows exactly why this is a bad idea. Here is my try (OSX):
Apfelkiste:Tests chris$ python runningtime.py
Enter track length in m: 20
Enter speed limit [400km/h]: 300
Enter track length in m: 10
Enter speed limit [400km/h]: 100
Enter track length in m: 0
()
[ 0.00] Power
[ 7.85] Enter next section (10m speed 100)
[ 8.00] Cruise
[ 9.49] Enter next section (0m speed 0)
Traceback (most recent call last):
File "runningtime.py", line 205, in <module>
nextsection, nextspeed = next(section)
StopIteration
Suppose I want to run it again, but have length 30 in the first step.
1.)How am I going to do this? I have to restart it and key in 4 numbers,
whereas I only wanted to change 1. Now let that be 10 segments.
2.) There is no way to save the input or the result. Or it may not be
obvious. I could prepare a file with the numbers, then do
python runningtime.py <input > output
But then I don't see the prompts and have to be careful not to enter a
speed for a length.
3.) The program doesn't tell me how to break out of the entering process
and start the computation. Is it a 0? Is it an empty string? I'm getting
Tracebacks in either case (could be wrong python version, I'm using the
OSX default 2.7.2)
All these problems arise because the program forces me to enter the data
in a predefined sequence. So no, this is not a good user experience. In
a GUI it would be trivial to have an editable listbox for track length
and speed, and a set of buttons to save, load, run the computation.
Christian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? crow <wentlv@gmail.com> - 2014-06-18 02:52 -0700
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Marko Rauhamaa <marko@pacujo.net> - 2014-06-18 13:30 +0300
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-18 20:34 +1000
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? crow <wentlv@gmail.com> - 2014-06-18 08:24 -0700
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-19 09:38 +1000
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? crow <wentlv@gmail.com> - 2014-06-18 18:41 -0700
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-19 13:58 +1000
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Christian Gollwitzer <auriocus@gmx.de> - 2014-06-19 09:18 +0200
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-19 17:42 +1000
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Marko Rauhamaa <marko@pacujo.net> - 2014-06-19 12:20 +0300
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Christian Gollwitzer <auriocus@gmx.de> - 2014-06-19 19:17 +0200
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-20 08:57 +1000
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Terry Reedy <tjreedy@udel.edu> - 2014-06-19 22:33 -0400
Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds? Chris Angelico <rosuav@gmail.com> - 2014-06-20 12:54 +1000
csiph-web