python

Back Open Paginator
03.01.2026 17:00
PythonPeak (@PythonPeak@mastodon.social)

Exception Swallowing Sin

This Python Pattern Will DESTROY Your Debugging Sessions! 💀

Bare except: pass is the worst thing you can do in Python. Here's why!

🚫 What NOT to do:
• Catch all exceptions with bare except:
• Silently swallow errors with pass

✅ The right way:
• Catch specific exceptions
• Log errors properly

Silent failures are debugging nightmares!

#...

youtube.com/watch?v=NmfBTsngN8c




Show Original Post


03.01.2026 16:21
BrianAllbee (@BrianAllbee@mastodon.social)

A key idea in my book is that while change in software engineering is constant, engaging with it should be purposeful --- and may even be optional. That feels especially true with LLMs and code generation, where discussion tends to polarize quickly into advocacy or rejection.




Show Original Post


03.01.2026 15:30
riverpunk (@riverpunk@defcon.social)

Something about python makes it really easy for me to create incredibly annoying code.

This was inside of 3 nested for loops (iterating n, k, and i). Situated on the single most breakable part of the entire algorithm.

Yeahhh I'm gonna be refactoring this. Maybe I should also get some rest lol.

#python #programming #badCode #CS





Show Original Post


03.01.2026 14:33
isazajuancarlos (@isazajuancarlos@mastodon.social)

Transforma tu negocio con soluciones tecnológicas innovadoras. Soy abogado y programador experto en Python y NiceGUI, listo para impulsar tu proyecto con . ¡Hablemos!

🔗 xiliux.com





Show Original Post


03.01.2026 13:59
scy (@scy@chaos.social)

I'm pretty sure lots of #Python coders already know this, but if you're annoyed with dict literals needing so many quotes, consider using dict() with keyword arguments.

{"foo": 123, "bar": 456, "baz": 789}

becomes

dict(foo=123, bar=456, baz=789)

This only works with string keys, of course, and only of every key is a valid keyword argument. For example, if one of your keys is "class", or "Bud Spencer", or even "", you can't use this method.




Show Original Post


03.01.2026 13:58
AndriiKuznietsov75 (@AndriiKuznietsov75@social.kyiv.dcomm.net.ua)

📝🐍 Шпаргалка по #Python Tools: основні бібліотеки та інструменти Python для аналізу даних, машинного навчання, візуалізації, роботи з базами даних, інженерії даних, обчислень і нейронних мереж





Show Original Post


03.01.2026 13:12
01micko (@01micko@aus.social)

@dobbie003 @jloc0 @thesaigoneer

youtube.com/watch?v=UccHgrPkg50

My workflow with #Slackware #music #mpd #quickshell (for the cental mixer gui) and #python #pyqt6 for the tray icon and volume slider.




Show Original Post


03.01.2026 12:52
christophehenry (@christophehenry@mastodon.social)

Odoo does that kind of nasty things too and so does Ansible, IIRC. So dynamic import by tampering `sys.path` seems pretty common. I'm surprised there's no easy way to tell PyCharm "you will find code for this module in this directory, please resolve correctly".




Show Original Post


03.01.2026 12:37
christophehenry (@christophehenry@mastodon.social)

I think I remember a mecanism that allowed to install a module in `site-package` with pip without a pyproject.toml or setup.cfg by symlinking it. I found something with `.pth` but I couldn't get something to work. Of course just renaming `modules` to `woob_modules` and mark it as code it out of question. Any idea?




Show Original Post


03.01.2026 12:37
christophehenry (@christophehenry@mastodon.social)

The solution I found so far is to symlink `modules` to `woob_modules`. This mostly works, Pycharm shows no import error but then, when I want to navigate to source with Ctrl+B PyCharm navigates to a directory under the symlink instead of the actual file. PyCharm seems to consider `modules` and `woob_modules` are two different directory which causes problems with breakpoints and code desync between the 2 versions of the file. I need to constantly refresh from filesystem.




Show Original Post


03.01.2026 12:37
christophehenry (@christophehenry@mastodon.social)

Hey community, I'm struggling with a bit. I'm in a situation of contributing to a project that dynamically detects and adds Python modules from non-standard location (probably by tampering `sys.path`). Namely woob. During development, those packages are located in a directory (not a module, there's no `__init__.py`) named `modules`. But they are imported as `woob_modules` in code.




Show Original Post


03.01.2026 12:28
kaaswe (@kaaswe@swecyb.com)

So when companies try to monetize everything...

I have an electric car and a charger at home, also a distributor to prevent over current. Due to high prices during daytime I have the possibility in the distributor to set a schedule when my charge box should be available.

So far so good, but ...
I can only set different time schedules and not days, so weekends I'm stuck with my week schedule, even though the price is lower and I could charge my car 24h.

I sen't a mail to the support and asked for that config option, and yes you guessed it right.

-Sure, that is possible with our PRO subscription.

Thank you and f**k off.

I'm no developer but with Burp Suite, Python and some cups of coffee I now have written an API parser in python that will accept command line args.

myprog.py --disable / enable

now I can schedule with crontab my own without your PRO subscription.

HA!

#python #API #electriccar #charging




Show Original Post


1 ...717 718 719 720 721 722 723 724 725 726 727 ...1581
UP