input function: built-in space between string and user-input

print function: built-in space between string and variable: The below python code, length = 5 print('Length is', length) gives an output of Length is 5 Even though we have not specified a space between 'Length is' and the variable length, Python puts it for us so that we get a clean nice output and the program is much more readable this way (since we don't need to worry about spacing in the strings we use for output). This is surely an example of how Python makes life easy for the programmer. input function: built-in space between string and user-input: However, the below python code, guess = int(input('Enter an integer')) gives an output of Enter an integer7 [Note: Assume 7 is entered by the user.] Suggestion: Similar to the printf function, for the input function also, it will be nice to have the Python put a space between string and user-input, so that the output in the above case will be more readable as below. Enter an integer 7 Thanks and Regards, Suriaprakash M, Principal Engineer - Software, Standard Microsystems India Pvt. Ltd., Module 1, 4th Floor, Block A, SP Infocity, #40, MGR Salai, Perungudi, Chennai - 600 096, Tamil Nadu, INDIA. Email: Suriaprakash.Mariappan@smsc.com Mobile :+919381453832 Skype ID: msuriaprakash

On 5/15/2012 6:46 AM, Suriaprakash.Mariappan@smsc.com wrote:
The */.../* and *_..._* bracketing makes you post harder to read. Perhaps this is used in India, but not elsewhere. Omit next time.
print() converts objects to strings and adds separators and a terminator before writing to outfile.write(). In 3.x, the separator, terminator, and outfile can all be changed from the default. The user is stuck with the fact that str(obj) is what it is, so it is handy to automatically tack something on. input() directly writes a prompt string with sys.stdout.write. There is no need to to augment that as the user can make the prompt string be whatever they want. In any case, a change would break back-compatibility. -- Terry Jan Reedy

On 15 May 2012 22:19, Terry Reedy <tjreedy@udel.edu> wrote:
They weren't present in the version I read. Probably a consequence of your mail client not being able to display formatted emails. Michael
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html

On 5/16/2012 6:27 AM, Ned Batchelder wrote:
I am reading the Gmane newsgroup mirror with Thunderbird. I have not seen it do anything similar with other mixed text/plain and text/html messages. So let me re-phrase by advice. "The Python mailings lists and newsgroups are, as usual, intended for plain text. Posting html or plaintext and html can have strange and unpredictable effects with various mail and news readers. So if you want people to see what you send, just use plain text, without tab characters." -- Terry Jan Reedy

On 5/15/2012 6:46 AM, Suriaprakash.Mariappan@smsc.com wrote:
The */.../* and *_..._* bracketing makes you post harder to read. Perhaps this is used in India, but not elsewhere. Omit next time.
print() converts objects to strings and adds separators and a terminator before writing to outfile.write(). In 3.x, the separator, terminator, and outfile can all be changed from the default. The user is stuck with the fact that str(obj) is what it is, so it is handy to automatically tack something on. input() directly writes a prompt string with sys.stdout.write. There is no need to to augment that as the user can make the prompt string be whatever they want. In any case, a change would break back-compatibility. -- Terry Jan Reedy

On 15 May 2012 22:19, Terry Reedy <tjreedy@udel.edu> wrote:
They weren't present in the version I read. Probably a consequence of your mail client not being able to display formatted emails. Michael
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html

On 5/16/2012 6:27 AM, Ned Batchelder wrote:
I am reading the Gmane newsgroup mirror with Thunderbird. I have not seen it do anything similar with other mixed text/plain and text/html messages. So let me re-phrase by advice. "The Python mailings lists and newsgroups are, as usual, intended for plain text. Posting html or plaintext and html can have strange and unpredictable effects with various mail and news readers. So if you want people to see what you send, just use plain text, without tab characters." -- Terry Jan Reedy
participants (4)
-
Michael Foord
-
Ned Batchelder
-
Suriaprakash.Mariappan@smsc.com
-
Terry Reedy