[ANN]:JSONStream

2013-07-15 Thread Sol Toure
I was trying to process a large file containing a number of distinct JSON object as a stream, but I couldn't find anything readily available to that. (maybe I didn't search hard enough) So I came up with this: https://github.com/qrtz/JSONStream I hope you find it useful too. -- http://mail.pytho

Re: [ANN]:JSONStream

2013-07-17 Thread Sol Toure
I didn't look into using YAML processor. Also that would have required pre-processing the data to add the separators. With this method you don't need the separators. You can have 0 or more white space between objects: for obj in JSONStream(StringIO('''{"one":1}{"two":2}{"three":3} 4 {"five": 5

Re: regexp matching end of line or comma

2010-11-25 Thread Sol Toure
Try this: '(?P\S+)(,|$)' On Thu, Nov 25, 2010 at 9:40 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > Hy guys, > > I'm struggling matching patterns ending with a comma ',' or an end of line > '$'. > > import re > > ex1 = 'sumthin,' > ex2 = 'sumthin' > m1 = re.match('(?P\S+),', ex1) >

Re: Needed: Real-world examples for Python's Cooperative Multiple Inheritance

2010-11-30 Thread Sol Toure
Most of the examples presented here can use the "decorator pattern" instead. Especially the window system On Mon, Nov 29, 2010 at 5:27 PM, Gregory Ewing wrote: > Paul Rubin wrote: > > The classic example though is a window system, where you have a "window" >> class, and a "scroll bar" class, an

Re: Trying to decide between PHP and Python

2011-01-06 Thread Sol Toure
> > >> > >>> There. Now that I've tossed some gasoline on the language wars fire, > >>> I'll duck and run in the other direction :-) > >> > >> May I suggest a better strategy? Run first, duck next :-). > > > > Or more precisely: > > > > ((run) duck) > > If you're going to mock another language,

Re: How to improve this code?

2009-09-15 Thread Sol Toure
def are_elements_present(sourceList, searchList):for e in searchList: if e not in sourceList: return False return True Using set: def are_elements_present(sourceList, searchList): return len(set(sourceList).intersection(set(searchList)) == len(searchLis