[Tutor] [Re] Fwd: Strings backwards

2006-01-18 Thread János Juhász
Hi Ryan, I just extended Adam's code with a speech-to-text recepi from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/114216. On 18/01/06, ryan luna <[EMAIL PROTECTED]> wrote: > > Hello, what i need to do is get user input and then > print the string backwards ^^ i have no idea how to do

Re: [Tutor] References and list aliasing in Perl and Python [Was: Re: Dictionaries]

2006-01-18 Thread Danny Yoo
> > There are tradeoffs here. On the one hand, Python folks get caught > > off guard when they first encounter list aliasing. On the other, Perl > > folks get caught off guard when they first try to make a hash whose > > values are themselves lists. *grin* > > > WOW. Great explanation. Don't wor

Re: [Tutor] Open file error

2006-01-18 Thread andy senoaji
Thanks Danny & Alan,your print repr(os.listdir("C:/")) has embarrased myself :(. I found out the file name is Test.txt.txt in my c: drive. I guess I learn something here.Again ThanksAndy On 1/17/06, Danny Yoo <[EMAIL PROTECTED]> wrote: On Tue, 17 Jan 2006, andy senoaji wrote:> I'm back to my home m

[Tutor] How does [::-1] work?

2006-01-18 Thread Intercodes
John,>Basically, the syntax is [start:stop:step] I have read some 2 or 3 introductory tutorials on python and have never found this syntax or maybe I forgot to note this one. This one seems certainly useful in some cases. > HTH!yes, it does.!-- Intercodes ___

Re: [Tutor] How does [::-1] work?

2006-01-18 Thread John Fouhy
On 19/01/06, Intercodes <[EMAIL PROTECTED]> wrote: > I tried that expression in my intepreter and various other combination but > still can't comprehend how the expression works. I could understand[:] , > [n:] or [:n] . But what meaning does it have in using two colons inside > array index while s

Re: [Tutor] copyright statement

2006-01-18 Thread Terry Carroll
On Thu, 19 Jan 2006, John Fouhy wrote: > Open mouth, insert foot, echo internationally... No, it wasn't a dumb question. I remember wondering about "quit" some time ago: if Python can see your "command" quit, why doesn't it just quit, instead of telling you how to quit with Ctrl-Z, Ctrl-D, or

[Tutor] How does [::-1] work?

2006-01-18 Thread Intercodes
Hello Everyone,There was a query in this list regarding reversing a string and someone suggested that [::-1] does that.I tried that _expression_ in my intepreter and various other combination but still can't comprehend how the _expression_ works. I could understand[:] ,  [n:] or  [:n] . But what m

Re: [Tutor] namespace confusion

2006-01-18 Thread Kent Johnson
Christopher Spears wrote: > Let's say I have two classes: > > class super: > > ... def hello(self): > ... self.data1 = 'spam' > ... > class sub(super): > > ... def hola(self): > ... self.data2 = 'eggs' > ... > > Now let's look in the classes' namespaces using >

Re: [Tutor] copyright statement

2006-01-18 Thread John Fouhy
On 19/01/06, Terry Carroll <[EMAIL PROTECTED]> wrote: > copyright isn't a statement, it's just a variable: Oops! I was tricked by emacs giving it the same highlighting as statements like 'assert'. (although, come to think of it, emacs highlights 'self' and 'None' as well :-/ ) Open mouth, insert

[Tutor] yeah

2006-01-18 Thread ryan luna
Hi Hans and Adam, Just wanted to point out: next time, let's try to figure out why Ryan had problems with this, rather than directly give a working answer. For example, we can ask things like: what part did Ryan get stuck on? Was it unfamiliarity with the things we can do with slices, or someth

Re: [Tutor] copyright statement

2006-01-18 Thread Terry Carroll
On Thu, 19 Jan 2006, John Fouhy wrote: > Anyone know anything about the 'copyright' statement? help(copyright) > is not ultra helpful, and I can't see anything in the docs (eg, > http://python.org/doc/2.4.2/ref/simple.html doesn't list it). Is it > ever intended to be used in normal code? No, no

Re: [Tutor] Jumble

2006-01-18 Thread Danny Yoo
On Wed, 18 Jan 2006, ryan luna wrote: > Ok so what i have to do is make it so when a player ask for a hint the > program display a hint, heres my loop, not whole script. > > guess = raw_input("\nYour guess: ") > guess = guess.lower() > while (guess != correct) and (guess != ""): > print "Sor

Re: [Tutor] Strings backwards

2006-01-18 Thread Danny Yoo
On Thu, 19 Jan 2006, Hans Dushanthakumar wrote: > Try this: > > print word[::-1] Hi Hans and Adam, Just wanted to point out: next time, let's try to figure out why Ryan had problems with this, rather than directly give a working answer. For example, we can ask things like: what part did Ryan

[Tutor] copyright statement

2006-01-18 Thread John Fouhy
Anyone know anything about the 'copyright' statement? help(copyright) is not ultra helpful, and I can't see anything in the docs (eg, http://python.org/doc/2.4.2/ref/simple.html doesn't list it). Is it ever intended to be used in normal code? -- John. _

Re: [Tutor] Jumble

2006-01-18 Thread Adam
On 19/01/06, ryan luna <[EMAIL PROTECTED]> wrote: Ok so what i have to do is make it so when a playerask for a hint the program display a hint, heres myloop, not whole script.guess = raw_input("\nYour guess: ")guess = guess.lower()while (guess != correct) and (guess != ""): print "Sorry, that's

[Tutor] Jumble

