Python Peculiarities

While completing the python multiplication assignment, I was able to gain a little insight into how python treats standard input from the keyboard.  It seems that python can be told to treat STDIN as a list so a user can iterate through it in a for loop however if this is the case, the for loop waits until the entire input is given from the user with the EOF character before it starts go through the for loop.  This creates limits on line based interactive programming.  The solution was to place STDIN in an iterator and have the for loop iterate through the iterator which then allowed for each line of the code entered by the user to be inspected individually.

Leave a Reply