

Why put all the Python code in the script?


Why put all the Python code in the script?


No one cares. Have fun, learn to draw.


France, here is what I found:
Code civil and code pénal. I’m not a lawyer but code civil should be for small stuff where you have to agree on something or pay a fine, and code pénal for big stuff like killings and shit and you can go to prison.
There is also a “code de la route” which is another bonus on how to behave in the road.
But it’s France and I’m sure there are a billion other papers like those, but those 3 (civil, pénal, and route) are the most famous.
Edit: there was supposedly a project to put the laws in source form, and maybe a DSL for the tax law, here is is an example: https://www.data.gouv.fr/reuses/les-lois-francaises-versionnees-avec-github/, and taxes https://mlanguage.github.io/mlang/mlang/index.html
Time to watch the “Hot Fuzz” movie again.
Some people say that HFT is about small optimizations and avoiding copies. You can do that if you have a deep knowledge of C++.
Or try something like QuantLib, it is a tradings’ library that I used aeons ago in some stock market company. https://www.quantlib.org/
They have a book too https://www.quantlibguide.com/A taste of QuantLib.html and Python bindings.
ActualBudget. It solves my problem of not budgeting.
I had that one (french version): https://3.bp.blogspot.com/_jB_0gDq-z5U/S_wcG9n9LkI/AAAAAAAAEp8/VYszHxROVVM/s1600/Mastermind.jpg
And also this weird version with plastic squares containing letters and numbers instead of the colors, but I was too young to understand the rules: https://ludessimo.fr/wp-content/uploads/2020/10/a_07_3194-mastermind-duo2.jpg


Discordianism is another cult that I love: https://en.wikipedia.org/wiki/Principia_Discordia


Yes. You can say "Session\\Port (lots of space here) = 12345"(formatting sucks, sorry) to align your values properly. Also are you sure that there is a double backslash here because you are using a raw string here?


Yes (and I’m sorry for not having more time to study this but):
logDateTime
That thing should be automatically printed by the logger somehow (most of the time, timestamps and log levels are inside the logger itself). If it’s not, check the configuration of the logger. Anyway. logDateTime has got to go. IMHO a logger is a magical object that you don’t control. It’s the user of the application who should set the rules one way or the other, like:
logger.info("qbittorrent listen port set to...
IIRC the logger can be set from the command-line, which you don’t control anyway. It’s the same thing in C++ and with any library on the planet (trust me), someone sets up the logging system for you outside of the application (in the main function or on the command-line or with environment variables or in a library/DLL) and all you can do is call “log.debug()” or “log.warning()” and hope for the best. Some libraries have huge systems to handle logs (rotating logs, serial ports, files, network…) and you shouldn’t give yourself headaches while using those things. Think of a logger as a pre-configured system that does way more that you should and want to know.
logger = logging.getLogger(…
Put that outside of main, after the imports. You can prepend it with an underscore to show that it’s a “private or protected” object belonging to your module. If it’s in main, you can’t use it in the other functions. You should do something like:
from qbittorrent import Client
_logger = logging.getLogger(...)
This way your logger is independent on whether you’re using it from the command line (with main) or not (with an import).
QB_PASSWORD
Same thing with all the QB_ variables IF they don’t change, you can put them globally for such a module, like _QB_PASSWORD = ... and use it everywhere if your module were to change in the future. But only if the variables are constants across the usage of the script.
a40124291102d
Last but not least, use argparse if you can, it’s a simple module to handle command-line arguments. I guess that the container ID can change, you can either detect it with the subprocess module, or write def get_current_forwarded_port(container_id = "a40124291102d"): or use argparse. Feel free to ask if argparse if too weird, but it’s the best module out there and it’s built-in.
TL;DR:
Anyway, great job, writing weird stuff for my own needs is how I started coding. Have fun.


Make the logger a global variable. This may be the only case where its acceptable to be global. And remove the log function. You can call the logger directly.
Also wrap the main code (after BEGIN SCRIPT) in a main function.
Last but not least log everything to the standard output (logging should do that by default), or configure the path in main(), it’s cleaner. If you log to stdout, the shell can redirect the logs to any path like python script.py > mylogs.txt


Definitely. UPS and DHL do this. They dont know what happens when a package leaves the countryf origin.
What is the value of x in the Good example before the loop?


I deny. Making a joke is not a slur. Calling someone an asshole is not a slur either.
And what about wanker?


Any word ending in “er” is an insult now?
Enjoy: https://www.merriam-webster.com/wordfinder/classic/ends/all/-1/er/1
You waited 2 months for this? That’s dedication.


I still fail to understand what is the social part of Lemmy, 4chan, or reddit. Those are forums with pseudonyms.


That’s annoying. Don’t do that.
And it’s worse because they hide the Python code, which means that they can’t use tools like uv or ruff to check that everything works properly. I don’t understand why people do this.