[Tutor] unittesting and nested functions

2004-12-20 Thread Christian Meesters
Hi I've written some unittests using the unittest module for my 'DNA-class'. This class can cope with almost every input, but with no 'numbers' whatsoever. Well, one of the tests is: class TestFunctions(unittest.TestCase): ... def test__init__(self): """testing whether __init__ w

Re: [Tutor] unittesting and nested functions

2004-12-21 Thread Christian Meesters
Ken Johnson wrote: This should be self.failUnlessRaises(IOError, DNA, '1 ATG') In your usage, you are calling DNA() and passing the result of the call to failUnlessRaises(). The call to DNA raises IOError. This happens *before* the call to failUnlessRaises(), so it is interpreted as an error

RE: [Tutor] German Totorial!?!

2005-01-06 Thread Christian Meesters
Hoi Michael, Apart from Alan's tutorial in German and the link Andrew provided you might want to have a look here: http://python.sandtner.org/ (The German Python forum.) You'll find not only links to other German sources, but also friendly support in German ;-). Gruss, Christian

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

2005-02-21 Thread Christian Meesters
Hi My cryptic subject is perhaps not sufficient - I'll try to make it a little better: Assume you'd like to write something like: import someClass x = someClass.open("someFile") Here '.open' should read in the data and initialize the instance - with or without calling __init__. How is this

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] how to initialize a class with arbitrary argument list from a file?

2005-03-18 Thread Christian Meesters
Hi How can I initialize a class like this from a file: class Some: def __init__(self,data,axis,**kwargs): pass 'data' and 'axis' should be lists of floats. Meta data can be passed to kwargs like 'name="name",date="2/3/05",...'. Right now the return value of my function read

[Tutor] one line code

2005-04-04 Thread Christian Meesters
Hi Yesterday night I was thinking about the following problem: I do have a list like l = ['1','2','3','abc','','4'] - for instance like a list one could get from a file import with the csv module (which is where my 'problem' comes from). Now I would like to generate the following list, preferabl

Re: [Tutor] one line code

2005-04-06 Thread Christian Meesters
Hi, Great! My own solution was more like Wolfram's. But your solution, Pierre, really runs under "obfuscating enhanced". I like it. And your idea, Andrei, is something I really didn't expect. Anyway, sorry for my late reply. Guess I learned a lot again. Thanks, Christian

[Tutor] "classmethods"

2005-05-20 Thread Christian Meesters
Hi I've asked a similar question before, but still I have to admit that I didn't find a solution with this particular problem here: Imaging you have a class with a certain __init__ function like: class MyClass: def __init__(parameter1, parameter2=default,*args,**kwargs):

Re: [Tutor] "classmethods"

2005-05-20 Thread Christian Meesters
Hi Thanks Kent and Alan for your input. Kent's example is working like a charm. It's just that I didn't find the time to give any feedback until now. Have a nice weekend! Christian ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailma

[Tutor] finding path to resource files in a GUI application

2005-06-08 Thread Christian Meesters
Hi Currently I'm writing a GUI application with wxPython (on OS X, but I guess the problem is the same, regardless of the UNIX derivative one is using). When I start the main script where it is located the application finds all resource files (non-Python files like images and html files fo

Re: [Tutor] finding path to resource files in a GUI

2005-06-09 Thread Christian Meesters
On 9 Jun 2005, at 12:00, Michael Lange wrote: > Hi Christian, > > try > > self.cwd = os.path.abspath(sys.path[0]) > > sys.path[0] is the directory of your main program file, with > os.path.abspath() you can > get rid of the "../../" stuff at the beginning of the path if the > program is call

Re: [Tutor] fourier transform

2005-07-30 Thread Christian Meesters
Jeff Peery wrote: > > Hello, I have a signal that I want to do a fourier transform on. I > tried using FFT.fft(data).real but I don't understand the output. > what is output from this function, and why doesn't it require > amplitude and time as inputs? Hi Jeff, As Danny wrote, your input are

Re: [Tutor] fourier transform

