[Python-ideas] input function: built-in space between string and user-input

Suriaprakash.Mariappan at smsc.com Suriaprakash.Mariappan at smsc.com
Tue May 15 12:46:20 CEST 2012



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 at smsc.com
Mobile :+919381453832
Skype ID: msuriaprakash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120515/8becade3/attachment.html>


More information about the Python-ideas mailing list