Re: [Python-ideas] Powerset

2018-10-16 Thread Nick Timkovich
"more-itertools" seems to be a modestly popular library (top 100-500?) that includes the stdlib itertools recipes and more. https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.powerset On Tue, Oct 16, 2018 at 3:42 AM Hasan Diwan wrote: > Pal, > On Tue, 16 Oct 2018 at 01:36,

Re: [Python-ideas] Powerset

2018-10-16 Thread Wes Turner
On Tuesday, October 16, 2018, Greg Ewing wrote: > 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

Re: [Python-ideas] Powerset

2018-10-16 Thread Nicolas Rolin
Can we get an utilisation context ? I don't think it belongs in the stdlib alone on the basis that its output is not linear in the size of its input (but exponential), so it explode even for a mid-sized list, which by nature limits greatly its usage. The question would be wether or not it is used

Re: [Python-ideas] Powerset

2018-10-16 Thread Hasan Diwan
Pal, On Tue, 16 Oct 2018 at 01:36, Pål Grønås Drange wrote: > I do however agree that there could be a powerset function there for > convenience, but only +0. That is the best argument I could come up with to justify a set#powerset method. -- H -- OpenPGP:

Re: [Python-ideas] Powerset

2018-10-16 Thread Pål Grønås Drange
> [...] when one searches for a powerset function, the > logical place to look isn't itertools, it's the set class. -- H That's a rather object-oriented view, I think. So you look for the permutation function in the list class? I prefer these functions gathered in one place, and I find that

Re: [Python-ideas] Powerset

2018-10-16 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

Re: [Python-ideas] Powerset

2018-10-16 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

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

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

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. > >

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 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 (

[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