[Tutor] Why difference between printing string & typing its object reference at the prompt?

boB Stepp robertvstepp at gmail.com
Tue Oct 9 04:35:35 CEST 2012


Steve,

On Thu, Oct 4, 2012 at 6:28 AM, Steven D'Aprano <steve at pearwood.info> wrote:
<snip>
>
> Now, ask me about *raw strings*, and the difference between Unicode
> and byte strings :)

How can I resist asking! I am not in chapter 2 of my study text yet,
but looking ahead raw strings seem to be a method of declaring
everything within the quotes to be a literal string character
including the backslash escape character. Apparently this is
designated by using an r before the very first quote. Can this quote
be single, double or triple?

I am not up (yet) on the details of Unicode that Python 3 defaults to
for strings, but I believe I comprehend the general concept. Looking
at the string escape table of chapter 2 it appears that Unicode
characters can be either 16-bit or 32-bit. That must be a lot of
potential characters! It will be interesting to look up the full
Unicode tables. Quickly scanning the comparing strings section, I
wonder if I should have been so quick to jump in with a couple of
responses to the other thread going on recently!

I don't see a mention of byte strings mentioned in the index of my
text. Are these just the ASCII character set?

Since I have not made it formally into this chapter yet, I don't
really have specific questions, but I would be interested in anything
you are willing to relate on these topics to complete my introduction
to strings in Python. Or we can wait until I do get into the data
types chapter that looks at these topics in detail and have specific
questions.
-- 
Cheers!
boB


More information about the Tutor mailing list