Re: Why does the "".join(r) do this?

From: John Roth (newsgroups_at_jhrothjr.com)
Date: 05/20/04


Date: Thu, 20 May 2004 14:56:57 -0400


"Ivan Voras" <ivoras@__geri.cc.fer.hr> wrote in message
news:c8itrm$epg$1@bagan.srce.hr...
> Peter Otten wrote:
>
> > Skip Montanaro wrote:
> >
> >
> >>Try
> >>
> >> u"".join(r)
> >>
> >>instead. I think the join operation is trying to convert the Unicode
bits
> >>in your list of strings to strings by encoding using the default codec,
> >>which appears to be ASCII.
> >
> >
> > This is bound to fail when the first non-ascii str occurs:
>
> Is there a way to change the default codec in a part of a program?
> (Meaning that different parts of program deal with strings they know are
> in a specific different code pages?)

Does the encoding line (1st or second line of program) do this?
I don't remember if it does or not - although I'd suspect not.
Otherwise it seems like a reasonably straightforward function
to write.

John Roth
>
>
> --
> C isn't that hard: void (*(*f[])())() defines f as an array of
> unspecified size, of pointers to functions that return pointers to
> functions that return void.



Relevant Pages

  • Re: Scheme and libraries -- piggyback on Java?
    ... The difference in the meaning of ... void for example is particularly annoying. ... pointers to be assigned to other pointer types without casting. ... However, as of C89, casting void pointers has been required just as in ...
    (comp.lang.scheme)
  • Re: Why does the "".join(r) do this?
    ... >>in your list of strings to strings by encoding using the default codec, ... Is there a way to change the default codec in a part of a program? ... void )defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void. ...
    (comp.lang.python)
  • Re: Pointer equality and dereferencing
    ... Two values have the same hypervalue if they have exactly the same ... It is not easy to compactly describe what the standard means when it ... printf-ing two pointers that are equivalent guarantees ... If we interpret "precise meaning" as any english people would, ...
    (comp.std.c)
  • Re: dbdebunk Quote of Week comment
    ... >>> and some key with a meaning for the end user. ... >>> eliminate pointers from the data model. ... this is only partly true. ... > content or the location of a row, it may have to do some index maintenance ...
    (comp.databases.theory)
  • Re: General remarks on restrict
    ... memcpy and that of memmove. ... And where does the standard explain what that meaning should be? ... I'd expect that to be mentioned somewhere in the standard. ... of the pointers is used to modify the object it refers to. ...
    (comp.std.c)