[Tutor] SQLite3 DB Field Alphabetizing

David Hutto smokefloat at gmail.com
Wed Oct 13 19:35:22 CEST 2010


On Wed, Oct 13, 2010 at 9:27 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Thu, 14 Oct 2010 12:13:50 am David Hutto wrote:
>> I see it now. I knew that the u outside ' ' is the coding for the
>> string, but I thought I had to strip it before using it since that
>> was how it showed up. The bug of course would be that graphs that
>> start with u would go to the second letter, but the u would still be
>> used in alphabetization, because the alphabetizing is prior to
>> stripping.
>
> No, the u is not part of the string, it is part of the *syntax* for the
> string, just like the quotation marks. The first character of "abc" is
> a and not ", and the first character of u"abc" is also a and not u.
>
> Another way to think of it... the u" " of Unicode strings is just a
> delimiter, just like the [ ] of lists or { } of dicts -- it's not part
> of the string/list/dict.

I know, that why I said above.

>>I knew that the u outside ' ' is the coding for the
string,


.
>
> In Python 3 this confusion is lessened. Unicode strings (characters) are
> written using just " as the delimiter (or ' if you prefer), instead of
> u" " as used by Python 2. Byte strings are written using b" " instead.
> This makes the common case (text strings) simple, and the uncommon case
> (byte strings) more complicated.


Maybe it's how I said it here that was confusing:

>but the u would still be used in
alphabetization, because the alphabetizing is prior to stripping

by 'u' here, i meant that the only table I used with a u as the first
letter(i.e. u'u;table')
came back as ';table'. So I was seeing the aftermath of stripping u,
but no others were stripped except that on. And since I had placed
gibberish in at random, I didn't remember the 'u' in the actual table
name.
>
>
>
> --
> Steven D'Aprano
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

But thanks for the help buddy pal.


More information about the Tutor mailing list