Re: computing with characters



Hallöchen!

Duncan Booth writes:

Torsten Bronger <bronger@xxxxxxxxxxxxxxxxxxxxx> wrote:

The biggest ugliness though is ",".join(). No idea why this should
be better than join(list, separator=" "). Besides, ",".join(u"x")
yields an unicode object. This is confusing (but will probably go
away with Python 3).

It is only ugly because you aren't used to seeing method calls on
string literals.

I am used to it. Programming very much with unicode, I use .encode
and .decode very often and I like them. I consider en/decoding to
be an intrinsic feature of strings, but not ord(), which is an
"external", rather administrative operation on strings (and actually
not even this, but on characters) for my taste.

However, join() is really bizarre. The list rather than the
separator should be the leading actor.

Tschö,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger@xxxxxxxxxx
(See http://ime.webhop.org for further contact info.)
.



Relevant Pages

  • Re: Elementtree and CDATA handling
    ... > you're confusing the external representation of something with the ... > data model. ... > the above are six ways to write the same string literal in Python. ... > you'll find that Python echoes the strings back as ...
    (comp.lang.python)
  • Re: computing with characters
    ... yields an unicode object. ... This is confusing (but will probably go ... away with Python 3). ... It is only ugly because you aren't used to seeing method calls on string ...
    (comp.lang.python)
  • Re: computing with characters
    ... yields an unicode object. ... This is confusing (but will probably go ... away with Python 3). ...
    (comp.lang.python)
  • Re: Unicode Hell
    ... I suppose Requestis a Unicode object, ... trying to do here is a brute force conversion to a normal Python ... What you could do is convert the Unicode object to a Python string, ... FileContents string. ...
    (comp.lang.python)
  • Re: Encoding and norwegian (non ASCII) characters.
    ... however when someone enters a name with one of the norwegian characters ... the text you write to the file should still be a plain string. ... Perhaps your Python configuration is different in some ... the text as a Unicode object will the method then try to encode the ...
    (comp.lang.python)