It is possible derive your own string class from the built-in one and
override what 'repr' does (and make it do whatever you want). Here's an
example of what I mean:
# Sample #
# -*- coding: iso-8859-1 -*-
# Special string class to override the default
# representation method. Main purpo
JKPeck wrote:
> It seemed to me that this sentence
>
> For many types, this function makes an attempt to return a string that
> would yield an object with the same value when passed to eval().
>
> might mean that the encoding setting of the source file might influence
> how repr represented the co
It seemed to me that this sentence
For many types, this function makes an attempt to return a string that
would yield an object with the same value when passed to eval().
might mean that the encoding setting of the source file might influence
how repr represented the contents of the string. Noth
JKPeck wrote:
> Thanks for the quick answer. I thought repr was involved here, but
> when I use repr explicitly I get a notation where the backslashes are
> escaped. I also though that with the encoding explictily declared in
> the source, that repr would take that into account and use the
> cha
Thanks for the quick answer. I thought repr was involved here, but
when I use repr explicitly I get a notation where the backslashes are
escaped. I also though that with the encoding explictily declared in
the source, that repr would take that into account and use the
character form, but obviousl
"JKPeck" wrote:
>I am trying to understand why, with nonwestern strings, I sometimes get
> a hex display and sometimes get the string printed as characters.
>
> With my Python locale set to Japanese and with or without a # coding of
> cp932 (this is Windows) at the top of the file, I read a list o
I am trying to understand why, with nonwestern strings, I sometimes get
a hex display and sometimes get the string printed as characters.
With my Python locale set to Japanese and with or without a # coding of
cp932 (this is Windows) at the top of the file, I read a list of
Japanese strings into a