python3x: print vs evaluate

piazzaでこんな質問を見つけた。

>
_I don't understand why print removes the quotations marks from its operand(s), whereas simple evaluation does not._
>
_For instance,_
>
```
>>> print('xyz')
xyz
```
>
_but_
>
``` 
>>> 'xyz'
'xyz'
```
>
_I feel like this has something to do with the fact that what print displays is a side effect, not its output. Also, I imagine this has to do with the subtle distinction between expression and value for objects of <class 'str'>. But for the life of me I don't see how it all ties together._

たしかに考えてみたらpython interpreter上だと`print`を使った時と単にevaluation（print抜きで中身だけを入れた場合）とでは中身は同じだが`print`の時だけクォーテーションマークがなくなって表示される。

>
_That's exactly it! print means "take this string and paste it into the terminal". On the other hand, when you type an expression that evaluates to a string, the Python interpreter displays a representation of that value. Since strings are surrounded with quotes in their Python representation, it shows the quotes._
>
_The print function returns the special value None, which is not displayed by the interpreter:_
>
```
>>> None
>>> # no output, asking for more input
```
>
_so when you print a string, it has the side effect of outputting to the terminal, and the final value is None, which is ignored by the interpreter._
>
We'll learn a little bit later in the course that what the interpreter does is print(repr(value)), where repr is a function that takes a value and returns a string, the Python __repr__esentation of that value:
>
```
>>> 5
5
>>> repr(5)
'5'
>>> print(repr(5))
5
```

ということは`print("xyz")`とinterpreter上に`"xyz"`とうって返ってきた値はそれぞれ違うものだと解釈することができる。クォーテーションマークもvalueの一部でありpython interpreterにおいてはstringはstandard way of representing valueであると。

>
_I feel like there's still a missing piece for me here, regarding expressions and values. There seems to be something Platonic going on. That is, the Python interpreter can't *actually* display a value, right? The sense I have is that a value is something floating out in the "Platonosphere" (or more likely, a collection of bits). I imagine that what the interpreter displays is akin to a *canonical* expression for a particular value. Is this at all the case?_
>
_So when I input_
>
```
>>> 5 + 2
```
>
_I get_
>
```
>>> 5 + 2
7
```
>
_It's not that 7 "is" the value of this expression; rather, it's that 7 is the standard way of expressing the value that 5 + 2 represents. At least, this is how I've been thinking of it._

この質問への回答で割りとクリアになってくる:
>
_That's a good way of thinking about it. The interpreter can only print strings. It's the job of the repr function to turn that abstract Python value into a string which can be outputted to the terminal. Here's some examples:_
>
```
>>> repr(5)  # returns a string with one character, the digit 5
'5'
>>> repr('hello')  # puts quotes around hello; in the output, the single quotes are part of the string
"'hello'"
```
>
_It's correct to say something like "7 is the value of the expression 2 + 5", because we mean the integer 7 (an abstract Python value). The string '7' is the standard representation of the integer 7, so the string '7' gets printed out._

つまりpython interpreter上ではストリング以外（全てかどうかはわからないが）はabstract valueとして解釈されている。それをthe standard representation of the valueにするにはストリングにする必要がある。そのため`repr`（as in __repr__sentation of that value）ということなんですね。