Would a frozendict require that keys and values be hashable?
It seems to me that we would need this restriction to make a reasonably
universal frozendict that is, itself, hashable. With this restriction for
the general case, is there still sufficient value for everyone that is
asking for a frozend
> [...] 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 iter
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: https://sks-keyservers.net/pks/lookup?
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 e
On Tue, Oct 16, 2018 at 7:02 PM George Leslie-Waksman wrote:
>
> Would a frozendict require that keys and values be hashable?
Keys would already have to be hashable - regular dicts demand this,
and there's no reason not to for frozendict.
Values? Not so sure. Personally I would say that no, they
On Tue, Oct 16, 2018 at 01:02:03AM -0700, George Leslie-Waksman wrote:
> Would a frozendict require that keys and values be hashable?
Keys, yes. Values, no.
If the values were hashable, the frozendict itself would also be
hashable. If not, then it would be like trying to hash a tuple with
unhas
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 you
Wes Turner wrote:
> Obviously, this is combinatorics and set theory (category theory (HOTT));
> here in the itertools library for iterables.
Powerset is a small problem, and HoTT is a big solution. I know this
because I've got the standard book sitting, largely unread, on my
bookshelf for over a
вторник, 16 октября 2018 г., 12:29:55 UTC+3 пользователь Steven D'Aprano
написал:
>
>
> > It seems to me that we would need this restriction to make a reasonably
> > universal frozendict that is, itself, hashable.
>
> When people talk about frozendicts being hashable, they mean it in the
> sa
"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, P
I think it could inherit from the Mapping abc?
class frozendict(Mapping):
def __new__(cls, *args, **kwargs):
d = dict(*args, **kwargs)
proxy = MappingProxyType(d)
instance = super().__new__(cls)
instance.__proxy = proxy
return instance
def __hash__
11 matches
Mail list logo