On Sat, Jan 22, 2022 at 09:57:44AM +1100, Chris Angelico wrote:
> Okay, so what would freezing a function be useful for, then?
Why are you asking me, I'm not proposing a generic "freeze" protocol.
--
Steve
___
Python-ideas mailing list --
On Fri, Jan 21, 2022 at 08:36:37AM -0800, Christopher Barker wrote:
> On Fri, Jan 21, 2022 at 3:52 AM Oscar Benjamin
> wrote:
> > I really don't understand (having read everything above) why anyone
> > prefers {1,2,3}.frozen() over f{1,2,3}.
> >
>
> Because it doesn't require any change to the
On Sat, 22 Jan 2022 at 09:45, Steven D'Aprano wrote:
>
> On Fri, Jan 21, 2022 at 10:56:42PM +1100, Chris Angelico wrote:
>
> > Let's be fair here... The idea of freezing is to make it hashable,
>
> And immutable.
>
> > so there's no point talking about freezing a function, module,
>
> Neither of
On Fri, Jan 21, 2022 at 10:56:42PM +1100, Chris Angelico wrote:
> Let's be fair here... The idea of freezing is to make it hashable,
And immutable.
> so there's no point talking about freezing a function, module,
Neither of which are immutable.
--
Steve
On 21Jan2022 12:22, Ben Rudiak-Gould wrote:
>There seem to be two different reasons people want a generic freeze syntax:
>
>1. Making a hashable copy of an arbitrary object
>
>2. Avoiding O(n) rebuilding of literals on every use (a constant for
>bytecode, as you put it)
The purpose of the
There seem to be two different reasons people want a generic freeze syntax:
1. Making a hashable copy of an arbitrary object
2. Avoiding O(n) rebuilding of literals on every use (a constant for
bytecode, as you put it)
In both 1 and 2, not only the object but all of its children need to be
On 21Jan2022 20:57, Steven D'Aprano wrote:
>On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:
>
>> Paired with a __freeze__ dunder method, this applies to any type, not
>> just sets. (Where appropriate of course.)
>>
>> So:
>>
>> |{1,2,3}| frozen set
>> |[1,2,3]|
On Fri, Jan 21, 2022 at 3:52 AM Oscar Benjamin
wrote:
> > If this does all come to pass, then:
>>> >
>>> > s = {3,8,2}.frozen()
>>> > will be slightly faster, in some case, than
>>> > s = frozenset({3,8,2}
>>> >
>>> > but the result would be the same.
>>>
>>> I really don't understand
Hi all,
python-ideas moderator here. It’d be great if y’all could take a few days to
cool off the frozen set discussion, which is veering off the rails a little bit
into emotional language.
I’ll keep an eye on it and put emergency moderation into effect if I must, but
it’d be nicer if I
On Sat, 22 Jan 2022 at 00:56, Joao S. O. Bueno wrote:
>>
>> I don't understand polynomials as frozensets. What's the point of
>> representing them that way? Particularly if you're converting to and
>> from dicts all the time, why not represent them as dicts? Or as some
>> custom mapping type, if
On Sat, 22 Jan 2022 at 00:30, Joao S. O. Bueno wrote:
>>
>> Yes, but have you _seen_ the bickering about the existing bracket
>>
>> choices just for frozenset? Eww. Hence the going for a distinct operator
>> altogether. Yes, I'd prefer brackets of some kind too, but they're
>> taken.
>
> If one
>
> I don't understand polynomials as frozensets. What's the point of
> representing them that way? Particularly if you're converting to and
> from dicts all the time, why not represent them as dicts? Or as some
> custom mapping type, if you need it to be hashable?
Sorry for deviating here, but
>
> Yes, but have you _seen_ the bickering about the existing bracket
>
> choices just for frozenset? Eww. Hence the going for a distinct operator
> altogether. Yes, I'd prefer brackets of some kind too, but they're
> taken.
>
> If one uses prefixes, you start from 53 valid (all latin areas,
On 21/01/2022 11:51, Oscar Benjamin wrote:
I really don't understand (having read everything above) why anyone
prefers {1,2,3}.frozen() over f{1,2,3}. Yes, some people coming from
some other languages might get confused (e.g. in Mathematica this is
function call syntax) but that's true of
On Fri, 21 Jan 2022 at 12:15, Chris Angelico wrote:
>
> On Fri, 21 Jan 2022 at 22:52, Oscar Benjamin
> wrote:
> >
> > I really don't understand (having read everything above) why anyone prefers
> > {1,2,3}.frozen() over f{1,2,3}. Yes, some people coming from some other
> > languages might get
On Fri, 21 Jan 2022 at 22:52, Oscar Benjamin wrote:
>
> On Thu, 20 Jan 2022 at 10:19, Ricky Teachey wrote:
>>
>> On Thu, Jan 20, 2022 at 3:35 AM Stephen J. Turnbull
>> wrote:
>>>
>>> Christopher Barker writes:
>>>
>>> > If this does all come to pass, then:
>>> >
>>> > s = {3,8,2}.frozen()
On Fri, Jan 21, 2022 at 6:57 AM Chris Angelico wrote:
> On Fri, 21 Jan 2022 at 22:52, Ricky Teachey wrote:
> >
> > On Fri, Jan 21, 2022 at 5:04 AM Steven D'Aprano
> wrote:
> >>
> >> On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:
> >>
> >> > Paired with a __freeze__ dunder
On Fri, 21 Jan 2022 at 22:52, Ricky Teachey wrote:
>
> On Fri, Jan 21, 2022 at 5:04 AM Steven D'Aprano wrote:
>>
>> On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:
>>
>> > Paired with a __freeze__ dunder method, this applies to any type, not
>> > just sets. (Where appropriate of
On Thu, 20 Jan 2022 at 10:19, Ricky Teachey wrote:
> On Thu, Jan 20, 2022 at 3:35 AM Stephen J. Turnbull <
> stephenjturnb...@gmail.com> wrote:
>
>> Christopher Barker writes:
>>
>> > If this does all come to pass, then:
>> >
>> > s = {3,8,2}.frozen()
>> > will be slightly faster, in some
On Fri, Jan 21, 2022 at 5:04 AM Steven D'Aprano wrote:
> On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:
>
> > Paired with a __freeze__ dunder method, this applies to any type, not
> > just sets. (Where appropriate of course.)
> >
> > So:
> >
> > |{1,2,3}| frozen set
>
On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote:
> Paired with a __freeze__ dunder method, this applies to any type, not
> just sets. (Where appropriate of course.)
>
> So:
>
> |{1,2,3}| frozen set
> |[1,2,3]| tuple!
> |any-iterable| tuple!
> |{1:2,
On Fri, 21 Jan 2022 at 19:53, Cameron Simpson wrote:
>
> On 20Jan2022 19:31, Eric V. Smith wrote:
> >See also the rejected PEP 351.
>
> Ah. So close to my idea as to be indistinguishable. That's a shame.
> Thanks, Cameron Simpson
It's worth noting that a rejected PEP isn't the final and
On 21Jan2022 01:16, MRAB wrote:
>On 2022-01-21 00:18, Cameron Simpson wrote:
>>This all feels to me like a special case of "wanting a constant for
>>bytecode". What is we had a "freeze" operator, eg:
>> |foo|
[...]
>>Paired with a __freeze__ dunder method, this applies to any type, not
On 20Jan2022 19:31, Eric V. Smith wrote:
>See also the rejected PEP 351.
Ah. So close to my idea as to be indistinguishable. That's a shame.
Thanks, Cameron Simpson
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an
24 matches
Mail list logo