2005-08-02 Thread Christian Meesters
Hi Pawel Kraszewski wrote: > 4. The answer is symmetrical - usually you take only half of it. I > don't > remember the exact difference between the halves, but you may find it > in any > article on FFT. The real part is identical the imaginary part has the opposite sign ("same amplitude, oppos

Re: [Tutor] fourier transform

2005-08-03 Thread Christian Meesters
Hi Jeff, On 3 Aug 2005, at 02:03, Jeff Peery wrote: > hope this is more clear. from the output I would expect that two > spikes appear with amplitude = 1.  [snip] > I don't understand the output amplitudes. they should all be zero > except for at one herz it should be one. not sure about the fre

[Tutor] unittest: looking for examples

2005-08-17 Thread Christian Meesters
Hi Does anybody know examples using the unittest module for the following cases (or some parts of it)? - unittests for methods of classes getting all data from a file as a classmethod - unittests for reading and saving files in a specific way (= sanity tests for file handling) Point is that I

[Tutor] PyDoc problem

2005-09-23 Thread Christian Meesters
Hi, PyDoc is working well, if invoked without flags on the modul in question. But when I use it with '-w' to produce html-output, I get an extremely long Traceback after a runtime of an hour or two. Here is a short part from it: Traceback (most recent call last):   File "/usr/bin/pydoc"

Re: [Tutor] PyDoc problem

2005-09-23 Thread Christian Meesters
t; pydoc -w mymodule > > Perhaps also try uncommenting imports at the top of the file (ie # > import scipy) to see if that helps. > > > > On 9/23/05, Christian Meesters <[EMAIL PROTECTED]> wrote: >> Hi, >> >> PyDoc is working well, if invoked without f

[Tutor] regular expression matching a dot?

2005-10-19 Thread Christian Meesters
Hi I've got the problem that I need to find a certain group of file names within a lot of different file names. Those I want to match with a regular expression are a bit peculiar since they all look like: 07SS.INF , 10SE.INF, 13SS.INF, 02BS.INF, 05SS.INF. Unfortunately there are similar file nam

Re: [Tutor] regular expression matching a dot?

2005-10-19 Thread Christian Meesters
Hi Misto, Thanks, but this is no option for me - though I use glob a lot in other cases (mostly the quick and dirty hacks). But here I'm working on a list of names - not the files directly. Besides: REs are a lot more powerful (usually ;-), e.g. I'm using \d+ since I don't now that there are a

Re: [Tutor] regular expression matching a dot?

2005-10-19 Thread Christian Meesters
Actually, your answer did help to open my eyes. The expression is "\d+S[S|E]\.INF": Ouch! Thanks a lot, Christian On 19 Oct 2005, at 12:11, Misto . wrote: > [ Workaround ] > What about using the glob module? > > http://docs.python.org/lib/module-glob.html > > you can use something like > glob.g

Re: [Tutor] regular expression matching a dot?

2005-10-19 Thread Christian Meesters
Thanks, corrected. I was happy now - and then too fast ;-). Cheers Christian On 19 Oct 2005, at 13:50, Kent Johnson wrote: > Christian Meesters wrote: >> Actually, your answer did help to open my eyes. The expression is >> "\d+S[S|E]\.INF": Ouch! > > That will wo

Re: [Tutor] regular expression matching a dot?

2005-10-21 Thread Christian Meesters
Hi Frank & Kent & Hugo, Didn't have the time to read the list yesterday ... Thanks for pointing me to the regex-debuggers. Though I don't considered myself a regex-beginner I had to learn, that now that I'm using regexes only occasionally I might need some help here and there. Cheers, Christia

Re: [Tutor] Python code pretty-print?

2006-01-04 Thread Christian Meesters
On Tue, 3 Jan 2006, Lance E Sloan wrote: > A colleague of mine often develops Python code under Mac OS X. He would > like to be able to print the code in an easily readable format. He's > found that kwrite on Linux does a very nice job, but it's inconvenient > to copy his code to a Linux box jus