[Python-Dev] Python Design issue with print() function (original) (raw)
Chris Barker chris.barker at noaa.gov
Wed Mar 8 12🔞44 EST 2017
- Previous message (by thread): [Python-Dev] Python Design issue with print() function
- Next message (by thread): [Python-Dev] iscoroutinefunction vs. coroutines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
this has nothing to do with the print function -- it is simply printing what you are asking it to print.
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: >>> strary="abcdef" >>> print(strary[1]) b >>> print(strary[4]) e >>> print(strary[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. strary array position >=1 and < 4_ _Solution:_ _User experience will be better if the code is updated to get last_ _character._ _i.e strary 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>
- Previous message (by thread): [Python-Dev] Python Design issue with print() function
- Next message (by thread): [Python-Dev] iscoroutinefunction vs. coroutines
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]