[Basics, Conditionals, and List Methods]: Corrected Typos, Formatting, & Grammar Issues#4179
Conversation
…als, and list-methods.
| Otherwise, returns the result of object.__str__() (if defined) | ||
| or repr(object). | ||
| encoding defaults to sys.getdefaultencoding(). | ||
| encoding defaults to 'utf-8'. |
There was a problem hiding this comment.
Was this statement just incorrect before? I think sys.getdefaultencoding() doesn't always return "utf-8".
There was a problem hiding this comment.
Since this example is copied directly from the terminal after running print(str.__doc__), I am assuming that it changed between Python versions. Not positive, but I think that this bit was last touched on Exercism prior to Python 3.11.5, but I can't find it in the history. You might be able to find the .__doc__ change for str in the Python language repo or docs (careful! these default to Python 3.14, so you need to search by Python version) somewhere, but you'd have to dig by Python version. It is the Python docsring for the str class/type.
There was a problem hiding this comment.
Huh... "utf-8" seems to have been the default as far back as Python 3.2, and the docs don't seem to specify the default before then. I wonder where the sys.getdefaultencoding() came from.
There was a problem hiding this comment.
Dunno. It might have been me or someone else running (unknowingly) a Python 2.7 version in an env. It's fixed now, tho. 🤷🏽♀️ These are the sorts of things that make me crazy when we upgrade the Python versions. 🙂 It's never "as simple as installing a new Python". 😉
Please see Issue 4165 for more details.