(original) (raw)

This is a list for python interpreter development, not new ideas -- that list is python-ideas.

However, sorry to be blunt, but this post shows great ignorance of Python -- please study up more in the future before posting suggestions on any list.

Specifics:

1) this has nothing to do with the print function -- it is simply printing what you are asking it to print.

2) This does have to do with how slicing is done in Python, and that is very well justified and is not going to change.

Don't be discouraged, though -- keep learning about Python, but while you are, be sure to ask questions on python-tutor and the like before proposing changes!

-CHB

On Sat, Jan 28, 2017 at 8:21 AM, ravi y via Python-Dev <python-dev@python.org> wrote:
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()

Thanks
Ravi Yarlagadda


\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/chris.barker%40noaa.gov




--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov