On Wed, Jan 19, 2022 at 6:21 AM Joao S. O. Bueno
wrote:
> Here is another hint that this usage would not resolve the problem of
>>
> having a literal frozenset. Even in the core of this discussion, with folks
> participating and knowing what they are talking about, the first thing that
> comes to
On Wed, Jan 19, 2022 at 2:12 PM Greg Ewing
wrote:
> Those particular brackets are really confusing because they're half
> square and half round.
And THAT is why this is a bad idea.
Frankly, depending on the font and the screen and my bad old eyes, it’s
hard enough to tell the three brackets th
On 20/01/22 3:45 am, Alexandre Brault wrote:
On 2022-01-18 6:12 p.m., Chris Angelico wrote:
3) Optional semantic difference: 【1, 2, 3】 is exactly the same as (1,
2, 3), but 【1, 2, 3) would be an error.
What does it say about the viability of this idea that until the second
part of that sentenc
On Thu, Jan 20, 2022 at 1:47 AM Alexandre Brault
wrote:
>
> On 2022-01-18 6:12 p.m., Chris Angelico wrote:
> > 3) Optional semantic difference: 【1, 2, 3】 is exactly the same as (1,
> > 2, 3), but 【1, 2, 3) would be an error.
>
> What does it say about the viability of this idea that until the seco
On 2022-01-18 6:12 p.m., Chris Angelico wrote:
3) Optional semantic difference: 【1, 2, 3】 is exactly the same as (1,
2, 3), but 【1, 2, 3) would be an error.
What does it say about the viability of this idea that until the second
part of that sentence, I thought it would be equivalent to [1, 2,
>
> Also, it is standard in Python to avoid properties if the computation
> could be expensive. Copying a large set or millions of elements into a
> frozenset could be expensive, so we should keep it a method call.
Here is another hint that this usage would not resolve the problem of
having a lit
Joao's
{1, 2, 3}.frozen()
shows real originality, arising from deep creative thought about the roots
of the problem. I was both surprised and delighted when I saw it, and I
think some others were too. (I agree with others that here 'freeze' is
better than 'frozen'.)
Obviously, each of the two
On Wed, Jan 19, 2022 at 10:30:05AM -0300, Joao S. O. Bueno wrote:
> Maybe the "special optimizable method" will solve some of the problems, and
> appraise the "no new syntax" folks.
[...]
I pretty much agree with everything Joao says here. The hypothetical
peephole optimization trick for {1, 2,
On Wed, Jan 19, 2022 at 02:20:06PM +0100, Marco Sulla wrote:
> I can understand, but if you do it for set, why not for list,
> bytearray... And so it becomes a sort of protocol for freezing
> objects.
YAGNI.
If you want a frozen list, you can already write that as a tuple. There
is no need to do
Maybe the "special optimizable method" will solve some of the problems, and
appraise the "no new syntax" folks. But IMHO, it (1) it is more verbose
than the prefix/suffix new syntax alternatives, to the point of getting
in the way of reading
mysets = [{1 ,2 ,3 }.freeze(), {4,5,6}.freeze()]
X
myset
On Wed, Jan 19, 2022 at 07:12:04AM -0500, Ricky Teachey wrote:
> Why does it need to be called at all?
>
> {1, 2, 3}.frozen
For the same reason that most methods are methods, not properties.
The aim of a good API is not to minimize the amount of typing, it is to
communicate the *meaning* of the
Steven D'Aprano writes:
> > Here's a better challenge: Type five unique open parenthesis signs,
> > without looking up their key sequences or codepoints.
>
> Yes :-)
Asa meshi mae (and if you know what that means -- the White Queen does
-- you also know why this is trivial):
([{(〔[{〈《【
To
On Wed, Jan 19, 2022 at 01:56:54PM +0100, Marco Sulla wrote:
> PEP 351 for the frozen protocol was rejected. I didn't read why, but
> it's probably hard to resurrect.
This is not a proposal for a generic frozen protocol. It is a simple
proposal for a set method that returns a frozenset, with the
On Sun, Nov 14, 2021 at 2:50 PM Chris Angelico wrote:
>
> spam(*(1,) * use_eggs)
> spam(**{"eggs": 1} if use_eggs else {})
>
> Still clunky, but legal, and guaranteed to work in all Python
> versions. It's not something I've needed often enough to want
> dedicated syntax for, though.
>
> ChrisA
>
Why does it need to be called at all?
{1, 2, 3}.frozen
Or even:
{1, 2, 3}.f
On Wed, Jan 19, 2022, 6:28 AM Steven D'Aprano wrote:
> On Wed, Jan 19, 2022 at 07:20:12AM +, Ben Rudiak-Gould wrote:
> > My preferred syntax for a frozenset literal would be something like
> >
> > {1, 2, 3}.f
On Wed, Jan 19, 2022 at 07:20:12AM +, Ben Rudiak-Gould wrote:
> My preferred syntax for a frozenset literal would be something like
>
> {1, 2, 3}.freeze()
>
> This requires no new syntax, and can be safely optimized at compile time
> (as far as I can tell).
I like that, it is similar to
16 matches
Mail list logo