On Mar 7, 8:47 pm, Raymond Hettinger wrote:
> The existing groupby() itertool works great when every element in a
> group has the same key, but it is not so handy when groups are
> determined by boundary conditions.
>
> For edge-triggered events, we need to convert a boundary-event
> predicate to
In article <6ca71455-2fb2-4dd0-a500-2a480d815...@v6g2000vbb.googlegroups.com>,
Raymond Hettinger wrote:
>
>For edge-triggered events, we need to convert a boundary-event
>predicate to groupby-style key function. The code below encapsulates
>that process in a new itertool called split_on().
>
>Wo
On Mar 7, 8:47 pm, Raymond Hettinger wrote:
> The existing groupby() itertool works great when every element in a
> group has the same key, but it is not so handy when groups are
> determined by boundary conditions.
>
> For edge-triggered events, we need to convert a boundary-event
> predicate to
On Mar 9, 6:55 pm, Raymond Hettinger wrote:
> [prueba]
>
> > The data often contains objects with attributes instead of tuples, and
> > I expect the new namedtuple datatype to be used also as elements of
> > the list to be processed.
>
> > But I haven't found a nice generalized way for that kind o
[prueba]
> The data often contains objects with attributes instead of tuples, and
> I expect the new namedtuple datatype to be used also as elements of
> the list to be processed.
>
> But I haven't found a nice generalized way for that kind of pattern
> that aggregates from a list of one datatype t
On Mar 7, 8:47 pm, Raymond Hettinger wrote:
> The existing groupby() itertool works great when every element in a
> group has the same key, but it is not so handy when groups are
> determined by boundary conditions.
>
> For edge-triggered events, we need to convert a boundary-event
> predicate to
Raymond Hettinger:
>In your experiences with xsplit(), do most use cases involve removing the
>separators?<
Unfortunately I am not able to tell you how often I remove them. But
regarding strings, I usually want to remove separators:
>>> "aXcdXfg".split("X")
['a', 'cd', 'fg']
So sometimes I wan
On Mar 7, 7:58 pm, bearophileh...@lycos.com wrote:
> Raymond Hettinger, maybe it can be useful to add an optional argument
> flag to tell such split_on to keep the separators or not? This is the
> xsplit I usually use:
In your experiences with xsplit(), do most use cases involve removing
the separ
On Mar 7, 8:47 pm, Raymond Hettinger wrote:
> The existing groupby() itertool works great when every element in a
> group has the same key, but it is not so handy when groups are
> determined by boundary conditions.
>
> For edge-triggered events, we need to convert a boundary-event
> predicate to
Raymond Hettinger, maybe it can be useful to add an optional argument
flag to tell such split_on to keep the separators or not? This is the
xsplit I usually use:
def xsplit(seq, key=bool, keepkeys=True):
"""xsplit(seq, key=bool, keepkeys=True): given an iterable seq and
a predicate
key, s
The existing groupby() itertool works great when every element in a
group has the same key, but it is not so handy when groups are
determined by boundary conditions.
For edge-triggered events, we need to convert a boundary-event
predicate to groupby-style key function. The code below encapsulates
11 matches
Mail list logo