[Python-Dev] [Python-checkins] cpython: Issue #11049: adding some tests to test.support

Michael Foord fuzzyman at voidspace.org.uk
Wed Jul 27 11:50:40 CEST 2011


On 27/07/2011 03:04, Brett Cannon wrote:
>
>
> On Tue, Jul 26, 2011 at 17:41, Nick Coghlan <ncoghlan at gmail.com 
> <mailto:ncoghlan at gmail.com>> wrote:
>
>     On Wed, Jul 27, 2011 at 12:10 AM, Éric Araujo <merwok at netwok.org
>     <mailto:merwok at netwok.org>> wrote:
>     > Le 26/07/2011 15:30, Antoine Pitrou a écrit :
>     >> Actually, you want %a for non-ASCII messages to be escaped.
>     >
>     > Thanks for the reminder, I should use more %a instead of %r.  In the
>     > packaging code however, we can't, given that we want to backport.
>     >
>     >> (however, there's hardly any reason to worry about it when it
>     comes to
>     >> stdlib module names)
>     >
>     > I lacked context to see that.  If the code in question only ever
>     handles
>     > stdlib modules, then okay.
>
>     The other reason to use %r is to get the enclosing quotes in the
>     displayed message. That reason applies even in cases like this where
>     the escaping aspect isn't a concern.
>
>
> And then you make it {!r} so you can use str.format and you complete 
> the tweak of the string formatting! =) Seriously, though, it wouldn't 
> hurt to update it to use str.format().
>

Well, except that {!r} is twice as verbose as %r....

Michael

>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


-- 
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110727/632dbbfd/attachment.html>


More information about the Python-Dev mailing list