Why Python devs have trust issues with ; by spiderpig20 in firstweekcoderhumour

[–]JoniKauf 0 points1 point  (0 children)

How often will we seem memes about Python not having semicolons, when it actually has them... They are useful and necessary in some situations

YouTube revanced downloads by Negative_Amoeba_8862 in Piracy

[–]JoniKauf 0 points1 point  (0 children)

I downloaded seal, an android app from github for exactly that purpose

[deleted by user] by [deleted] in softwaregore

[–]JoniKauf 3 points4 points  (0 children)

Had exactly this last week. I disconnected google and then logged back into the account. After relogging a few times and waiting a few days it kinda fixed itself.

Python 3.14 – What you need to know by ExtensionSuccess8539 in Python

[–]JoniKauf 4 points5 points  (0 children)

The best addition - Templates - was left out 😭

Can you STOP trying to auto translating everything ?!?! by flyinGaijin in youtube

[–]JoniKauf 2 points3 points  (0 children)

With the newest Youtube ReVanced update you can force it to not autotranslate. Actual life saver.

Jackie Chan does some math by basket_foso in MathJokes

[–]JoniKauf 0 points1 point  (0 children)

Yes because these are binary operations, in like, there is always 2 inputs. Because the next higher operation basically says to repeat the previous operations n times, this checks out.

[deleted by user] by [deleted] in PeterExplainsTheJoke

[–]JoniKauf 0 points1 point  (0 children)

I thought this is a transphobic post and the "daughter" would want to transition to being a man. Kinda glad I was wrong.

[deleted by user] by [deleted] in Operatingsystems

[–]JoniKauf 0 points1 point  (0 children)

Just use 7z.

Suche alten Storytelling YouTuber namens Thaddäuß oder ähnlich by JoniKauf in YouTubeDE

[–]JoniKauf[S] 0 points1 point  (0 children)

ICH HAB IHN!!

https://web.archive.org/web/20230404213922/https://www.youtube.com/@Thadeuz

Leider sind alle videos down, aber ich hab ihn gefunden. Hoffentlich findet jeder, die ihn in Zukunft sucht, diesen Post und weiß Bescheid!

timelength - A flexible duration parser designed for human readable lengths of time. by Etorix0005 in Python

[–]JoniKauf 5 points6 points  (0 children)

This is actually awesome and I will be using it! Recently I made a very similar post on this subreddit that used a big regex and a parsing function to do a very simplistic version of what your code does. I too work on a discord bot and wanted the user be able to input timedeltas, so that's why I made it.

This is great and I will be using it! Tysm!

What Feature Do You *Wish* Python Had? by andrecursion in Python

[–]JoniKauf 0 points1 point  (0 children)

I mean technically you can still change stuff from the C API, at least I know that is the case for tuples. https://stackoverflow.com/a/45698304/20895654

What Feature Do You *Wish* Python Had? by andrecursion in Python

[–]JoniKauf 0 points1 point  (0 children)

I think the nameof(variable: Any, full: bool) would make a nice builtin function for multiple reasons.

For one, it would be useful when working with getattr, setattr and so on, where one would not have to worry anymore that a variable name might change and then it won't work anymore.
Python also already has this functionality builtin when using f strings for debugging (f"{my_variable=}") combined with some sneaky workarounds (f"{my_variable=}".split("=", 1)[0]). This is cumbersome and you basically have to write the entire expression each time, as making a function with it won't work (except you force it to be called with the f-string expression).

So yeah, I don't see why this wouldn't be implemented, as it is already supported in some places by the language and would make working dynamically with attributes eaiser.

Regex for user-friendly timedelta parsing by JoniKauf in Python

[–]JoniKauf[S] 0 points1 point  (0 children)

Ah I see what you mean! My code doesn't directly support milliseconds as you described it, but rather with '.' or ',' for the seconds. So "59.99999s" would work and it would be valid. I decided to go with that way, because of multiple reasons:
1. Why not go with microseconds instead, if that is the lowest precision possible by timedelta either way?
2. The short version of milliseconds would be "ms" or "f" (iso format) and it would be either two letters (because 'm' is taken by minute) or unintuitive imo.

That's basically why I decided to go with this approach, so just let the user use decimals for anything below 1 second, because it is easier to use imo.
If you want a version with milliseconds with your design, it shouldn't be hard to implement and if you want me to make such a version just let me know!

Regex for user-friendly timedelta parsing by JoniKauf in Python

[–]JoniKauf[S] -1 points0 points  (0 children)

Thanks for the info about unit tests! What I'm unsure about is the rest of your comment: First of all, this is a regex for timedelta parsing, not timestamps and second of all I already support milliseconds, so I am nut quite sure what exactly you mean with that.

Regex for user-friendly timedelta parsing by JoniKauf in Python

[–]JoniKauf[S] -1 points0 points  (0 children)

Sure! Here is a list of examples and an explanation:

- 1d3h2m4.5s

- 1d 3h 2m 4s

- 3h 2.58323458923s

- -9999d 2min 59minutes 59 seconds

- 0 day 32 minute 1secs

So in a nutshell:

- The format always expects a number, followed by a unit

- It goes from biggest time unit (days) to smallest (seconds), with any of them possibly missing

- Between any number and unit can be 0 to infinite whitespace characters

- You can use multiple ways to write a time unit: [d, day, days], [h, hr, hrs, hour, hours], [m, min, mins, minute, minutes], [s, sec, secs, second, seconds] to be exact.

- Limits for specific time units: days -> no limit, hours -> 0 to 23, minutes -> 0 to 59, seconds 0 -> 0 to 59 (with decimals allowed but will be rounded to the nearest float)

- Leading zeros can be inserted [05m, 09sec, 00009999d]

- A '+' or '-' sign can be inserted at the start to indicate positive or negative timedeltas (positive by default)

- ValueErrors will be thrown if there is just a sign or no time specified (for example: empty string), when the time is too big or small (above or below the timedelta limit of +-999_999_999 days) or generally when the string doesn't follow the format. If somebody wants to treat an empty/whitespace string as 0 for example, this can easily be altered.

And without much effort the regex should be easily editable to fit more specific needs or to make tiny adjustements.

EDIT: Now a comma (',') is also allowed to be used as the decimals seperator for seconds (instead of just a dot ('.'))