Number Sequencing, Grouping and Filtering

flebber flebber.crue at gmail.com
Tue Mar 10 19:45:26 EDT 2009


On Mar 10, 9:07 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Tue, Mar 10, 2009 at 3:00 AM, flebber <flebber.c... at gmail.com> wrote:
> > On Mar 10, 8:54 pm, flebber <flebber.c... at gmail.com> wrote:
> >> Hi
>
> >> I was hoping someone would be able to point me in the direction of
> >> some good documentation regarding sequencing, grouping and filtering
> >> and in which order they should be done.
>
> >> As a small example it is easy to create the range of numbers 1 to 20.
> >> But if I wanted to group all possible combinations of sets of 4
> >> numbers within this range is there already an in uilt function for
> >> this I am searching the module docs with "number sequencing" and
> >> "number grouping" but cannot find info.
>
> >> Then if I wanted to refine this results further eg no consecutive
> >> numbers to be contained in sets. Is it best to create all sets and
> >> then filter the sets for things matching this criteria or to set this
> >> condition in a creation. Creating sets and then filtering would soon
> >> become unwieldy with a larger range I would imagine..
>
> >> An ideas, pointers to docs or better search terms to help me explore
> >> this further would be appreciated.
>
> >> Thanks Sayth
>
> > I have just found itertools is this acheivable using combinations()
> > and groupby() in itertools?
>
> Yes; indeed, those were the functions your post brought to mind and
> which led me to suggest itertools.
>
> Cheers,
> Chris
>
> --
> I have a blog:http://blog.rebertia.com

the only issue i can see is that i am using python 2.54 currently as
ifelt it more supported by other programs than 2.6 or 3.0. After
searching it seems that itertools has had a upgrade in 2.61



More information about the Python-list mailing list