duck typing / library functions

2019-09-12 Thread duncan smith
Hello, The problem I have relates to writing algorithmic code that can handle types with a given API, but where some of the required functionality is implemented as library functions rather than methods. Specifically I have code that uses numpy arrays, but I want to adapt it to use sparse

Re: Middle matching - any Python library functions (besides re)?

2006-08-28 Thread Simon Forman
Andrew Robert wrote: > Because I was lazy.. > > The checksume_compare came from something else I wrote that had special > logging and e-mailer calls in it. > > Should have ripped the reference to caller and file name out.. Aaaahh the subtle joys of cut-and-paste programming... :-D (I've done it

Re: Middle matching - any Python library functions (besides re)?

2006-08-28 Thread Andrew Robert
Simon Forman wrote: > Andrew Robert wrote: >> Simon Forman wrote: >>> Paul Rubin wrote: "EP" <[EMAIL PROTECTED]> writes: > Given that I am looking for matches of all files against all other > files (of similar length) is there a better bet than using re.search? > The initial applic

Re: Middle matching - any Python library functions (besides re)?

2006-08-28 Thread Simon Forman
Andrew Robert wrote: > Simon Forman wrote: > > Paul Rubin wrote: > >> "EP" <[EMAIL PROTECTED]> writes: > >>> Given that I am looking for matches of all files against all other > >>> files (of similar length) is there a better bet than using re.search? > >>> The initial application concerns files in

Re: Middle matching - any Python library functions (besides re)?

2006-08-28 Thread Andrew Robert
Simon Forman wrote: > Paul Rubin wrote: >> "EP" <[EMAIL PROTECTED]> writes: >>> Given that I am looking for matches of all files against all other >>> files (of similar length) is there a better bet than using re.search? >>> The initial application concerns files in the 1,000's, and I could use >>>

Re: Middle matching - any Python library functions (besides re)?

2006-08-27 Thread Simon Forman
Paul Rubin wrote: > "EP" <[EMAIL PROTECTED]> writes: > > Given that I am looking for matches of all files against all other > > files (of similar length) is there a better bet than using re.search? > > The initial application concerns files in the 1,000's, and I could use > > a good solution for a

Re: Middle matching - any Python library functions (besides re)?

2006-08-27 Thread Paddy
EP wrote: > Hi, > > I'm a bit green in this area and wonder to what extent there may be > some existing Python tools (or if I have to scratch my head real hard > for an appropriate algorithm... ) I'd hate to build an inferior > solution to that someone has painstakingly built before me. > > I hav

Re: Middle matching - any Python library functions (besides re)?

2006-08-27 Thread Paul Rubin
"EP" <[EMAIL PROTECTED]> writes: > Given that I am looking for matches of all files against all other > files (of similar length) is there a better bet than using re.search? > The initial application concerns files in the 1,000's, and I could use > a good solution for a number of files in the 100,0

Re: Middle matching - any Python library functions (besides re)?

2006-08-27 Thread bearophileHUGS
If you want to avoid an O(n^2) algorithm, you may need to find a signature for each file. Then you use such signatures to compute hashes, and unique them with a dict (dict values may be the file names). Later you can weed out the few wrong collisions produced by the possibly approximated signature.

Middle matching - any Python library functions (besides re)?

2006-08-27 Thread EP
Hi, I'm a bit green in this area and wonder to what extent there may be some existing Python tools (or if I have to scratch my head real hard for an appropriate algorithm... ) I'd hate to build an inferior solution to that someone has painstakingly built before me. I have some files which may ha

Re: Library functions

2005-10-10 Thread Peter Hansen
Tuvas wrote: > How exactly do you do that? Just to get some kind of an idea, perhaps > you could share bits of code? Thanks! Did you check out the ctypes web site before asking? See http://starship.python.net/crew/theller/ctypes/ and at least read through the helpful tutorial before asking ques

Re: Library functions

2005-10-10 Thread Tuvas
How exactly do you do that? Just to get some kind of an idea, perhaps you could share bits of code? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Library functions

2005-10-10 Thread Grant Edwards
On 2005-10-10, Tuvas <[EMAIL PROTECTED]> wrote: > I am writing a program that mimics a program written in C, but using > Python-supiorior techniques. The C program calles a library function, > non-open source, I only know that it sends it a command > LINUX_CAN_Open() as for a few others as well.

Library functions

2005-10-10 Thread Tuvas
I am writing a program that mimics a program written in C, but using Python-supiorior techniques. The C program calles a library function, non-open source, I only know that it sends it a command LINUX_CAN_Open() as for a few others as well. Is there a way I can call this function from Python withou