Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'wed,': 0.03; 'string.': 0.04; 'subject:string': 0.09; '25,': 0.12; 'am,': 0.14; 'debugging': 0.14; 'wrote:': 0.14; '9:13': 0.16; 'cc:name:python list': 0.16; 'guys!': 0.16; 'repr()': 0.16; 'stumping': 0.16; 'subject:Newbie': 0.16; 'subject:questions': 0.16; 'to:addr:comp.lang.python': 0.16; 'wednesday,': 0.16; 'received:74.125.82.174': 0.16; 'received:mail- wy0-f174.google.com': 0.16; 'cc:addr:python-list': 0.17; 'header :In-Reply-To:1': 0.21; "haven't": 0.22; 'cc:2**0': 0.22; 'url:mailman': 0.26; 'classes': 0.26; 'string': 0.26; 'wondering': 0.28; 'message-id:@mail.gmail.com': 0.28; 'thanks': 0.28; 'cc:addr:python.org': 0.30; 'url:listinfo': 0.30; 'objects.': 0.30; 'it.': 0.31; 'seem': 0.32; "can't": 0.32; 'does': 0.33; 'things': 0.33; 'chris': 0.34; 'showing': 0.34; 'do?': 0.35; 'considered': 0.36; 'received:google.com': 0.37; 'useful': 0.37; 'url:python': 0.38; 'received:74.125.82': 0.38; 'received:74.125': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'should': 0.39; 'format': 0.40; 'your': 0.60; 'order': 0.62; 'to:addr:googlegroups.com': 0.63; 'overload': 0.67; 'enclosed': 0.68; 'anywhere.': 0.84; 'surface': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Moa9lrzjfuIVYt7ob0ISDPKMBOPQsDJSnnf21LLQqGs=; b=DKyKj3HXD1xMghDgXHXSLgKP+x3Ck2UapKSOeNzlEn0aJh2O9rOYel+YmpnhMuhVaD N4YcZOFKZMPJKEZ9p/smHYXAyZu3rrHd9QTAQvw/de2/4a9MQXqk3tlcjdemSrWZBR+s pAURbO0Q/N252w5eA0oro32LoZ4h7yfdlFRgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Cf9CZ4QB4Nt/W+lmNah+zrkZhetmKX5FkQ20QsuPg7WT5U9DC4F/yvxgyG2zR9BX4s JTsFIdPKZ4o7Jd6WkmxAHDdvc1mE4AJIoxuZvh0TlQYjukOLYBnGk4k4ugfzdjpo9y5g CSFNk6FUrTeEoC6N9AC9iNCadnbv5qMjopqzw= MIME-Version: 1.0 In-Reply-To: <997e06dd-55dc-4b45-9ff2-97f24dd49908@glegroupsg2000goo.googlegroups.com> References: <997e06dd-55dc-4b45-9ff2-97f24dd49908@glegroupsg2000goo.googlegroups.com> Date: Wed, 25 May 2011 09:21:29 -0400 Subject: Re: Newbie string questions From: Matty Sarro To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Python list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306329690 news.xs4all.nl 49041 [::ffff:82.94.164.166]:36062 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6240 Thanks guys! I appreciate it. I was wondering why %r was always showing things enclosed in single-quotes. On Wed, May 25, 2011 at 9:13 AM, Chris Guidry wrote: > On Wednesday, May 25, 2011 9:06:02 AM UTC-4, Matty Sarro wrote: >> can't seem to find some of the items in the documentation. Right now >> what is stumping me... what exactly does %r do? I can't find it in the >> documentation anywhere. > > Matty, %r in a format string is very much like %s. =C2=A0%s calls str(you= r_object) in order to produce the resulting string. =C2=A0%r calls repr(you= r_object). =C2=A0Generally, you'd want to use %s for strings that will surf= ace to a user, while %r is great for debugging and logging. > > Also, if you haven't come across repr(), you should be able to find that = in the docs; it's also considered good practice to overload repr() in your = own classes in order to provide a useful representation for your objects. > -- > http://mail.python.org/mailman/listinfo/python-list >