Gerard Brunick wrote:
> It seems the question is more about what does print do. Lets extend
> your example:
>
> >>> d=unicode("Caf\xe9", "Latin-1")
> >>> repr(d)
> "u'Caf\\xe9'"
> >>> print d
> Café
> >>> str(d)
> Traceback (most recent call last):
> File "", line 1, in
> UnicodeEncodeError: 'a
Gary Herron wrote:
> Gerard Brunick wrote:
>> I really don't understand the following behavior:
>>
>> >>> class C(object):
>> ... def __init__(self, s): self.s = s
>> ... def __str__(self): return self.s
>> ...
>> >>> cafe = unicode("Caf\xe9", "Latin-1")
>> >>> c = C(cafe)
>> >>> print
Gerard Brunick wrote:
> I really don't understand the following behavior:
>
> >>> class C(object):
> ... def __init__(self, s): self.s = s
> ... def __str__(self): return self.s
> ...
> >>> cafe = unicode("Caf\xe9", "Latin-1")
> >>> c = C(cafe)
> >>> print "Print using c.s:", c.s
> Prin
I really don't understand the following behavior:
>>> class C(object):
... def __init__(self, s): self.s = s
... def __str__(self): return self.s
...
>>> cafe = unicode("Caf\xe9", "Latin-1")
>>> c = C(cafe)
>>> print "Print using c.s:", c.s
Print using c.s: Café
>>> print "Print using