Copying a list with a million elements every time you make a small change is not fun. Sure, you can optimize a bit behind the scenes, but that still gives a lot of overhead.
comments
Eh, I get it. The equal operator creates a reference but the plus operator isn't destructive so it creates a new list and overwrites the variable b with a new list, when assigned.
Of course, this would all be avoided if creating copies was the norm; which is why I stick with functional languages.
For immutable types it is the same though.
The most twisted thing I learned is that all ints below a fixed limit share the same id() result, so
>>> x = 1
>>> id(x)
135993914337648
>>> y = 1
>>> id(y)
135993914337648
But then suddenly:
>>> x = 1000000
>>> id(x)
135993893250992
>>> y = 1000000
>>> id(y)
135993893251056
Using id() as a key in dict() may get you into trouble.
Oh absolutely, I understand that the language allows implementations to violate my proposed equivalence β Iβm saying thatβs a bad implementation (some might say a bad language, for allowing bad implementations, but I donβt necessarily agree)
I expect A if "b" is a clone, or E if it's a reference. But I also wouldnt combine array operations like this.
The answer being C feels like a bug.
You don't have to compile. You don't need semicolons.
Python was my first programming language, and those two things alone honestly are really nice. Doesn't mean there aren't a million other issues and difficulties, though, lol.
It's definitely not the same. Similarly for a class you can define the __add__ dunder method for a + b and separately the __iadd__ dunder method for a += b. The first creates a new object, the latter changes/mutates the existing object a. For immutable types it is the same though.
Tell me again how python is easy to learn for beginner programmers.
Other languages that have similar behavior include Java and JavaScript, and yes you have to be careful with list / array operations in those languages as well, lest you operate on the wrong list inadvertently. Happened to me. It will happen to you.
Hot take: if a += b is not the same as a = a + b, you done fucked up
What the fuck
That's what you get because you're afraid of pointers π! /j
If I need something like slots I'll keep them in mind. Thanks for calling my attention to them.
LOL have never used the match statement. Has been one of those features just outta reach. So close can taste it. But alas ....
Now py310 is here. Still not enthusiastic about it. But over time maybe will come around.
__slots__ = (...) or frozen. Same thing. Make the data class read-only reducing memory usage by 30-40%. Like the memory usage difference between tuple and list.
From experience, in stubs, __slots__ need to include "__weakref__". If frozen, then don't include "__weakref__".
How about this. Lets meet each other half way.
I'll stop thinking of the match statement as thorium reactor toxic waste.
And maybe you can take a read through of the frozen option for dataclasses.
Sound fair?
Python advertises itself as being mature, which means changes if any are supposed to be incremental and backwards compatible. It's not so successful at that but I still don't particularly try to keep up with the bleeding edge. I don't know what slots in dataclasses even means. I do like the match statement.
That's fine. But you coulda had access to latest greatest updates. Whether you need them or not.
I haven't needed slot support in dataclasses so far. It must not be that critical. Some of my machines still have python 3.9 and dataclasses work, at least to the extent I've needed them to.
dataclasses required py310+ for critical features like slot support. Only now that py39 is history, is dataclasses even a thing. But then a must have feature will require an even more recent python version. So stuck waiting in a never ending loop.
Fck that!
python -m pip install attrs
Problem solved.
Maybe it's more about access to Rust coders than the Astral existing toolchain.
Have zero exposure to Astral. If they were bought out by OpenAI tomorrow, would not notice the difference.
If i were a Rust coder, would have interest. Since i'm not, would be at the mercy of the maintainers.
Saw uv and ruff as a liability. Now? What is uv and ruff. Never heard of it.
Look forward to future discussions on requirement files again. Reintroduce everyone to the -r and -c options. How to put requirements into a hierarchy. How to deal with multiple venv. And how to manage requirement files across multiple packages.
Not here....
alll I see is abuse? I see only one comment under yours (and its pretty reasonalbe from brummbaer) but maybe all the rest are folks I have blocked.
Off the top of my head, no. I'm just pointing out that there's time to respond before things get shitty. This isn't Redis rug-pulling their license. The community can be considered. Thoughtful.
Is there any example of such move that does not ends with enshittyfication?
The world does not consist entirely of the US.
While I agree that openai can buy enough "law" in the US to do what it wants, the license is important in other jurisdictions and can be enforced.
Your truust in the Law is admirable. OpenAI does not care at all about laws. They do what they want and have an army of lawyers to fight anyone who says differently. Just look at copyright laws.
This is why I am saying do it now. Better safe than sorry.
But, since all l am getting is abuse.... I'm out! Y'all have the say you deserve.