Re: [Tutor] class methods as argument

2007-02-10 Thread thomas coopman
On Sat, 10 Feb 2007 09:04:15 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > thomas coopman wrote: > > > > also, > > Is it better to use super in FooList? and how should I use it then? > > Actually I would say that FooList is not pulling its weight. > SortedL

Re: [Tutor] class methods as argument

2007-02-10 Thread thomas coopman
On Sat, 10 Feb 2007 07:55:54 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > thomas coopman wrote: > > Hi, > > > > I want to do something like this, don't know how to properly > > explain it, so I just give you some example code > > > >&

Re: [Tutor] class methods as argument

2007-02-10 Thread thomas coopman
On Sat, 10 Feb 2007 22:10:52 +1000 Jonathan McManus <[EMAIL PROTECTED]> wrote: > It's pretty easy to make this work, actually. The issue is in the > "doSomething" method. > > > >>>class Foo(object): > > >>> def method(self, arg): > > >>> print arg > > > > >>>def doSomething(object, func)

[Tutor] class methods as argument

2007-02-10 Thread thomas coopman
Hi, I want to do something like this, don't know how to properly explain it, so I just give you some example code >>>class Foo(object): >>> def method(self, arg): >>> print arg >>>def doSomething(object, func): >>> object.func("test") >>>object = Foo() >>>doSomething(object,

Re: [Tutor] comparing almost equal strings

2007-02-08 Thread thomas coopman
Hi, On Thu, 08 Feb 2007 13:07:41 +0100 Christopher Arndt <[EMAIL PROTECTED]> wrote: > thomas coopman schrieb: > > I need a function that groups almost equal strings. It seems most > > easy to me, to do this with a hash function. > > What do you mean be "a

[Tutor] comparing almost equal strings

2007-02-08 Thread thomas coopman
Hi, I need a function that groups almost equal strings. It seems most easy to me, to do this with a hash function. So I would write a hash function like this: string = string.replace(" ", "").lower()[0:6] and then hash the string chars, but it should detect minor typo's, so words with one diffe

Re: [Tutor] Best IDE for Python

2007-01-26 Thread Mark Thomas
On 1/26/07, OkaMthembo <[EMAIL PROTECTED]> wrote: > how useable is vim on Windows? Very! I've used Vim on Windows since the 5.3 version, it only gets better. Like Alan said there is a learning curve, but once you've "got it" there is no going back. > i wish i could learn Unix. which distro do you

Re: [Tutor] import and unittest

2007-01-17 Thread Thomas Coopman
On 1/17/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Thomas Coopman wrote: > When I run One.py from in the directory A, doesn't look python in it's > parent directory when it can't find the module? > And if that's not the case where and what should I add to t

Re: [Tutor] import and unittest

2007-01-17 Thread Thomas Coopman
On 1/17/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Thomas Coopman wrote: > Well I don't really > need the circular imports but I would like to know how to do the imports correct. > > Suppose that in the example that I showed only One needs Two. > > So then we ha

Re: [Tutor] import and unittest

2007-01-17 Thread Thomas Coopman
On 1/17/07, Kent Johnson <[EMAIL PROTECTED]> wrote: thomas coopman wrote: > On Tue, 16 Jan 2007 10:06:37 - > "Alan Gauld" <[EMAIL PROTECTED]> wrote: > >> "Thomas Coopman" <[EMAIL PROTECTED]> wrote >> . >>>

Re: [Tutor] import and unittest

2007-01-17 Thread thomas coopman
On Tue, 16 Jan 2007 10:06:37 - "Alan Gauld" <[EMAIL PROTECTED]> wrote: > > "Thomas Coopman" <[EMAIL PROTECTED]> wrote > . > > I wondered if it was possible to do something like this: > > > > src/ > >-a_module/ > >

Re: [Tutor] import and unittest

2007-01-16 Thread thomas coopman
On Tue, 16 Jan 2007 10:06:37 - "Alan Gauld" <[EMAIL PROTECTED]> wrote: > > "Thomas Coopman" <[EMAIL PROTECTED]> wrote > . > > I wondered if it was possible to do something like this: > > > > src/ > >-a_module/ > >

