Re: An efficient, pythonic way to calculate result sets

2007-10-26 Thread happyhondje
> def cross_nodups(*args): > 'Cross product after eliminating repeat elements, keeping constant > size' > ans = [[]] > for arg in args: > ans = [x+[y] for x in ans for y in arg if y not in x] > return ans > > def choose_first(obj1, *args): > 'Assume a choice of a first o

Re: An efficient, pythonic way to calculate result sets

2007-10-26 Thread happyhondje
On Oct 26, 2:33 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Oct 25, 8:31 am, [EMAIL PROTECTED] wrote: > > > > > I've got a little issue, both programming and performance-wise. I have > > a set, containing objects that refer to other sets. For example, in a > > simple notation: (, ) (or in

Re: An efficient, pythonic way to calculate result sets

2007-10-25 Thread Raymond Hettinger
> Easy exercise of transforming recursion to iteration left to the > reader. Ack! That part was already done. Raymond -- http://mail.python.org/mailman/listinfo/python-list

Re: An efficient, pythonic way to calculate result sets

2007-10-25 Thread Raymond Hettinger
On Oct 25, 8:31 am, [EMAIL PROTECTED] wrote: > I've got a little issue, both programming and performance-wise. I have > a set, containing objects that refer to other sets. For example, in a > simple notation: (, ) (or in a more object-like > display: set(obj1.choices=set(a, b, c) ). There may be ob

Re: An efficient, pythonic way to calculate result sets

2007-10-25 Thread happyhondje
On Oct 25, 8:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 25, 10:31 am, [EMAIL PROTECTED] wrote: > > > > > Hello everyone, > > > I've got a little issue, both programming and performance-wise. I have > > a set, containing objects that refer to other sets. For example, in a > > sim

Re: An efficient, pythonic way to calculate result sets

2007-10-25 Thread [EMAIL PROTECTED]
On Oct 25, 10:31 am, [EMAIL PROTECTED] wrote: > Hello everyone, > > I've got a little issue, both programming and performance-wise. I have > a set, containing objects that refer to other sets. For example, in a > simple notation: (, ) (or in a more object-like > display: set(obj1.choices=set(a, b,

An efficient, pythonic way to calculate result sets

2007-10-25 Thread happyhondje
Hello everyone, I've got a little issue, both programming and performance-wise. I have a set, containing objects that refer to other sets. For example, in a simple notation: (, ) (or in a more object-like display: set(obj1.choices=set(a, b, c) ). There may be obj1..objN objects in the outer set, a