Adjacency lists with sqlalchemy...

2009-09-03 Thread Just Another Victim of the Ambient Morality
I'm desperately trying to declare an adjacency list table with declarative_base() but I can't figure it out. Strangely, all the documentation avoids declarative_base() like the plague and does everything the hard way. What the hell is this thing for if we're not supposed to use it?

Re: Confessions of a Python fanboy

2009-08-05 Thread Just Another Victim of the Ambient Morality
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote in message news:pan.2009.08.04.09.28...@remove.this.cybersource.com.au... On Tue, 04 Aug 2009 10:03:53 +0200, Bruno Desthuilliers wrote: Disadvantages: your code is filled with line noise. It's an arbitrary choice between @@ meaning

Why doesn't this RE match?

2009-02-06 Thread Just Another Victim of the Ambient Morality
I'm confused by this behaviour: import re regex = re.compile('foo') match = regex.match('whatfooever') In my experience with regular expressions, regex should have found a match. However, in this case regex.match() returns None. Why is that? What am I missing? Thank you...

Bad hack fix around a bizarre problem...

2009-01-11 Thread Just Another Victim of the Ambient Morality
I'm trying to write a Python program that manipulates a MySQL database and have chosen to use MySQLdb. So, I used by system's package manager, YUM, and it appeared to install correctly. So, I tried it out and got this error: Traceback (most recent call last): File stdin, line 1, in ?

Any news on when some libraries will be ported to Python 3.0?

2009-01-07 Thread Just Another Victim of the Ambient Morality
I'm excited to use Python 3.0 (foolishly, it's the only Python interpreter I have on my system) but there are no libraries for it beyond the kitchen sink. Personally, a good start would be Beautiful Soup and Mechanize. I could also use DB. Has there been any word on Beautiful Soup?

Are Python deques linked lists?

2007-12-09 Thread Just Another Victim of the Ambient Morality
I'm looking for a linked list implementation. Something iterable with constant time insertion anywhere in the list. I was wondering if deque() is the class to use or if there's something else. Is there? Thank you... -- http://mail.python.org/mailman/listinfo/python-list

How do I not make a list?

2007-11-29 Thread Just Another Victim of the Ambient Morality
It may sound like a strange question but that's probably only because I don't know the proper terminology. I have an iterable object, like a list, and I want to perform a transform on it (do an operation on each of the elements) and then pass it onto something else that expects and

A bug in Python's regular expression engine?

2007-11-27 Thread Just Another Victim of the Ambient Morality
This won't compile for me: regex = re.compile('(.*\\).*') I get the error: sre_constants.error: unbalanced parenthesis I'm running Python 2.5 on WinXP. I've tried this expression with another RE engine in another language and it works just fine which leads me to believe the

Re: A bug in Python's regular expression engine?

2007-11-27 Thread Just Another Victim of the Ambient Morality
Paul Hankin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 27, 3:48 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: This won't compile for me: regex = re.compile('(.*\\).*') I get the error: sre_constants.error: unbalanced parenthesis

How do I convert escaped HTML into a string?

2007-11-23 Thread Just Another Victim of the Ambient Morality
I've done a google search on this but, amazingly, I'm the first guy to ever need this! Everyone else seems to need the reverse of this. Actually, I did find some people who complained about this and rolled their own solution but I refuse to believe that Python doesn't have a built-in

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure one needs to start again with a naive approach just

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-07, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] You might be interested in the Early parsing algorithm

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 3:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: In short, it hasn't really evovled into a user-friendly package yet. Thank you. How is it that I seem

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 07 Nov 2007 21:15:50 +, Just Another Victim of the Ambient Morality wrote: Why can't I find a pyparsing-esque library with this implementation? I'm tempted to roll my own except that it's a fairly

Re: Is pyparsing really a recursive descent parser?

2007-11-07 Thread Just Another Victim of the Ambient Morality
Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 5:15 PM, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Chris Mellon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 7, 2007 3:15 PM, Just Another Victim

How do I change elements in a list?

2007-11-06 Thread Just Another Victim of the Ambient Morality
How do you change certain elements in a list? I'm looking to do the Python equivalent of this Ruby code: - first = [1, 2] = [1, 2] - second = first = [1, 2] - first.map! {|i| i + 1} = [2, 3] - first = [2, 3] - second = [2, 3] I need to change a list, in place, so other

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there not an ambiguity in the grammar? In EBNF: goal

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Consider writing a recursive decent parser by hand to parse the language '[ab]+b'. goal -- ab_list 'b' ab_list -- 'a' list_tail

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-04, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I believe there's no cure for the confusion you're having except

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] I believe there is a cure and it's called recursive descent parsing. It's slow, obviously, but it's correct and, sometimes (arguably

