The Artima Developer Community
Sponsored Link

Python Buzz Forum
% interpolation

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ian Bicking

Posts: 900
Nickname: ianb
Registered: Apr, 2003

Ian Bicking is a freelance programmer
% interpolation Posted: Nov 6, 2003 12:01 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ian Bicking.
Original Post: % interpolation
Feed Title: Ian Bicking
Feed URL: http://www.ianbicking.org/feeds/atom.xml
Feed Description: Thoughts on Python and Programming.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ian Bicking
Latest Posts From Ian Bicking

Advertisement

It sure would be convenient if, in addition to %s, we could use %h or %u in strings, where '%h' % obj was equivalent to cgi.escape(str(obj), 1) and '%u' % obj was like urllib.quote(str(obj)). Where would it end? you might ask... but I think it could end right there. Other kinds of quoting (e.g., SQL quoting) are handled in a more context-sensitive fashion. Encoding (like base64, printed-quotable, and others) is handled nicely with the .encode and .decode methods. But I don't think URL and entity encoding are good candidates for "encoding" since you are only quoting particular values, not encoding whole representations. Or maybe they would be reasonable as codecs...? Maybe '%:html:s' % obj could mean str(obj).encode('html')...

Though maybe Guido would find this all to be too useful ;)

Read: % interpolation

Topic: Javascript Convert...? Previous Topic   Next Topic Topic: Dumping Elsevier

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use