Style guide for subclassing built-in types?

2005-02-22 Thread Jane Austine
Please see the following code: class rev_wrap(object): def __init__(self,l): self.l=l def __getitem__(self,i): return self.l[-i-1] class rev_subclass(list): def __getitem__(self,i): return list.__getitem__(self,-i-1) if

time module precision

2005-01-08 Thread Jane Austine
What is the precision (and accuracy) of time module on a Windows XP machine? threading module depends on time module so it's precision(and accuracy) is up to time module's. | for i in xrange(1000): |time.sleep(0.001) This sleeps for awhile, which means 0.001 sec is not ignored. On the other

Efficient grep using Python?

2004-12-15 Thread Jane Austine
[Fredrik Lundh] >>> bdict = dict.fromkeys(open(bfile).readlines()) >>> >>> for line in open(afile): >>>if line not in bdict: >>>print line, >>> >>> [Tim Peters] >> Note that an open file is an iterable object, yielding the lines in >> the file. The "for" loop exploited that above, bu

Syck (yaml) for win32?

2004-12-07 Thread Jane Austine
Hello. I love yaml. I've been using PyYaml and heard it's far behind Syck in its functionality and performance. I'd like to try Syck with python but I have to compile it for my windows machine -- and it seems a very difficult work :I don't use cygwin. Does anyone have the binaries for win32? Ja