[Python-Dev] Python Design issue with print() function
ravi y
y_ravi00 at yahoo.com
Wed Mar 8 07:38:14 EST 2017
Hi Python Developers,
print() function has a slight design issue, when user gives start and end positions of character array.Issue: >>> str_ary="abcdef" >>> print(str_ary[1]) b >>> print(str_ary[4]) e >>> print(str_ary[1:4]) bcd >>>
In the above scenario, user is expecting that output of print function will be bcde (not bcd).
Analysis: I kind of figured out what could be the issue. To get the string slice, "between" (or equivalent) was used. i.e. str_ary array position >=1 and < 4 Solution: User experience will be better if the code is updated to get last character. i.e str_ary array position >=1 and <= 4
Note: To keep the code as backward compatibility, you may come up with different name like printf()
ThanksRavi Yarlagadda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170308/92ecd057/attachment.html>
More information about the Python-Dev
mailing list