Py3.3 unicode literal and input()

Ian Kelly ian.g.kelly at gmail.com
Wed Jun 20 16:46:15 EDT 2012


On Jun 18, 2012 8:07 AM, "jmfauth" <wxjmfauth at gmail.com> wrote:
> 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().

Strings are a data type that contains characters.  String literals are
*not* strings.  They are a code syntax that is used to create actual string
objects.  Remember: strings are data, string literals are code.

input() does not accept string literals because it is a runtime feature
that reads data, not code.  It does not parse unicode literals or bytes
literals or "normal" string literals or integer literals or tuple literals
or any other kind of literal.  All that it reads is plain, uninterpreted
string data. If you want to do any processing of that data, you need to
specify it yourself.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120620/ba01dc0a/attachment.html>


More information about the Python-list mailing list