Py3.3 unicode literal and input()

jmfauth wxjmfauth at gmail.com
Mon Jun 18 10:00:01 EDT 2012


On 18 juin, 12:11, Steven D'Aprano <steve
+comp.lang.pyt... at pearwood.info> wrote:
> On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote:
> > On 18 juin, 10:28, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
> >> The u prefix is only there to
> >> make it easier to port a codebase from Python 2 to Python 3. It doesn't
> >> actually do anything.
>
> > It does. I shew it!
>
> Incorrect. You are assuming that Python 3 input eval's the input like
> Python 2 does. That is wrong. All you show is that the one-character
> string "a" is not equal to the four-character string "u'a'", which is
> hardly a surprise. You wouldn't expect the string "3" to equal the string
> "int('3')" would you?
>
> --
> Steven


A string is a string, a "piece of text", period.

I do not see why a unicode literal and an (well, I do not
know how the call it) a "normal class <str>" should behave
differently in code source or as an answer to an input().

Should a user write two derived functions?

input_for_entering_text()
and
input_if_you_are_entering_a_text_as_litteral()

---

Side effect from the unicode litteral reintroduction.
I do not mind about this, but I expect it does
work logically and correctly. And it does not.

PS English is not my native language. I never know
to reply to an (interro)-negative sentence.

jmf



More information about the Python-list mailing list