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


Groups > comp.lang.python > #73397

Re: Under what kind of situation, time.sleep(n) would sleep much longer than n seconds?

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 09:18 +0200
Organization A noiseless patient Spider
Message-ID <lnu2sb$r3d$1@dont-email.me> (permalink)
References <713f4189-5ffe-492d-9c7d-447bb4b4928a@googlegroups.com> <mailman.11114.1403087670.18130.python-list@python.org> <4d7c474a-b88e-4dea-b74c-ed34f4969310@googlegroups.com> <mailman.11128.1403134697.18130.python-list@python.org>

Show all headers | View raw


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. Almost all 
beginner's courses start with programs like that, requiring the user to 
key something in in the predefined order of the program. I've never seen 
a useful mature program working like that, only courseware and maybe 
crufty FORTRAN stuff from the past.

Unless there is good reason, make your program read the data from the 
command line args and from files given on the command line. This solves 
a lot of problems with user interaction, e.g. repeating and correcting 
commands. Programs written in the input() style are very annoying when 
you made a mistake in the 21st parameter of 30. Good interactive command 
line tools (e.g. gnuplot, Matlab, IPython, ...) exist, but they are 
complex; they bind to a readline library and implement a complex command 
language.

My advice:

1) First try parsing the command line. (Example: All Unix tools)

2) If you require more interaction and maybe state preservation, just 
write a couple of functions and run it in IPython (Example: SciPy)

3) Use a real GUI framework

It turns out, that 3) is actually not only easier to use, but often 
easier to write than 1)

	Christian

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


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