[Tutor] import and unittest

2007-01-16 Thread Thomas Coopman
code and the test dir is a complete copy of the src dir but with unittest instead of code. I have something like this but I don't know how to organize the imports in the tests and I don't know if this is a good idea. What do you think? Thanks -- Thomas Coopman [EMAIL

Re: [Tutor] Problems with a Class

2007-01-13 Thread thomas coopman
can't use return in the loop you could save them in a list or something, and after the loop return the list. def loop(): x = [] for i in range(10): x.append(i) return x print loop() this will print a list with all the numbers. I hope this is what you mean. Thomas ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Organizing 15500 records, how?

2006-12-12 Thread Thomas
onaries of userid to field value. That way I'm dealing with 10 to 50 files instead of 15500. Also, I am inexperienced with using classes but eager to learn and wonder if they would be any help in this case. Any advise much appreciated and thanks in

[Tutor] difflib.SequenceMatcher with get_matching_blocks is incorrect

2006-12-04 Thread Thomas
s this function designed to give up when the input strings get too long? Thanks in advance, Thomas ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] A Million Sevens

2006-11-17 Thread Thomas
On 18/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > Not that it changes your reply, but just for my own sanity: > int('7' * 10 ** 6) <- does this not just type-cast a char into an int? > > Meaning that rather then consuming 1024k as you stated, it would consume > 2048k at the peak of the calcul

[Tutor] A Million Sevens

2006-11-17 Thread Thomas
Earlier today I typed the following into my pythonwin interactive interpreter in windows xp: int('7' * 10 ** 6) I expected either an error message or it to get stuck and require me to stop the process manually. I read that unlike long integers in C, longs in python are only limited by the amo

[Tutor] Read the builtin module source, also itchy ellipses.

2006-11-17 Thread Thomas
Hi, I sometimes find it useful to read the source code of a module and for example I can type string.__file__ to find the location of the string module. However the .__file__ method is not available for the module builtin. Is it possible to read the source code for built in functions and if so h

[Tutor] property built-in

2006-10-19 Thread thomas
Hi, I was wondering some things about property. suppose I have a class like this: class A(object): def __init__(self, x, y): self.__x = x def x(): def get(self): return self.__x def set(self, x): self.__x = x #and some other code that

Re: [Tutor] extracting matches by paragraph

2006-10-11 Thread Thomas A. Schmitz
On Oct 11, 2006, at 2:48 PM, Kent Johnson wrote: > Thomas A. Schmitz wrote: >> On Oct 11, 2006, at 12:06 PM, Kent Johnson wrote: >> >>> I would take out the join in this, at least, and return a list of >>> lines. You don't really have a paragraph, you have

[Tutor] extracting matches by paragraph

2006-10-11 Thread Thomas A. Schmitz
this, in a proper format, to a bibtex file. If a paragraph does not provide a value for a particular key, I could then, in a second pass over the bibtex file, delete these lines. But that means I first have to match and extract the values from my parapgraphs. What am I doing wrong? Or

Re: [Tutor] New Tutorial topic available

2006-02-26 Thread Mark Thomas
ormation for us newbies. -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] pyGtk using combobox

2006-02-10 Thread thomas
Hi, I would like to make a combobox with a list of strings, but I have many problems with it. I know how to make the combobox and how to add strings, but is it possible to get a list of strings from the combobox and also is it possible to update the combobox with a list of strings? (something lik

Re: [Tutor] How to strip both single and double quotes

2005-10-05 Thread Mark Thomas
\" \' ()*&^%$# << ' >>> [x.strip('\' \" () * & ^ % $ # < ') for x in str.split()] ['this', 'has', 'special', 'characters', '', '', '', ''] -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (no subject)

2005-07-06 Thread Mark Thomas
On 7/6/05, Michael Huster <[EMAIL PROTECTED]> wrote: > In python under windows, how can I create and access a file on the Desktop? > The following do NOT work: How about... >>> userp = os.getenv('USERPROFILE') + '\\Desktop\\MyFile.txt' >>> fo =

Re: [Tutor] Simple string processing problem

2005-05-13 Thread Mark Thomas
GAAATTGCAAATTAACTGTG ScerACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SparACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SmikACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA SbayACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA -- _ ( ) Mark Thomas ASCII ribb

[Tutor] website information

2005-04-18 Thread Williams, Thomas
Does anyone know how to prevent this error from occurring: IOError: [Errno socket error] (10060, 'Operation timed out').   I have searched for solutions without any success.   Tom Williams     ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] Cryptography Toolkit

