Python Tip #7 (of 365):
Avoid using "or" short-circuiting for fallback reassignments.
Instead of this:
name = name or "world"
I recommend this:
if not name:
name = "world"
It's more verbose, but I find it more readable at a glance.
The first approach relies on the fact that "and" and "or" return the value of the last expression they evaluate. So name is reassigned to itself whenever it's truthy and assigned to "world" otherwise.
🧵 (1/4)
Trình tạo nhạc AI chạy cục bộ! Dùng Python, tạo ra 4 phút nhạc chỉ trong ~20 giây. Hỗ trợ giọng hát & nhạc cụ. Lý tưởng cho game và content creator.
#AI #Nhạc #Tech #Python #LocalAI #GameDev #Nội dung số
S1 EP15 Lab 8 - Machine Learning in Python - IPython Results - Appear Automatically #learnpython #codingforbeginners #jupyternotebook #learntocode #algorithims #dataengineering #vscode #machinelearningtutorial #machinelearning #PythonForDataScience #python #pythoncoding #machinelearningbasics #softwaredeveloper #datascience #jupyterlabs #mlforbeginners #datascienceforbeginners #machinelearningmodels #statistics
Все об устройстве Q65 с примерами на Python (часть 2)
Q65 — цифровой протокол, разработанный Джо Тейлором (K1JT) и его командой в 2021 году для проведения минимальных связей в условиях сложных трасс прохождения радиосигнала. В предыдущей части части были рассмотрены общая структура протокола и алгоритмы формирования сигнала. В этой части статьи рассматриваются принципы цифровой обработки сигналов и синхронизации в протоколе Q65. Статья может быть интересна радиолюбителям и людям, интересующимся темой цифровой обработки сигналов.
https://habr.com/ru/articles/983286/
#ham #hamradio #python #numpy #DSP #q65 #python3
I'm gonna get burned for this...
But I'm calling a python script via popen in C(++), because I can't be arsed to
- rewrite my disassembler in C(++)
- learning about Python.h
https://git.uvok.de/fpga-exper/tree/nandgame/Vcomputer__main.cpp?h=main#n69
Motia framework giúp phát triển backend trở nên đơn giản & "nhàm chán" bằng cách hợp nhất API routes, công việc nền/cron, workflows, state chia sẻ, và streams trong một nền tảng. Hỗ trợ TypeScript/Python đồng thời, sử dụng "step" làm đơn vị công việc cơ bản. Tiện ích với log có cấu trúc, duy trì trạng thái giữa các bước và streaming thời gian thực.
Lưu ý: Chưa kiểm chứng ở quy mô lớn, giấy phép Elastic 2.0 (không phải mã nguồn mở).
#Motia #Backend #WebDevelopment #TypeScript #Python #Develope
I hacked together a Python + GTK project to inhibit/uninhibit sleep via a simple GUI.
This was put together in 3 hours and I am very proud of this janky code.
My blog goes into the background for this as well as its implementation.
Give it a read:
https://blog.suryatejak.in/sleep-stopper-a-simple-gtk4-app-to-stop-linux-from-sleeping
#linux #gtk4 #python #linuxsleep #opensource
Käytin aiemmin unix_at-moduulia (python-wrapper unixin atd:lle) viivästettyihin laitetilan asetuksiin (esim valon sammuminen x min päästä). Luova mutta raskas ratkaisu. Tein vihdoin oman moduulin, joka hoitaa saman kevyemmin. Käyttää /dev/shm-hakemistoa IPC:hen. #python #ohjelmointi #kotiautomaatio
Create a #Python dict with keys a/b/c and values 0:
d = dict.fromkeys('abc', 0)
But don't do this, since the value will be shared and mutable:
d = dict.fromkeys('abc', [])
d['a'].append('x')
d['b'].append('y')
print(d)
{'a': ['x', 'y'], 'b': ['x', 'y'], 'c': ['x', 'y']} 🤯
🎉 New year, new #GIS skills! ⌨️ Learn scripting in #QGIS with my free course at @gisopencourseware.bsky.social@bsky.brid.gy: no complex setup, just start from QGIS. Topics: #GDAL #CLI #Python basics #PyQGIS with the Notebook plugin ✨ 👉 courses.gisopencourseware.org/course/view....

🎉 New year, new #GIS skills!
⌨️ Learn scripting in #QGIS with my free course at @gisocw : no complex setup, just start from QGIS.
Topics:
#GDAL #CLI
#Python basics
#PyQGIS with the Notebook plugin ✨
👉 https://courses.gisopencourseware.org/course/view.php?id=80

PEP 822: Dedented Multiline String (d-string)