[Tutor] Method/subclass

2005-02-22 Thread Liam Clarke
Hi all, I'm working on my first object-based-from-the-ground-up project, and I have some queries. http://www.rafb.net/paste/results/lDUmWS78.html Here are my two classes here. For each different function, search, edit, view, etc. a different SQL operation will take place, and a different child

[Tutor] Re: Method/subclass

2005-02-22 Thread Wolfram Kraus
Liam Clarke wrote: Hi all, I'm working on my first object-based-from-the-ground-up project, and I have some queries. http://www.rafb.net/paste/results/lDUmWS78.html Here are my two classes here. For each different function, search, edit, view, etc. a different SQL operation will take place, and a d

Re: [Tutor] Initializing with a call like: someClass.open("someFile")?

2005-02-22 Thread Christian Meesters
Thanks Guys, Guess I have to look once more into decorator functions - and guess it's worth doing so. Anyway: My problem is solved. Cheers Christian ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Brian van den Broek
Hi all, I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1 .>>> mine = my_list((1,2,3,4)) .>>> mine.append(42) .>>> mine [1, 2, 3, 4,

Re: [Tutor] Method/subclass

2005-02-22 Thread Kent Johnson
Liam Clarke wrote: Hi all, I'm working on my first object-based-from-the-ground-up project, and I have some queries. http://www.rafb.net/paste/results/lDUmWS78.html Here are my two classes here. For each different function, search, edit, view, etc. a different SQL operation will take place, and a d

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Karl =?iso-8859-1?Q?Pfl=E4sterer?=
On 22 Feb 2005, [EMAIL PROTECTED] wrote: > I'm trying to figure out how to subclass the list built-in. > > .>>> class my_list(list): > def __init__(self, sequence=None): > list.__init__(self, sequence) > self.spam = 1 > > .>>> mine = my_list((1,2,3

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Kent Johnson
Brian van den Broek wrote: Hi all, I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1 .>>> mine = my_list((1,2,3,4)) .>>> mine.append(42) .>>>

Re: [Tutor] Help debuging a small program

2005-02-22 Thread Mark Kels
On Mon, 21 Feb 2005 13:21:35 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > How far does it get? How do you know? > > I would put some debug print statements in. Also you should call sk.close() > in the else clause of > scan(). Finally, I don't think you will see any output in the result window

Re: [Tutor] Help debuging a small program

2005-02-22 Thread Martin Walsh
Mark Kels wrote: On Mon, 21 Feb 2005 13:21:35 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: How far does it get? How do you know? I would put some debug print statements in. Also you should call sk.close() in the else clause of scan(). Finally, I don't think you will see any output in the resul

[Tutor] UnicodeDecodeError

2005-02-22 Thread Michael Lange
Hello list, I've encountered an (at least for me) weird error in the project I'm working on (see the traceback below). Unfortunately there are several of my application's modules involved, so I cannot post all of my code here. I hope I can explain in plain words what I'm doing. The line in the

Re: [Tutor] Help debuging a small program

2005-02-22 Thread Kent Johnson
Mark Kels wrote: On Mon, 21 Feb 2005 13:21:35 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: How far does it get? How do you know? I would put some debug print statements in. Also you should call sk.close() in the else clause of scan(). Finally, I don't think you will see any output in the result

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Brian van den Broek
Karl Pflästerer said unto the world upon 2005-02-22 07:53: On 22 Feb 2005, [EMAIL PROTECTED] wrote: I'm trying to figure out how to subclass the list built-in. .>>> class my_list(list): def __init__(self, sequence=None): list.__init__(self, sequence) self.spam = 1

[Tutor] How can i use both float and int?

2005-02-22 Thread . ,
like... number1 = raw_input(float int("Number1: ") But, I think error will occur... Cheers! :) _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Re: [Tutor] How can i use both float and int?

2005-02-22 Thread Terry Carroll
On Tue, 22 Feb 2005, . , wrote: > like... > > number1 = raw_input(float int("Number1: ") > > But, I think error will occur... You have some syntax issues here. What you want, I think, is to use raw_input to get input, and then convert that to float. try this: number1 = float(raw_input("Numb

Re: [Tutor] How can i use both float and int?

2005-02-22 Thread Michael Dunn
Hi .,, An error will certainly occur (you should always try it and see). You could do something like: n = raw_input("Number1: ") try: number1 = int(n) except ValueError: number1 = float(n) This will make number1 an integer if possible, and a float otherwise. But (and wiser heads may correct me

[Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Lloyd Kvam
> Message: 2 > Date: Tue, 22 Feb 2005 13:53:44 +0100 > From: [EMAIL PROTECTED] (Karl Pfl?sterer ) > Subject: Re: [Tutor] subclassing list -- slicing doesn't preserve type > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > > On 22 Feb 2005, [EMA

[Tutor] killing a thread

2005-02-22 Thread Shitiz Bansal
Hi, Is there a way to terminate a thread from another thread? Shitiz __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@

Re: [Tutor] killing a thread

2005-02-22 Thread Bill Mill
If I recall correctly, there is not a direct way. Instead, you're going to want to have your worker thread check a queue it shares with the parent every so often to see if the supervisor thread has sent a "quit" message to it. Peace Bill Mill bill.mill at gmail.com On Tue, 22 Feb 2005 14:23:17 -

RE: [Tutor] UnicodeDecodeError

2005-02-22 Thread Isr Gish
Michael Lange"<[EMAIL PROTECTED]> wrote: >Hello list, > [Snip] This part of the error is saying what the problem is. >UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 22: ordinal not in range(128) Thatthe ascii codec that's being used can't decode any ascii code

RE: [Tutor] UnicodeDecodeError

2005-02-22 Thread Isr Gish
Forgot something in previOuse post. You can set the defualt encoding to something other then 'ascii'. This is done with the function Qsys.setdefualtencoding('mbcs')". I think that this has to be done in the module sitecostomize, because the function is deleted after the module site is run. And t

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Danny Yoo
> > > I'm trying to figure out how to subclass the list built-in. > > > You could do it e.g. like that: > > > > class Mylist (list): > > def __init__(self, seq=None): > > super(self.__class__, self).__init__(seq) > > def __getslice__(self, start, stop): > > return self.__cl

Re: [Tutor] killing a thread

2005-02-22 Thread Max Noel
On Feb 22, 2005, at 23:08, Bill Mill wrote: If I recall correctly, there is not a direct way. Instead, you're going to want to have your worker thread check a queue it shares with the parent every so often to see if the supervisor thread has sent a "quit" message to it. Peace Bill Mill bill.mill at

Re: [Tutor] killing a thread

2005-02-22 Thread Kent Johnson
Max Noel wrote: On Feb 22, 2005, at 23:08, Bill Mill wrote: If I recall correctly, there is not a direct way. Instead, you're going to want to have your worker thread check a queue it shares with the parent every so often to see if the supervisor thread has sent a "quit" message to it. Peace Bill M

Re: [Tutor] Method/subclass

2005-02-22 Thread Liam Clarke
Kia ora, > > I'm not really sure what you are trying to do, the code is pretty sketchy. It > looks like you want to > have a bunch of queries on your dataset, and the result of each query is > displayed in a window. Is > that right? Assuming it is, I'll continue... What I'm doing here is ver