Why doesn't Python include non-blocking keyboard input function?

BartC bc at freeuk.com
Thu Oct 27 19:45:03 EDT 2016


On 27/10/2016 23:31, Chris Angelico wrote:
> On Fri, Oct 28, 2016 at 9:02 AM, BartC <bc at freeuk.com> wrote:
>>
>> I notice that when it comes to reading command-line arguments, then Python's
>> sys.argv presents them as a list, not one long string.
>>
>> And the list is just a series of strings, so needing to know whether any
>> parameter was a number or whatever obviously wasn't a problem. It just makes
>> each item into a string (actually that might be a better default than mine).
>>
>> This is a very similar issue to reading items from a line of user input.
>>
>> So why doesn't sys.argv just return a single string if a line is so easy to
>> parse?
>
> Because the OS provides a series of strings, not just one string.

I don't think that's the case on Windows. Perhaps on Unix.

  When
> you exec to a process, you provide multiple arguments, not a single
> combined string.

Really, there could be dozens of arguments? Windows' CreateProcess() (if 
that's the same thing) has ten of which one is the command-line as a 
single string, while C's system() just has one.

This might just be one of those Unixisms that doesn't apply on all 
platforms.


-- 
Bartc



More information about the Python-list mailing list