2005-04-01 Thread Mark Thomas
ncrypt > > xored = obj_xor.encrypt(str_encrypt) > print xored > > obj_xor = XOR.new("string") > print obj_xor.decrypt(xored) > > Kent Excellent !! Many thanks Kent. -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___

Re: [Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
t;bhxupds&oo`g'uou`z`" <== *confused by this output* Close but no cigar!! *grin* -- _ ( ) Mark Thomas ASCII ribbon campaign X www.theswamp.org - against HTML email / \ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
Does anyone have some examples on the use of A.M. Kuchling's Python Cryptography Toolkit? I've tried his examples but get "AttributeError" and "TypeError". What I'm trying to do is encrypt/decrypt a file. I'm using Python 2.3 on xp pro. Thanks -- _ ( )

[Tutor] updating Oracle tables via python

2005-03-29 Thread Williams, Thomas
Greetings, I am attempting to update an Oracle table using python.  When I execute the code, the python script appears to hang, in that nothing else happens.   As always, any assistance you can provide will be appreciated.   Code:   connection = cx_Oracle.connect("db/[EMAIL PROTECTED

[Tutor] executing SAS and passing parameters

2005-02-09 Thread Williams, Thomas
Here is the code I am using to invoke SAS: import os import sys shell = os.environ.get('COMSPEC') if shell is None: shell = os.environ.get('SHELL') if shell is None: shell = 'an unknown command processor' print 'Running under', shell os.exe

RE: [Tutor] executing SAS and passing parameters

2005-02-08 Thread Williams, Thomas
again, Tom -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 08, 2005 1:57 PM To: Williams, Thomas; tutor@python.org Subject: Re: [Tutor] executing SAS and passing parameters > I am trying to use python to run a SAS program by passing th

[Tutor] executing SAS and passing parameters

2005-02-08 Thread Williams, Thomas
Greetings,   I am trying to use python to run a SAS program by passing the needed parameters.  I am able to start SAS, but unable to start the correct SAS program with its parameters.   Any assistance you could provide will be appreciated.   Tom Williams DSHS - Research and Data Analy

[Tutor] XP and python 2.4, some progress

2005-01-08 Thread Jeffrey Thomas Peery
I wasn’t able to get the IDLE started in windows XP. I had it working then I upgraded to 2.4, then it didn’t work so I switched back to 2.3, still didn’t work so I’m back to 2.4.  I did some looking around and I was able to get the IDLE started by setting the shortcut on my desktop to:  

[Tutor] (no subject)

2005-01-08 Thread Jeffrey Thomas Peery
Hello I can’t seem to get the IDLE to start up in my windows XP by clicking on the desktop icon. To start it I have to drop a .py file on the icon. Any ideas?   Also I can’t seem to get xp to recognize .py files belonging to python. Right now the icons for .py is a windows default and not

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Thomas Clive Richards
On Wednesday December 22 2004 11:58 am, Alan Gauld wrote: > > Hows about a dictionary of lists. A key per column. The > users pick which columns and you retrieve the lists. And > of course shelve will treat a file like a dictionary... > Ahhh that's better.. I guess I should clarify: it's not

[Tutor] implementing a table data structure in python?

2004-12-20 Thread Thomas Clive Richards
Hi, I'm trying to implement a reasonably efficient table data structure, but ith a few quirks... The application I'm building is a CGI program which allows users to view a large table of data. In addition, users can restrict the data shown. Some sample data might look like this: (note you'll

<    1   2