• 7 Posts
  • 269 Comments
Joined 2 years ago
cake
Cake day: March 1st, 2024

help-circle

  • 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?





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


  • Better have a damn good reason to import everything into the package level namespace.

    The reasoning sqlalchemy has is to prepare beforehand to be able to run in multiple threads without needing to import anything. Importing is slow and should be done up front.

    So there is a slight delay when importing sqlalchemy.

    Keep in mind, the sqlalchemy author and maintainers are waaaaaaay smarter than you and I. py315 may level the play field ever so slightly.

    py315 is supposed to introduce soft import. So wait for that and then everyone jump ship like every previous version has rabies.



  • i’m in love with typing_extensions. Know why? I’m not on the latest greatest Python version. But want to use the usable latest features. As package author/maintainer, upgrading to the latest and greatest is not a viable option.

    in py39, dataclasses lacked critical features that came out later. Especially for a fundamental structure like a dataclass, new features requiring a Python upgrade is a show stopper. On the level of a flaw. Either backport or in a separate package or i don’t want to touch it. That’s why use attrs and not dataclasses.dataclass

    And so should we all.

    There is always going to be some great features we want to use and then not being able to is not great UX. Every package that matters really must be external, except for Python features like free threading, sub-interpretors, etc.

    There are always many coding languages, unfortunately jumping from one to the next is a pipe dream. So really doesn’t matter what Haskell can do. Or how Rust devs all have 10 gfs.



  • kudos for pointing that out. Another reason to dump Optional.

    Union[None] is not ambiguous

    As coders we have the potential to have lots of coder friends. Union[None] is just the sad reality.

    Optional[None] is sorta keeping our hopes up like there is some distant future where the situation improves. Where all these coder fiends come over every night of the week to bitch about static typing issues and running out of beer and pizza. And when that one guy has to bring up politics; everyone will react like he just let out a massive fart in the room, poisoning the air. Suddenly can feel the IQ in the room dramatically drop. Everyone reacts predicatively, spontaneously, and synchronously in disgust; thinking, dude what a tard! And someone will say, lets do this again tomorrow.

    Fck yeah! This is the place where i want to live.



  • As can surmise from my handle, i’m even stricter!

    Use Union, not | or Optional where ever possible.

    Optional does not allow for future expansion of the typing. Optional[int] and then want to add float, so have to rewrite it Union[int, float, None] So write it with Union to begin with.

    Went thru my | stage like everyone else, but grew out of it.

    TypeAlias insists on Union, not |

    So Union everywhere ftw

    Why? If there is a possibility of making a mistake, Murphy’s law dictates that it’ll occur every damn time. Enough already! KISS principle is in effect.


  • project cost = sigma(1...n)(risk likelihood of occurring * risk cost), but we aren’t discussing every possible risk. Only the one risk.

    The risk of having to:

    • for the app to work, requires compiled components
    • having to be familiar with setup.py. This is referred to as the sewer, which is what is targeted by hackers e.g. xv
    • maintainers who come later being familiar and can maintain packages that incorporate other languages e.g. C or rust
    • possibly neglecting to perform the compile (but lets ignore this)
    • compiler runs a binary written and maintained by the spy agency Google

    or

    Just not doing that

    The only justification for going with protoc, over other methods, could only come down to data serialization speed. But in that case, wouldn’t a rust solution be: not only as fast, but also much safer.



  • A better approach

    That unfortunately isn’t a better approach. The compilation step requires protobuf to be installed, by the distro package manager. To my knowledge it’s not available from pypi.

    An uncompiled protobuf file is essentially worthless unless it’s compiled. But if it’s compiled then it’s a binary blob.

    Not anti-protobuf. Just make the protobuf compiler available without getting a distro package manager involved.

    Otherwise slower alternatives might be more viable.

    strictyaml bundles strictyaml.ruamel, which used to be an external unmaintained C package.

    This reduces strictyaml dependencies to:

    pyproject.toml

    dependencies = [
        "python-dateutil>=2.6.0"
    ]
    

    Just that one. So can be confident strictyaml will work.

    Can the same be said for protobuf and Google (over invested in AI and is probably dying underneath a huge debt burden while spending tons of money on AI wash propaganda while not funding Python projects enough. Maintainer leave or burn out while everyone is too busy head fcking us with the AI washing to notice.)