Guido said it would cause too much disturbance…

Jun 07, 2020 20:03


Originally published at www.ikriv.com. Please leave any comments there.

Python has two ways to convert an object to a string: str(x) and repr(x). str is supposed to be user-readable, and repr is more technical, e.g. for debugging purposes.

To my surprise, if I have a list of things, str(list) and repr(list) do the same thing and include a repr of each item. I would expect str(list) to include str of the list items, and repr(list) to include repr of the items.

Apparently, I am not alone: back in 2008 this was proposed by Oleg Broytman and Jim J. Jewett (PEP 3140), but rejected, because “Guido said it would cause too much disturbance too close to Beta“. It is causing disturbance ever since, I suppose…

hacker's diary

Previous post Next post
Up