[issue35544] unicode.encode docstring says return value can be unicode
New submission from radiocane : In Python 2.7.15rc1 the docstring for unicode.encode starts with: "S.encode([encoding[,errors]]) -> string or unicode" But if this answer https://stackoverflow.com/a/449281/5397695 is correct, then unicode.encode will never return a unicode object. Am I right? -- components: Unicode messages: 332203 nosy: ezio.melotti, radiocane, vstinner priority: normal severity: normal status: open title: unicode.encode docstring says return value can be unicode versions: Python 2.7 ___ Python tracker <https://bugs.python.org/issue35544> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35544] unicode.encode docstring says return value can be unicode
radiocane added the comment: Given that: 1) No standard codec returns unicode 2) I consider as "most common scenario" the case where a user wants to encode a unicode object using some character encoding and get back an str-like object I'll keep on finding "-> string or unicode" misleading. I'd rather have the same as str.encode i.e. "-> object". Anyway thanks for your time and attention :) -- ___ Python tracker <https://bugs.python.org/issue35544> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35544] unicode.encode docstring says return value can be unicode
radiocane added the comment: >> I'll keep on finding "-> string or unicode" misleading. > How is it misleading when its true? [I promise this is the last reply: I won't waste more of your time] me: How fast does this car go? docstring: 100 km/h or 300 km/h me: actually most people use it to do 100km/h and I don't know how to do 300 km/h people: no physical law forbids 300 km/h so it's true people2: if you remove the seats, the lights, the windshield etc and basically end up with a chassis with four wheels and a motor, it can do 300 km/h -- ___ Python tracker <https://bugs.python.org/issue35544> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com