Identi.ca Identi.ca
  • Login
  • Public

    • Public
    • Groups
    • Featured
    • Popular

Conversation

Notices

  1. Daniel Kinzler Daniel Kinzler Python

    !python #quirk: "%s, %s" % (a, b) fails if a is unicode and b is str and b contrains non-ascii chars. it works if both are str! #wtf

    Wednesday, 11-Aug-10 10:13:48 UTC from web
    • Singer Dan likes this.
    • Nicolas Évrard Nicolas Évrard Python

      @brightbyte it's not a bug it's a feature ! !python tries to learn you NOT TO mix unicode and st

      Wednesday, 11-Aug-10 10:16:57 UTC
    • Roberto Alsina Roberto Alsina Python

      @brightbyte try using u"%s, %s" like a good boy. !python

      Wednesday, 11-Aug-10 12:19:26 UTC
    • Marc Rintsch Marc Rintsch Roberto Alsina

      @ralsina That still fails when b contains non-ascii. So @brighbyte has to learn about unicode anyway.

      Wednesday, 11-Aug-10 12:46:08 UTC
    • Markus Stumpf Markus Stumpf Python , Roberto Alsina

      @ralsina wont work either !python try: a=unicode("a"); b="ä"; print u"%s %s" % (a,b)

      Wednesday, 11-Aug-10 12:54:30 UTC
    • Roberto Alsina Roberto Alsina Marc Rintsch

      @bj did you try it? It works: http://is.gd/ecWjE -- The u"%s %s" means both are coerced to unicode when interpolated, so there's no problem.

      Wednesday, 11-Aug-10 12:55:28 UTC
    • Roberto Alsina Roberto Alsina Markus Stumpf

      @maex Oh, a is unicode and b is a non-ascii str! I got them the other way around! !python

      Wednesday, 11-Aug-10 12:56:19 UTC
    • Daniel Kinzler Daniel Kinzler Roberto Alsina

      @ralsina tried u"%s %s", did no good. even more confusing. anyway, doing everything in u and encoding the whole s at the very end works.

      Wednesday, 11-Aug-10 16:02:55 UTC

Site notice

  • API
  • Status

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Identi.ca is a microblogging service brought to you by Status.net. It runs the StatusNet microblogging software, version 1.1.0-alpha1, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Identi.ca content and data are available under the Creative Commons Attribution 3.0 license.

Switch to mobile site layout.

Built in Montreal