Why doesn't Python include non-blocking keyboard input function?
BartC
bc at freeuk.com
Sat Oct 29 11:32:07 EDT 2016
On 29/10/2016 16:24, Steve D'Aprano wrote:
> On Sun, 30 Oct 2016 01:32 am, BartC wrote:
>
>> (BTW the functionality of my 'readln a,b,c' differs from the above.
>> Separators can be anything reasonable. When eol is encountered, it will
>> read zeros. And errors are not handled: any non-numeric will yield zero.
>
> Ah, in other words it is a toy, utterly unsuitable for serious use by anyone
> who cares about data validity and error checking, only suitable for
> teaching bad habits to beginners.
So, how does Python differ? From what I've seen, you have to /write/ the
validation code (as I said in my last post). ANY language can do that too!
And the eol-handling behaviour is deliberate. If you want to read UP TO
three numbers but only two are entered on a line, some languages will
keep pestering you until you've entered that third number.
--
Bartc
More information about the Python-list
mailing list