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
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
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)
>
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
>
> >>
> >>> 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,
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