Google-like Did you mean... ? search algorithm

2008-06-19 Thread miller . paul . w
This is a wee bit OT, but I am looking for algorithms to implement search suggestions, similar to Google's Did you mean... ? feature. Can anyone point me to web pages, journal articles, implementations (preferably in Python!), or any other resources in this area? Thanks! --

Writing HTML

2008-06-02 Thread miller . paul . w
I've searched the standard library docs, and, while there are a couple options for *reading* HTML from Python, I didn't notice any for *writing* it. Does anyone have any recommendations (particularly ones not listed on PyPI)? Thanks -- http://mail.python.org/mailman/listinfo/python-list

How solid is PyPy?

2008-06-02 Thread miller . paul . w
I've been looking at PyPy recently, and I see it's reached version 1.0 (and supports language version 2.4). Given that, I was wondering what level of backwards-compatibility one can expect from future versions, i.e. if I run code on, say, a translated stackless PyPy now, what is the probability

Re: Writing HTML

2008-06-02 Thread miller . paul . w
On Jun 2, 6:11 am, Ken Starks [EMAIL PROTECTED] wrote: My approach is usually to write the data-load in XML rather than directly in HTML, and then use XSLT to produce the (X)HTML. That's a good idea I hadn't considered. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing HTML

2008-06-02 Thread miller . paul . w
On Jun 2, 3:19 pm, Stefan Behnel [EMAIL PROTECTED] wrote: Or lxml, for that purpose, which also is a lot nicer for generating XML and HTML in the first place. http://codespeak.net/lxml/ Awesome. lxml looks like exactly what I'm after... and it's in the Ubuntu repos. :-) Thanks! --

Re: python blogs

2008-06-02 Thread miller . paul . w
On Jun 2, 2:49 pm, [EMAIL PROTECTED] wrote: It seems like Python blogs are gaining popularity. It seems to me that they play a crucial role in promoting Python as a language. Neat! Do blogs on your site have to be about Python programming, or can people blog about anything? --

Re: ThreadPoolingMixIn

2008-06-02 Thread miller . paul . w
On Jun 2, 12:41 pm, [EMAIL PROTECTED] wrote: On Jun 2, 7:15 pm, Michael Ströder [EMAIL PROTECTED] wrote: Here are benchmarks for FreeBSD 6.2, amd64 packet_size         x         y           0    499.57   1114.54        1024    499.29   1130.02        3072    500.09   1119.14        7168  

Re: Checking each item in m.group()?

2008-06-02 Thread miller . paul . w
On Jun 2, 5:06 pm, Peter Otten [EMAIL PROTECTED] wrote: You are taking the wrong approach here. Don't build SQL statements as strings; you are enabling the next SQL injection attack. Pass parameters using the DB API instead. Don't use regular expressions to parse a CSV file. Python's csv

Re: Ideas for master's thesis

2008-06-02 Thread miller . paul . w
On Jun 2, 7:53 pm, Filip Gruszczyński [EMAIL PROTECTED] wrote: I am student of CS at the University of Warsaw, currently 4th year. I am attending Object Oriented Programming seminar and it is about time, I started looking for an idea of my master's degree project. As I like Python very much,

Re: Faster I/O in a script

2008-06-02 Thread miller . paul . w
On Jun 2, 2:08 am, kalakouentin [EMAIL PROTECTED] wrote: Do you know a way to actually load my data in a more batch-like way so I will avoid the constant line by line reading? If your files will fit in memory, you can just do text = file.readlines() and Python will read the entire file into

Performance of Python builtins

2008-05-25 Thread miller . paul . w
Is there any place outside the actual C source for Python that has information about the performance of Python's built-in operations? For example, I'd *expect* list.append to be O(1), and I hope that list[i] is O(1), but I don't really know that for sure, since it would depend a lot on the

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 7:35 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] writes: Thanks for your reply. I guess I'll have to go source diving to truly answer the question. You can fix your Python program's performance problems by rewriting it in C is not that convincing an answer to

Re: which datastructure for fast sorted insert?

