Re: stdin or optional fileinput

2006-03-15 Thread the.theorist
Steven Bethard wrote: > the.theorist wrote: > > I was writing a small script the other day with the following CLI > > prog [options] [file]* > > > > I've used getopt to parse out the possible options, so we'll ignore > > that part, and assume for the res

stdin or optional fileinput

2006-03-15 Thread the.theorist
I was writing a small script the other day with the following CLI prog [options] [file]* I've used getopt to parse out the possible options, so we'll ignore that part, and assume for the rest of the discussion that args is a list of file names (if any provided). I used this bit of code to detect

Re: trouble pyparsing

2006-01-04 Thread the.theorist
Boy, do I feel sheepish. Yes, what I wanted were Literals. That clarifies things greatly. Thank you. Also, I went browsing around further, and found on O'reilly's CodeZoo: Most of the methods in the pyparsing module are very easy to figure out. Forward() might not be as obvious. To get going with

Re: trouble pyparsing

2006-01-04 Thread the.theorist
Sorry, got a bit of formatting wrong. Messed up what I was really trying to point out. container_tag << Group(open_tag + OneOrMore(container_tag | content) # ^name^recursive reference -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble pyparsing

2006-01-04 Thread the.theorist
Looks like the fundamental error was in my understanding. Boy, do I feel sheepish. Yes, what I wanted were Literals. That clarifies things greatly. Thank you. Also, I went browsing around further, and found on O'reilly's CodeZoo: Most of the methods in the pyparsing module are very easy to figure

trouble pyparsing

2006-01-04 Thread the.theorist
Hey, I'm trying my hand and pyparsing a log file (named l.log): FIRSTLINE PROPERTY1 DATA1 PROPERTY2 DATA2 PROPERTYS LIST ID1 data1 ID2 data2 ID1 data11 ID2 data12 SECTION So I wrote up a small bit of code (named p.py): from pyparsing im

Re: Setting Class Attributes

2005-10-25 Thread the.theorist
So that it'll be easier to remember the next time I find myself in the same situation on a different task, I'll extend the discussion somewhat. Coming from C, I had expected that I'd get a new empty dict every time the __init__ function ran. Guido (or some other benevolent) had decided to implemen

Re: Setting Class Attributes

2005-10-25 Thread the.theorist
Bruno Desthuilliers wrote: > the.theorist a écrit : > > I have a small, simple class which contains a dictionary (and some > > other stuff, not shown). I then have a container class (Big) that holds > > some instances of the simple class. When I try to edit the elements of &g

Setting Class Attributes

2005-10-25 Thread the.theorist
I have a small, simple class which contains a dictionary (and some other stuff, not shown). I then have a container class (Big) that holds some instances of the simple class. When I try to edit the elements of the dictionary, all instances obtain those changes; I want each instance to hold separate