[Python-Dev] Python Design issue with print() function

Chris Barker chris.barker at noaa.gov
Wed Mar 8 12:18:44 EST 2017


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 at 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 at 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 at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170308/cc648dfc/attachment.html>


More information about the Python-Dev mailing list