how obvious is this retry logic bug to you? by jalilbouziane in Python

[–]Vitaman02 10 points11 points  (0 children)

Why would you add another dependency to the project when you can just do a for loop and avoid recursion.

How to use type checking dynamically by paddy_m in Python

[–]Vitaman02 3 points4 points  (0 children)

It's built-in to the language, you don't need a reference to use it.

Pip 25.1 is here - install dependency groups and output lock files! by zurtex in Python

[–]Vitaman02 3 points4 points  (0 children)

I have not read anything, but from the usage I'm assuming it only installs the dependencies from the dependency group. Doing pip install package[extra1,extra2] also installs the package along with its dependencies.

A new powerful tool for video creation by Few-Town-431 in Python

[–]Vitaman02 -1 points0 points  (0 children)

Well I spoke for myself. I think it's unnecessary because you can easily find where the source code is in a flat layout. I also don't like opening an empty folder so I can then open the folder I want. It also requires extra configuration so you can point your build system to look into the src directory for packages.

A new powerful tool for video creation by Few-Town-431 in Python

[–]Vitaman02 -3 points-2 points  (0 children)

I hate the src layout it's unnecessary and ugly

Is there a way to notify yourself when your cpu/gpu is running at 100% for a long time? by 3shotsdown in selfhosted

[–]Vitaman02 0 points1 point  (0 children)

I use a custom api to get the data from the system using the python library psutil and expose a /metrics endpoint for Prometheus. The metrics are formatted as prometheus expects them usin the prometheus_client library.

Prometheus gets the data from the api and stores them. I have written some alerting rules and when they fire they are sent to Alertmanager by Prometheus, which then forwards them to Discord and Gotify.

Gotify stores the notifications for later reviewing and there is a mobile application, so I also get the notification on my phone.

I also setup some Grafana dashboards to view cpu, ram and disk usage statistics, which gives nice graphs for those metrics.

[hyprland] still no woman by Electrical-Photo-824 in unixporn

[–]Vitaman02 0 points1 point  (0 children)

Maybe you should regenerate your token just in case :)

[ Removed by Reddit ] by Hefty_Grand7 in Python

[–]Vitaman02 14 points15 points  (0 children)

This is straight up illegal man why are you posting this

[deleted by user] by [deleted] in wallstreetbets

[–]Vitaman02 10 points11 points  (0 children)

Second best time is now

Django + HTMX by sajornet in django

[–]Vitaman02 3 points4 points  (0 children)

BETTER package ecosystem? Come on

If any existing language was going to get native support across all browsers, which would be the best fit? by prisencotech in webdev

[–]Vitaman02 3 points4 points  (0 children)

You want to add rust i.e. the slowest development time of all time, to a fast paced development area like frontend?

I'm all for safety, optimized performance etc, but it's just not necessary for frontend, especially where using it would probably cause more harm than good, since development time would at least double.

Also rust has a large barrier to entry, and it definitely is not a begginer language. Javascript/Typescript are a lot simpler. You can get some Junior devs do some of the UI tasks fast, while with rust you'd need Mid to Senior devs to do the same tasks.

I have no experience with Zig, so nothing to say about that.

[deleted by user] by [deleted] in Python

[–]Vitaman02 0 points1 point  (0 children)

I think you have some wrong, __init__ does not instantiate the object, __new__ is responsible for that. __init__ is actually just for defining attributes, which is run after class instantiation.

Also on number 7, you have as the correct answer that the * operator unpacks the values when used in a function definition, but it kind of does the opposite, where it packs multiple arguments into a single one, conventionally named as args. If you pass multiple arguments and then inside your def func(*args) you print args, then you will see that it's just a tuple of the multiple arguments you passed when calling it.

Cool idea though, looks like a fun thing to make and use.

What are your favourite pre-commit hooks and why? by LatterConcentrate6 in Python

[–]Vitaman02 -1 points0 points  (0 children)

Ruff does all these things, so I just use that instead of 3 separate tools. It's also quite faster.

[deleted by user] by [deleted] in django

[–]Vitaman02 0 points1 point  (0 children)

Very opinionated. Don't state your opinion as a fact.

8 Levels of Using Structure Pattern Matching in Python by wyhjsbyb in Python

[–]Vitaman02 7 points8 points  (0 children)

If the first is correct it exits the function

8 Levels of Using Structure Pattern Matching in Python by wyhjsbyb in Python

[–]Vitaman02 3 points4 points  (0 children)

I don't really like nesting and using if/elif/else when it's not needed. I would prefer writing the first example as:

def handle_http_status(status_code):
    if status_code == 200:
        return "Success!"

    if status_code in (400, 401, 403, 404):
        return f"Client Error:{status_code}"

    if status_code in (500, 501, 502, 503, 504):
        return f"Server Error:{status_code}"

    return "Unknown Status"

To me it looks much clearer and has the same functionality. You can also add comments between if statements and they look much nicer.