[Python-ideas] Powerset

2018-10-15 Thread Hasan Diwan
[if this isn't the correct spot, let me know and I'll gladly take it elsewhere] I have found myself needing powerset functionality several times recently to the point where I wondered if there's interest in making it part of the standard library. I have a working implementation and tests. Would tak

Re: [Python-ideas] Powerset

2018-10-15 Thread Sebastian Kreft
Hi Hassan, I think this is unlikely to get added to the standard library as it is listed as a recipe in the itertools module ( https://docs.python.org/3/library/itertools.html#itertools-recipes). You may want to check out the more-itertools package ( https://more-itertools.readthedocs.io/en/latest

Re: [Python-ideas] Powerset

2018-10-15 Thread Steven D'Aprano
Hi Hasan, and welcome, On Mon, Oct 15, 2018 at 11:15:47AM -0700, Hasan Diwan wrote: > [if this isn't the correct spot, let me know and I'll gladly take it > elsewhere] > I have found myself needing powerset functionality several times > recently to the point where I wondered if there's interest

Re: [Python-ideas] Powerset

2018-10-15 Thread Hasan Diwan
> This is certainly the right place to discuss this, but you shouldn't > assume that everyone reading will know what powerset functionality you > are referring to. > Is it the same as the recipe in the itertools documentation? Yes pretty much. > > https://docs.python.org/3/library/itertools.html#i

Re: [Python-ideas] Powerset

2018-10-15 Thread Wes Turner
Is there a name for an iteration of the powerset which is more useful for binary search? I.e. instead of starting with null set, start with the "middle" ( r/2 ). Maybe a bit OT, but is there a name for such a combinatorial search? On Monday, October 15, 2018, Hasan Diwan wrote: > > This is cert

Re: [Python-ideas] Powerset

2018-10-15 Thread Greg Ewing
Wes Turner wrote: Is there a name for an iteration of the powerset which is more useful for binary search? I.e. instead of starting with null set, start with the "middle" ( r/2 ). You'll have to provide more detail about what you want to search and how you intend to search it. There isn't a si

Re: [Python-ideas] Powerset

2018-10-15 Thread Pål Grønås Drange
> Is there a name for an iteration of the powerset which is more useful for binary search? I.e. instead of starting with null set, start with the "middle" ( r/2 ). > > Maybe a bit OT, but is there a name for such a combinatorial search? Not that I know of, especially since this has the unfortunate

Re: [Python-ideas] Powerset

2018-10-15 Thread Hasan Diwan
On Mon, 15 Oct 2018 at 23:25, Pål Grønås Drange wrote: > Hasan, if you recall that the powerset is just > `yield from S choose k for k from 0 to |S|+1`, > you see that that is exactly the implementation in the examples page. I know that, but when one searches for a powerset function, the logical