Re: [Tutor] str.split and quotes

2005-04-09 Thread smiles
Kent Johnson wrote: Marilyn Davis wrote: Is there a reason to prefer one over the other? Is one faster? I compiled my regular _expression_ to make it quicker. The only way to know which is faster is to time them both. The timeit module makes it pretty easy to do this.Here is a simple example of

Re: [Tutor] newb problem running the translator (fwd)

2005-04-09 Thread Max Noel
On Apr 9, 2005, at 10:36, Danny Yoo wrote: -- Forwarded message -- Date: Fri, 8 Apr 2005 22:03:58 EDT From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: newb problem running the translator I will try to make this quick. I am a newb to python, and programming at that, but

Re: [Tutor] Support

2005-04-09 Thread Alberto Troiano
Hey dudes This code worked fine The one you gave me worked as well but when I wanteed to store it in the database it says that the packet was too large Whit this code it doesn't complain but now I don't know how to retrieve the image This is what I'm doing: import MySQLdb import Image import Image

[Tutor] How can I suspend...

2005-04-09 Thread John Carmona
I am off to sunny Spain for the next 2 weeks and I would like to suspend the emailing from Python.tutor for that period. Could someone put me in the right direction on how to do that, thanks. Regards JC ___ Tutor maillist - Tutor@python.org

[Tutor] import.... (Joseph Q.)

2005-04-09 Thread Joseph Quigley
I don't think I have said it already, but I'll say it again just incase :-), I'm new to python. I started Feb. this year. import is handy. But my questions are: is there a type of unimport or something to unload a module? Foo: What's it good for? ___

[Tutor] Re: Help with classes (Joseph Q.)

2005-04-09 Thread Joseph Quigley
class Message: def init(self, p = 'Hello world'): self.text = p def sayIt(self): print self.text m = Message() m.init() m.sayIt() m.init('Hiya fred!') m.sayIt() Well this OOP stuff is realy hard for me as I have never even programmed it took me a while just to understand defs.

RE: [Tutor] import.... (Joseph Q.)

2005-04-09 Thread Alberto Troiano
Hey Joseph Why do you want to unload a module? I don't understand why you need to "unimport" but I do know that every module has a constructor and a deconstructor maybe you can start from there but I will need an example or more info about why you need to do this Regards AlbertoFrom:

Re: [Tutor] str.split and quotes

2005-04-09 Thread Kent Johnson
Alberto Troiano wrote: Sorry to bother you that much. I know I have a lot to learn yet but I hope you can teach me. I see that someone posted something about running functions with a timer. How can I do this??? You can use the timeit module, see my recent post for an example. You can also use

Re: [Tutor] How can I suspend...

2005-04-09 Thread Kent Johnson
Go to the address at the bottom of this email. Unsubscribe. When you return, re-subscribe. Kent John Carmona wrote: I am off to sunny Spain for the next 2 weeks and I would like to suspend the emailing from Python.tutor for that period. Could someone put me in the right direction on how to do

Re: [Tutor] import.... (Joseph Q.)

2005-04-09 Thread Kent Johnson
Joseph Quigley wrote: I don't think I have said it already, but I'll say it again just incase :-), I'm new to python. I started Feb. this year. import is handy. But my questions are: is there a type of unimport or something to unload a module? This is not normally needed. Foo: What's it good

[Tutor] re: IDLE

2005-04-09 Thread Kevin
Is there a way to get line numbers to show in python IDLE? I looked at all the preferances but nothing? Thanks Kevin ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Help with classes (Joseph Q.)

2005-04-09 Thread Andrei
Joseph Quigley wrote on Fri, 08 Apr 2005 16:46:33 -0600: Now what are dictionaries and the __name__ really used for? A byte of python never got that through my thick skull. Dictionaries associate a value with a certain key, sort of like a real world dictionary where you can take a word and

[Tutor] quicksort using list comprehension

2005-04-09 Thread Logesh Pillay
I'm trying to program quicksort using list comprehension. The following gives me a type mismatch error for +. def qsort (t): if len (t) 1: return qsort([x for x in t[1:] if x = t[0]]) + [t[0]] + qsort([x for x in t[1:] if x t[0]]) I know this sounds strange but I have and idea it

Re: [Tutor] Associate functinos with Dictionary/Class Usage

2005-04-09 Thread Shane Liebling
Although I was not the questioner, I must admit this was a brief but efficient answer. Reminds me to try something like the last part out some time... -Shane On Apr 7, 2005 4:40 PM, Danny Yoo [EMAIL PROTECTED] wrote: On Thu, 7 Apr 2005, Luke Jordan wrote: I am looking for a little

Re: [Tutor] quicksort using list comprehension

2005-04-09 Thread Kent Johnson
I think you have to return a value when len(t) = 1. You don't return anything which means you return None which can't be added to a list. Kent Logesh Pillay wrote: I'm trying to program quicksort using list comprehension. The following gives me a type mismatch error for +. def qsort (t): if

Re: [Tutor] Re: Help with classes (Joseph Q.)

2005-04-09 Thread Kent Johnson
Joseph Quigley wrote: class Message: def init(self, p = 'Hello world'): self.text = p def sayIt(self): print self.text m = Message() m.init() m.sayIt() m.init('Hiya fred!') m.sayIt() This is OK but a more conventional usage is to write an __init__() method. This is sometimes called

Re: [Tutor] Support

2005-04-09 Thread Kent Johnson
Alberto Troiano wrote: Hey dudes This code worked fine The one you gave me worked as well but when I wanteed to store it in the database it says that the packet was too large Whit this code it doesn't complain but now I don't know how to retrieve the image I retrieve it like this:

Re: [Tutor] quicksort using list comprehension

2005-04-09 Thread Max Noel
On Apr 9, 2005, at 21:50, Kent Johnson wrote: I think you have to return a value when len(t) = 1. You don't return anything which means you return None which can't be added to a list. Kent Yup. Here's a quicksort I did, adapting an example from the Wikipedia article on Haskell: def

[Tutor] Re: Tutor Digest, Vol 14, Issue 32

2005-04-09 Thread Rick Muller
On Apr 9, 2005, at 1:54 PM, [EMAIL PROTECTED] wrote: Message: 8 Date: Sat, 09 Apr 2005 20:58:49 +0200 From: Logesh Pillay [EMAIL PROTECTED] Subject: [Tutor] quicksort using list comprehension To: Discussion for learning programming with Python tutor@python.org Message-ID: [EMAIL PROTECTED]

[Tutor] What is foo?

2005-04-09 Thread Danny Yoo
Foo: What's it good for? Foo and Bar are popular names used in examples. They don't mean anything. For example to show how to define a function I might write def foo(): print 'Hello' I just use foo to avoid having to think of a meaningful name. Hi Joseph, I sometimes get lazy and

[Tutor] problems with doctest: apparent interferance between tests (LONG)

2005-04-09 Thread Brian van den Broek
Hi all, I must apologize for the length of the post. I have explained my problem as tersely as able, and have done my level-best to produce the minimum code snippet illustrative of my difficulties. But, as (I hope) will become clear, any substantial attempts to further cull it made the problem