Re: Essential tools for Python development

2009-04-21 Thread Alex VanderWoude
Ben Finney wrote: Esmail writes: What techniques/tools do you recommend for debugging? I use the Python interactive shell, and code each module so that the behaviour is easily introspected and tested from outside the module. If I'm not able to easily introspect the code at an interactive pro

Re: Printing a "status " line from a python script

2008-11-12 Thread Alex VanderWoude
Chris Seymour wrote: I am working on a python script for my colleague that will walk a directory and search in the different files for a specific string. These pieces I am able to do. What my colleague wants is that when she runs the script the filename is replaced by the current file that is be

Figuring out what class instance contains you

2008-04-03 Thread Alex VanderWoude
Consider the following module: class NewDict(dict): parent = None def __setitem__(self, key, value): print "My parent is", self.parent super(NewDict, self).__setitem__(key, value) class Zero(object): children = NewDict() def

Re: printing dots in simple program while waiting

2008-01-09 Thread Alex VanderWoude
John wrote: > what i want to do is print a 'waiting' statement while a script is > working-- the multithreading aspect isn't an issue, the printing on > the same line is. i want to print something like: > > (1sec) working... > (2sec) working > (3sec) working. > > > where the 'working' l

Re: Overriding methods in classes you don't control

2005-03-28 Thread Alex VanderWoude
"Jp Calderone" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 28 Mar 2005 03:57:16 GMT, Alex VanderWoude <[EMAIL PROTECTED]> wrote: > >Is there a way to override a method on a class whose source you cannot > > change in such a way that

Overriding methods in classes you don't control

2005-03-27 Thread Alex VanderWoude
Is there a way to override a method on a class whose source you cannot change in such a way that you can hook into that method's code? After doing some research, it appears that one way to do such a thing is to create a new (non-class) method, and then assign the new method to the class in questio

Re: wxPython: accessing wxFrame methods in __del__ fails

2005-03-24 Thread Alex VanderWoude
"Stephen Thorne" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 24 Mar 2005 06:21:36 GMT, Alex VanderWoude <[EMAIL PROTECTED]> wrote: > > I am attempting to save my window's size and position when it closes. So I > > figured

wxPython: accessing wxFrame methods in __del__ fails

2005-03-23 Thread Alex VanderWoude
I am attempting to save my window's size and position when it closes. So I figured I'd put some code in the __del__() method: from wxPython import * class MyWindow(wxFrame): def __init__(self, parent, id=wxID_ANY, title=None, style=None): # Some stuff here. def __del__(self):