[Tutor] What's the difference between %s and %r?

2011-07-23 Thread amt
Hello! I'm having troubles understanding what is the difference between %s and %r(format characters). I did google and found something on StackOverflow but I don't understand the explanation as it's not beginner orientated. Also, I have this code from learn python the hard way. Why at line 9 doe

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread Wayne Werner
On Sat, Jul 23, 2011 at 7:48 AM, amt <0101...@gmail.com> wrote: > Hello! I'm having troubles understanding what is the difference between %s > and %r(format characters). I did google and found something on > StackOverflow but I don't understand the explanation as it's not beginner > orientated. >

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread Lisi
On Saturday 23 July 2011 13:48:03 amt wrote: > Hello! I'm having troubles understanding what is the difference between %s > and %r(format characters). I did google and found something on > StackOverflow but I don't understand the explanation as it's not beginner > orientated. > > > Also, I have th

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread Martin A. Brown
Hello everybody, : > Hello! I'm having troubles understanding what is the difference between %s : > and %r(format characters). I did google and found something on : > StackOverflow but I don't understand the explanation as it's not beginner : > orientated. : > : > : > Also, I have this co

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread James Reynolds
I just use string{0}.format(arg) format and that solves needing to memorize % whatevers. On Sat, Jul 23, 2011 at 11:08 AM, Martin A. Brown wrote: > > Hello everybody, > > : > Hello! I'm having troubles understanding what is the difference > between %s > : > and %r(format characters). I did goog

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread Joel Goldstick
On Sat, Jul 23, 2011 at 8:48 AM, amt <0101...@gmail.com> wrote: > Hello! I'm having troubles understanding what is the difference between %s > and %r(format characters). I did google and found something on > StackOverflow but I don't understand the explanation as it's not beginner > orientated. >

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-23 Thread dave
Thank you for the two explanations. I think I have a good idea of what is going on now with the arguments and keyword arguments. My only remaining question is the pad_for_usrp argument. The default value is True so I thought it was a boolean and couldn't have anything to do with the "self" that

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread wesley chun
%s = send object to str() first then drop it into the string %r = send object to repr() first then drop it into the string pretty straightforward: >>> x = 'foo' >>> str(x) 'foo' >>> repr(x) "'foo'" why do people do %r at all? to get the quotes for free: :-) >>> x = 'Python' >>> print "What is t

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread wesley chun
i forgot to define these: str() - printable/human-readable string representation of an object repr() - evaluatable string representation of an object (can "eval()" it, meaning it is a string representation that evaluates to a Python object) in other words: x = 'foo' str(x) > 'foo'

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-23 Thread Alan Gauld
dave wrote: My only remaining question is the pad_for_usrp argument. The default value is True so I thought it was a boolean and couldn't have anything to do with the "self" that was passed to it. However, I can probably puzzle that out by looking at how it's used in the code. I thought th

[Tutor] Copying Variables

2011-07-23 Thread Ryan Strunk
Hello everyone, How can I make two copies of a dictionary that don't point to the same location in memory? My plan is to generate d1 and make d2 a copy of d1. After the user modifies d1 I want him/her to be able to return to the initial dictionary (d2) values. I tried: d1 = {values} d2 = dict(d1) t

Re: [Tutor] Copying Variables

2011-07-23 Thread Steven D'Aprano
Ryan Strunk wrote: Hello everyone, How can I make two copies of a dictionary that don't point to the same location in memory? My plan is to generate d1 and make d2 a copy of d1. After the user modifies d1 I want him/her to be able to return to the initial dictionary (d2) values. I tried: d1 = {va

[Tutor] Question related to Tkinker

2011-07-23 Thread Emeka
Hello All, I am putting up a simple game .. the game is about manipulation. If the gets through level one ... I have to change the word with another... Am I going to destroy level window and build level 2 or is there a way to just adjust the word (I used labels) Regards, Janus -- *Satajanus N