[Tutor] newb problem running the translator (fwd)

2005-04-09 Thread Danny Yoo
-- 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 i am realy interested. I have been looking

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

RE: [Tutor] Talking to mssql?

2005-04-09 Thread j2
>I had the same question. The best I found is this: >http://www.object-craft.com.au/projects/mssql/ >but that has a lot of strong language saying "this isn't ready for use". > >I found it perfectly usable for simply running queries, but haven't tried >to do anything more complicated with it. Not

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 i

Re: [Tutor] str.split and quotes

2005-04-09 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I was glad to see your post showing how to run a list of functions through the timer. That's a nice way to do it! You better slip some square brackets into your definition of d though: d = dict( [((i,i,i), i) for i in range(1000)]) In Python 2.4 they are not nee

[Tutor] chr() and extended ASCII?

2005-04-09 Thread Liam Clarke
Hi all, Just working on some validators for text fields, and I started getting unusual errors -   File "C:\Python23\lib\site-packages\PythonCard\components\textfield.py", line 338, in _dispatch     widget.Widget._dispatch(self, aWxEvent)   File "C:\Python23\lib\site-packages\PythonCard\widget.p

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

Re: [Tutor] str.split and quotes

2005-04-09 Thread Alberto Troiano
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??? I tried to emulate this with the function time.sleep(sec) but all widgets gets locked and they don't refresh th

[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 http://ma

[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. Th

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 Alberto>From: Josep

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 ti

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 th

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 for

[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] Talking to mssql?

2005-04-09 Thread Lloyd Kvam
I replied earlier from a digest entry (which starts a new thread) so you might have missed that reply. I included a URL for the mssql package which included the compile instructions for using freetds. Here is the link. Just follow the instructions and you should be able to compile cleanly. http

Re: [Tutor] re: IDLE

2005-04-09 Thread joe_schmoe
Kevin wrote: 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 Not that I am aware of, although when y

[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 l

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

2005-04-09 Thread Andrei
Joseph Quigley wrote on Fri, 08 Apr 2005 16:58:37 -0600: > import is handy. But my questions are: > is there a type of unimport or something to unload a module? Things which are not used are cleaned up automatically at some point. What would you like to do do that this mechanism doesn't provide?

[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

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 litt

[Tutor] how useful is __del__()

2005-04-09 Thread Carsten Bohnens
hey, I wrote a small class that does some ftp work for me: #myftpclass.py class myftp: def __init__(self, ...): ... def connect_and_login(self): ... def do_foo(self): ... def do_bar(self): ... #here comes the interesting part for me def goodbye(self):

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): i

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 a

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: db=MySQLdb.c

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 qsort(toSo

[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" Message-ID: <[EMAIL PROTECTED]> Content-

[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 l

[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

Re: [Tutor] UselessPython 2.0

2005-04-09 Thread Dick Moores
Sean Steeg wrote at 11:22 4/7/2005: So we're requesting that anyone with one-offs, snippets, mini-apps, full-fledged apps and the like make a submission to the new and improved UselessPython. The code doesn't have to be pretty, but it does have to work. I'm a newbie, but would this qualify as a co