2008-05-25 Thread miller . paul . w
On May 25, 2:37 am, [EMAIL PROTECTED] wrote: im writing a webcrawler. after visiting a new site i want to store it in alphabetical order. so obv i want fast insert. i want to delete duplicates too. which datastructure is best for this? I think you ought to re-examine your requirements. Why

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 9:43 pm, Terry Reedy [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Is there any place outside the actual C source for Python that has | information about the performance of Python's built-in operations? Unfortunately no.  Guido does not want

Re: set partition question

2008-05-25 Thread miller . paul . w
On May 25, 3:51 pm, [EMAIL PROTECTED] wrote: dear pythonistas, I think this problem is related to integer partitioning, but it's not quite the same. The range of answers has a little combinatorial explosion problem as S gains new members. In my problem, len(S) is usually on the order of 1M,

Re: Why does python not have a mechanism for data hiding?

2008-05-25 Thread miller . paul . w
On May 24, 9:41 am, Sh4wn [EMAIL PROTECTED] wrote: Python advertises himself as a full OOP language, but why does it miss one of the basic principles of OOP? Will it ever be added to python? Others have already answered this directly, but I'd like to mention that languages I know of which

Re: Performance of Python builtins

2008-05-25 Thread miller . paul . w
On May 25, 11:05 pm, Benjamin [EMAIL PROTECTED] wrote: http://wiki.python.org/moin/TimeComplexityis a start. Awesome. That's pretty much what I was after! -- http://mail.python.org/mailman/listinfo/python-list

Re: set partition question

2008-05-25 Thread miller . paul . w
On May 25, 11:40 pm, [EMAIL PROTECTED] wrote: This is a problem in statistical estimation. Given n records made up of k variables, define a cell as the point in the cartesian product of v_1 * v_2 * ... * v_k. I want to apply an estimator on the data in each cell. So, basically, V = (v_1,

Re: Python and Flaming Thunder

2008-05-13 Thread miller . paul . w
On May 13, 10:34 am, hdante [EMAIL PROTECTED] wrote: The Flaming Thunder looks promising, but without being free software, it's unlikely it will create a large developer community, specially considering both free general purpose and scientific programming languages. I'll agree that software

Python isn't English -- and that's a good thing!

2008-05-13 Thread miller . paul . w
On May 13, 6:14 pm, MRAB [EMAIL PROTECTED] wrote: On May 13, 6:32 pm, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: I once had to do a bit of scripting in AppleScript. The problem I found was that AppleScript tries to be so much like natural English that I never got a clear idea of whether

Re: do you fail at FizzBuzz? simple prog test

2008-05-13 Thread miller . paul . w
On May 12, 3:55 am, [EMAIL PROTECTED] wrote: As a test, I would leave out the last sentence, and see how many people (and how fast) figure out than a number can be multiple of three _and_ five and that the requirement is somehow incomplete ... Actually, if you leave off the last sentence,

Threads vs. continuations

2008-02-19 Thread miller . paul . w
I've been doing some thinking, and I've halfway convinced myself of the following statement: that threads as implemented by Python (or Java) are exactly equivalent to one-shot continuations in Scheme. Am I right? (I'd have asked in the scheme groups, but I feel like I'm less likely to get flamed

Re: Does anyone else use this little idiom?

2008-02-03 Thread miller . paul . w
On Feb 3, 10:42 am, Zentrader [EMAIL PROTECTED] wrote: Not to me. If I read for _ in ..., I wouldn't be quite sure what _ was. Is it some magic piece of syntax I've forgotten about? Or something new added to language while I wasn't paying attention (I still consider most stuff added

Re: Does anyone else use this little idiom?

2008-02-03 Thread miller . paul . w
On Feb 3, 11:20 am, Paul McGuire [EMAIL PROTECTED] wrote: [... some code... some words ... more code, etc. ...] But this still seems like a lot of work to avoid for x in range(n):. I agree. The point of me using for _ in xrange (n) isn't to avoid the for loop at all. What I wanted was a

Re: Does anyone else use this little idiom?

2008-02-03 Thread miller . paul . w
My apologies if any attributions are messed up. On Feb 3, 1:28 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sun, 03 Feb 2008 15:08:34 +1100, Ben Finney wrote: But I like using _ because it's only 1 character and communicates well the idea I don't care about this

Re: Python GUI toolkit

2008-02-03 Thread miller . paul . w
On Feb 3, 10:18 am, [EMAIL PROTECTED] wrote: what would be the best python GUI toolkit, it must be cross platform. i have tried gtk, but it interface are real bad and its coding was difficult so i dropped it, [...] If cross-platform, and nice API are your requirements, I recommend you

psyco question

2008-02-03 Thread miller . paul . w
Say I have a module with a function f in it, and I do psyco.bind (f) Is there any simple/easy/elegant way to retain a reference to the *unoptimized* version of f so I can call them both and compare performance?I've tried f2 = copy.deepcopy (f) psyco.bind (f) but that doesn't work. Other

Project naming suggestions?

2008-02-03 Thread miller . paul . w
I'm considering writing a little interpreter for a python-like language and I'm looking for name suggestions. :-) Basically, I don't want to change a whole lot about Python. In fact, I see myself starting with the compiler module from Python 2.5 and building from there. This language would be

Re: python for game programming

2008-02-03 Thread miller . paul . w
On Feb 3, 9:05 am, t3chn0n3rd [EMAIL PROTECTED] wrote: Is Python program language popular for game programming? Well, Python is at the center of my favorite game, Sid Meier's Civilization 4. :-) Another poster mentioned the pygame and pyglet libraries. I'd suggest you look into them if you

Re: Python GUI toolkit

2008-02-03 Thread miller . paul . w
On Feb 3, 10:39 am, [EMAIL PROTECTED] wrote: also, is qt4 apps better looking in both win/linux than wx apps, coz the main thing i m looking for is visual appeal of the gui. Well, well... this wasn't in your original post. I had assumed ease of programming and cross-platform-ness were the

Re: Python GUI toolkit

2008-02-03 Thread miller . paul . w
I'd like to offer you one suggestion about coding your app. You'll be best served if you can either write it as a command-line app and write a separate GUI-front end for it, or use an abstraction layer between your app and the display logic that allows you to easily plug in other GUI toolkits.

Re: psyco question

2008-02-03 Thread miller . paul . w
Thanks for your reply. It's been a while since I've used psyco, and it seems either some functions have been added, or I've never needed the other ones. :-) For the record, it looks like psyco.bind (f) f2 = psyco.unproxy(f) would leave me with an optimized f and a function f2 which is the

Re: Project naming suggestions?

2008-02-03 Thread miller . paul . w
On Feb 3, 2:36 pm, Wildemar Wildenburger [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I'm considering writing a little interpreter for a python-like language and I'm looking for name suggestions. :-) How about Whython? /W I like it. :P If you were wondering why I was thinking of

Re: psyco question

2008-02-03 Thread miller . paul . w
On Feb 3, 2:19 pm, [EMAIL PROTECTED] wrote: simple solution is to defer the optimization. That is test the original code, call Psyco, then test it again: I had thought of that, but it didn't really meet my requirements. I might want the unoptimized function back at some point after I call the

Re: Project naming suggestions?

2008-02-03 Thread miller . paul . w
On Feb 3, 2:37 pm, Thomas Dybdahl Ahle [EMAIL PROTECTED] wrote: Are you really thinking about creating an entire language, simply because you don't like 'for dummy in xrange (n):'? No. I now wish I had posted this before that. :-) Basically, I want to tweak a programming language and a

Does anyone else use this little idiom?

2008-02-02 Thread miller . paul . w
Ruby has a neat little convenience when writing loops where you don't care about the loop index: you just do n.times do { ... some code ... } where n is an integer representing how many times you want to execute some code. In Python, the direct translation of this is a for loop. When the index

Re: securing a python execution environment...

2007-11-28 Thread miller . paul . w
Here's some proof of concept code I wrote a while back for this very purpose. What I do is use compiler.parse to take a code string and turn it into an abstract syntax tree. Then, using a custom visitor object that raises an exception if it comes across something it doesn't like, I use

Re: PyMultimethods

2007-11-27 Thread miller . paul . w
On Nov 27, 7:14 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I've written a small project that implements multimethods for python. Interesting. Were you aware of the article Guido wrote on multimethods in python? ( www.artima.com/weblogs/viewpost.jsp?thread=101605 ) Although I'm a decent