2006-01-18 Thread ryan luna
Ok so what i have to do is make it so when a player ask for a hint the program display a hint, heres my loop, not whole script. guess = raw_input("\nYour guess: ") guess = guess.lower() while (guess != correct) and (guess != ""): print "Sorry, that's not it." print "If you need a hint ente

Re: [Tutor] a class knowing its self

2006-01-18 Thread Shuying Wang
Ben, If you change example #b to: for s in SkillNames: skill = Skill() skill.setName(s) print skill.getName() You will find that the results are the same as #a. In your #b example, you are giving setName() the skill instance instead of the string you intended. --Shuying On 1/19/06, Be

Re: [Tutor] References and list aliasing in Perl and Python [Was: Re: Dictionaries]

2006-01-18 Thread Victor Bouffier
On Tue, 2006-01-17 at 22:57 -0800, Danny Yoo wrote: > > > The terminology that the original poster uses ("references to another > > > object") sounds a lot like the original usage of symbolic "soft" > > > references in Perl. > > > (http://www.perl.com/doc/manual/html/pod/perlref.html) > > > > > > P

[Tutor] a class knowing its self

2006-01-18 Thread Ben Vinger
Hello I've been reading about how a class has access to its own 'self', so I tried the following, but it is not working as I would expect: class Skill: def __init__(self): self.history = [] def setName(self, skill): self.name = skill def getName(self): return se

Re: [Tutor] Strings backwards

2006-01-18 Thread Adam
On 18/01/06, ryan luna <[EMAIL PROTECTED]> wrote: --- Adam <[EMAIL PROTECTED]> wrote:> On 18/01/06, ryan luna <[EMAIL PROTECTED]>> wrote: > >> > Hello, what i need to do is get user input and> then> > print the string backwards ^^ i have no idea how> to do> > that,> >> > print "Enter a word and i w

Re: [Tutor] namespace confusion

2006-01-18 Thread bob
At 02:25 PM 1/18/2006, Christopher Spears wrote: Let's say I have two classes: >>> class super: ... def hello(self): ... self.data1 = 'spam' ... >>> class sub(super): ... def hola(self): ... self.data2 = 'eggs' ... Now let's look in the classes' namespaces using __dict__:

[Tutor] Fwd: Strings backwards

2006-01-18 Thread Adam
On 18/01/06, ryan luna <[EMAIL PROTECTED] > wrote: Hello, what i need to do is get user input and thenprint the string backwards ^^ i have no idea how to dothat,print "Enter a word and i well tell you how to say itbackwards"word = raw_input("Your word: ") print wordall that is simple enough im sure

Re: [Tutor] Strings backwards

2006-01-18 Thread Hans Dushanthakumar
Try this: print word[::-1] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ryan luna Sent: Thursday, 19 January 2006 12:13 p.m. To: tutor@python.org Subject: [Tutor] Strings backwards Hello, what i need to do is get user input and then print the string

[Tutor] Strings backwards

2006-01-18 Thread ryan luna
Hello, what i need to do is get user input and then print the string backwards ^^ i have no idea how to do that, print "Enter a word and i well tell you how to say it backwards" word = raw_input("Your word: ") print word all that is simple enough im sure printing it out backwards is to, just d

[Tutor] namespace confusion

2006-01-18 Thread Christopher Spears
Let's say I have two classes: >>> class super: ... def hello(self): ... self.data1 = 'spam' ... >>> class sub(super): ... def hola(self): ... self.data2 = 'eggs' ... Now let's look in the classes' namespaces using __dict__: >>> sub.__dict__ {'__module__': '__main__', '__d

Re: [Tutor] [OT] How to report issues with Standard library modules

2006-01-18 Thread Kent Johnson
Liam Clarke wrote: > Hi all, > > After having a frustrating night last night trying to install pyid3lib > on XP, which I think is due to something in distutils.core, I'm > wondering how I should report it. > > I have the dotNET framework 2.0 installed, which should give distutils > access to the

Re: [Tutor] Internet programming with python

2006-01-18 Thread Johan Geldenhuys
Thanks, Kent. I found this one also. There is a wide range of tutorials here. Johan Kent Johnson wrote: >Johan Geldenhuys wrote: > > >>Wesley, >> >>I am doing some socket programming in my work and I need to learn about >>writing webpages and CGI stuff in Pyhon. I have Apache on my PC and >

Re: [Tutor] Internet programming with python

2006-01-18 Thread Kent Johnson
Johan Geldenhuys wrote: > Wesley, > > I am doing some socket programming in my work and I need to learn about > writing webpages and CGI stuff in Pyhon. I have Apache on my PC and > could start and write some pages to test on it. It is still a bit vage > to me how to do that and thought that

Re: [Tutor] Internet programming with python

2006-01-18 Thread Johan Geldenhuys
Wesley, I am doing some socket programming in my work and I need to learn about writing webpages and CGI stuff in Pyhon. I have Apache on my PC and could start and write some pages to test on it. It is still a bit vage to me how to do that and thought that a book like hat could be beneficial

Re: [Tutor] Internet programming with python

2006-01-18 Thread w chun
On 1/18/06, Johan Geldenhuys <[EMAIL PROTECTED]> wrote: > > Has the book 'Internet programming with Python' (ISBN: 1558514848, > publisher: M&T Books, 1996) ever been revised or is there a secod editin > available? > I don't have it, but I would like this or something simular very much. > > Any ide

[Tutor] Internet programming with python

2006-01-18 Thread Johan Geldenhuys
Hi all, Has the book 'Internet programming with Python' (ISBN: 1558514848, publisher: M&T Books, 1996) ever been revised or is there a secod editin available? I don't have it, but I would like this or something simular very much. Any ideas what the status is or where I can find it? Thanks, Joh