printing indented html code

2005-06-24 Thread Lowell Kirsh
Is there a module or library anyone knows of that will print html code indented? What I'd like would be for a function or class which works like this: htmlIndent(sys.stdout, 'htmlheadfoobar/head...') and will print somethinkg like this to stdout: html head foobar /head ... My

Re: Favorite non-python language trick?

2005-06-24 Thread Lowell Kirsh
Check out lisp macros. Other languages have macro systems but none compare in power to lisp's. They are so powerful in lisp because lisp is the only language where the source code closely resembles its parse tree (created within the compiler/interpreter). Lowell Joseph Garvin wrote: As

Re: printing indented html code

2005-06-24 Thread Lowell Kirsh
Thanks. At a glance, that looks like it's what I'm looking for. Lowell TechBookReport wrote: Lowell Kirsh wrote: Is there a module or library anyone knows of that will print html code indented? What I'd like would be for a function or class which works like this: htmlIndent(sys.stdout

Re: printing indented html code

2005-06-24 Thread Lowell Kirsh
Looks good. I'll give it a try. Konstantin Veretennicov wrote: On 6/24/05, Lowell Kirsh [EMAIL PROTECTED] wrote: Is there a module or library anyone knows of that will print html code indented? Depends on whether you have to deal with xhtml, valid html or just any, possibly invalid

Re: reloading my own modules

2005-06-07 Thread Lowell Kirsh
Hi, Skip Montanaro wrote: Also, since it's clear you have already imported dbtest and util, there's no need to check in sys.modules: import dbtest, util reload(dbtest) reload(util) Won't this load the modules twice on the first run? I only want to load the modules once each

reloading my own modules

2005-06-06 Thread Lowell Kirsh
I have a driver module as well as several other modules. I am running the driver interactively from emacs - that is, I don't restart python on each run. I want to work it such that every time a modify the source for one of the non-driver modules and re-run the driver, the other modules will be

Re: duplicate file finder

2005-02-24 Thread Lowell Kirsh
It looks pretty good, but I'll have to take a better look later. Out of curiosity, why did you convert the first spaces to pipes rather than add the code as an attachment? Lowell Christos TZOTZIOY Georgiou wrote: On Wed, 23 Feb 2005 01:56:02 -0800, rumours say that Lowell Kirsh [EMAIL PROTECTED

Re: how can I make this script shorter?

2005-02-23 Thread Lowell Kirsh
Good idea about hashing part of the file before comparing entire files. It will make the script longer but the speed increase will most likely make it worth it. Lowell Christos TZOTZIOY Georgiou wrote: On Tue, 22 Feb 2005 00:34:39 -0800, rumours say that Lowell Kirsh [EMAIL PROTECTED] might

Re: how can I make this script shorter?

2005-02-23 Thread Lowell Kirsh
Thanks for the advice. There are definitely some performance issues I hadn't thought of before. I guess it's time to go lengthen, not shorten, the script. Lowell John Machin wrote: Lowell Kirsh wrote: I have a script which I use to find all duplicates of files within a given directory and all

Re: how do i create such a thing?

2005-02-01 Thread Lowell Kirsh
What might these exceptions be? It's HIGHLY advisable to have your __getattr__ methods raise AttributeError for any requested name that starts and ends with double underscores, possibly with some specific and specifically designed exceptions. Alex --

Re: how do i create such a thing?

2005-02-01 Thread Lowell Kirsh
I'm not sure I get it. What's the purpose of using a delegate rather than having the object itself supply the return value? Alex Martelli wrote: Lowell Kirsh [EMAIL PROTECTED] wrote: What might these exceptions be? It's HIGHLY advisable to have your __getattr__ methods raise AttributeError

how do i create such a thing?

2005-01-30 Thread Lowell Kirsh
I want to create a class called DefaultAttr which returns a default value for all attributes which haven't been given values yet. It will work like this: x = DefaultAttr(99) print x.foo 99 print x.bar 99 x.foo = 7 print x.foo 7 I already have a similar class called DefaultDict which works

Re: is this sort method the same as the one in python 2.4

2005-01-30 Thread Lowell Kirsh
How come you reverse the list twice? And why does this preserve stability? Raymond Hettinger wrote: Lowell Kirsh I'm trying to emulate the sorted() method introduced in python 2.4. The only difference is that it takes a sequence as one of its arguments rather than being a method of the sequence

is this sort method the same as the one in python 2.4

2005-01-29 Thread Lowell Kirsh
I'm trying to emulate the sorted() method introduced in python 2.4. The only difference is that it takes a sequence as one of its arguments rather than being a method of the sequence class. Does my method do the same as the sorted()? The obvious difference is that my method is called as

why are these not the same?

2005-01-20 Thread Lowell Kirsh
On a webpage (see link below) I read that the following 2 forms are not the same and that the second should be avoided. They look the same to me. What's the difference? Lowell def functionF(argString=abc, argList = None): if argList is None: argList = [] ... def

Re: why are these not the same?

2005-01-20 Thread Lowell Kirsh
D'oh I should've caught that myself. Thanks. Fredrik Lundh wrote: Lowell Kirsh wrote: On a webpage (see link below) I read that the following 2 forms are not the same and that the second should be avoided. They look the same to me. What's the difference? def functionF(argString=abc, argList