Re: Is pyparsing really a recursive descent parser?

2007-11-04 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-05, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Kay Schluehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 4, 10:44 pm, Just Another Victim of the Ambient Morality

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive descent parser any more than having a recursive

Re: Is pyparsing really a recursive descent parser?

2007-11-03 Thread Just Another Victim of the Ambient Morality
Neil Cerutti [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-11-03, Paul McGuire [EMAIL PROTECTED] wrote: On Nov 3, 12:33 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: It has recursion in it but that's not sufficient to call it a recursive

Re: Is pyparsing really a recursive descent parser?

2007-11-02 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Nov 2, 5:47 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: Pyparsing is no recursive descent parser. It doesn't go back in the input stream. The ``OneOrMore(Word(alphas))`` part eats the 'end' and when it

Is pyparsing really a recursive descent parser?

2007-11-01 Thread Just Another Victim of the Ambient Morality
Is pyparsing really a recursive descent parser? I ask this because there are grammars it can't parse that my recursive descent parser would parse, should I have written one. For instance: from pyparsing import * grammar = OneOrMore(Word(alphas)) + Literal('end')

Re: Is there a usenet library for Python?

2007-11-01 Thread Just Another Victim of the Ambient Morality
Grant Edwards [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 2007-10-30, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Is there a Python library to communicate with a usenet server? Which protocol are you interested in, NNTP (for reading/posting from

Is there a usenet library for Python?

2007-10-30 Thread Just Another Victim of the Ambient Morality
Is there a Python library to communicate with a usenet server? I did a bit of googling and found some sites that suggest that you can roll your own fairly easily but, mostly, I got a lot of false positives with talk of Python libraries on usenet and I am really hoping this work has already

Need help parsing with pyparsing...

2007-10-22 Thread Just Another Victim of the Ambient Morality
I'm trying to parse with pyparsing but the grammar I'm using is somewhat unorthodox. I need to be able to parse something like the following: UPPER CASE WORDS And Title Like Words ...into two sentences: UPPER CASE WORDS And Title Like Words I'm finding this surprisingly hard to

Re: Need help parsing with pyparsing...

2007-10-22 Thread Just Another Victim of the Ambient Morality
Paul McGuire [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Oct 22, 4:18 am, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: I'm trying to parse with pyparsing but the grammar I'm using is somewhat unorthodox. I need to be able to parse something

Unexpected behaviour with HTMLParser...

2007-10-09 Thread Just Another Victim of the Ambient Morality
HTMLParser is behaving in, what I find to be, strange ways and I would like to better understand what it is doing and why. First, it doesn't appear to translate HTML escape characters. I don't know the actual terminology but things like amp; don't get translated into as one would

Re: Unexpected behaviour with HTMLParser...

2007-10-09 Thread Just Another Victim of the Ambient Morality
Diez B. Roggisch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Just Another Victim of the Ambient Morality schrieb: HTMLParser is behaving in, what I find to be, strange ways and I would like to better understand what it is doing and why. First, it doesn't appear

Getting VideoCapture to work with Python 2.5

2006-12-29 Thread Just Another Victim of the Ambient Morality
I can't seem to get VideoCapture (http://videocapture.sourceforge.net/) to work with my version of Python (2.5). Why is that? I've followed the instructions which made it look easy but, as it happens all too often, it simply doesn't work. The error I get is that the .py interface file

I'm looking for a pythonic red-black tree...

2006-12-14 Thread Just Another Victim of the Ambient Morality
I need a red-black tree in Python and I was wondering if there was one built in or if there's a good implementation out there. Something that, lets face it, does whatever the C++ std::map allows you to do... Thank you... -- http://mail.python.org/mailman/listinfo/python-list

Looking for a decent HTML parser for Python...

2006-12-05 Thread Just Another Victim of the Ambient Morality
I'm trying to parse HTML in a very generic way. So far, I'm using SGMLParser in the sgmllib module. The problem is that it forces you to parse very specific tags through object methods like start_a(), start_p() and the like, forcing you to know exactly which tags you want to handle. I

Re: Looking for a decent HTML parser for Python...

2006-12-05 Thread Just Another Victim of the Ambient Morality
Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm trying to parse HTML in a very generic way. So far, I'm using SGMLParser in the sgmllib module. The problem is that it forces you to parse very specific tags through object

Re: Looking for a decent HTML parser for Python...

2006-12-05 Thread Just Another Victim of the Ambient Morality
Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Okay, I think I found what I'm looking for in HTMLParser in the HTMLParser module. Except it appears to be buggy or, at least, not very robust. There are websites for which