tutoteket.no is one of the many independent Mastodon servers you can use to participate in the fediverse.
Tutoteket er ein liten server med liten plass, men vi har lesestoff og god drikke, så vi klarar oss.

Administered by:

Server stats:

7
active users

#python

23 posts21 participants0 posts today
Veronica Olsen 🏳️‍🌈🇳🇴🌻<p>Several times the other day I found myself scanning the terminal log to find those elusive ERROR lines, so I finally added colourised log output.</p><p>This uses Python standard logging.</p><p>For anything other than the log level, you can just add the colour codes to the format string.</p><p>For the log levels, though, you can set new labels with the logging.addLevelName() function, and provide those with colour codes too. It works perfectly fine, and is very easy. 😊 </p><p><a href="https://mastodon.online/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> <a href="https://mastodon.online/tags/Code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Code</span></a> <a href="https://mastodon.online/tags/Logging" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Logging</span></a></p>
Veronica Olsen 🏳️‍🌈🇳🇴🌻<p>With a huge diff of +3,972 / −3,667 lines, rewriting the project tree of <span class="h-card" translate="no"><a href="https://fosstodon.org/@novelwriter" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>novelwriter</span></a></span> to use a model/view set from the previous approach that synced changes between the data class and the view widget's internal model didn't result in less code.</p><p>But I think it resulted in an easier to maintain code, and hopefully more stable over time. Syncing the project state between two locations is just a little error-prone, and Qt's default implementation is also a bit buggy.</p><p><a href="https://mastodon.online/tags/Code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Code</span></a> <a href="https://mastodon.online/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> <a href="https://mastodon.online/tags/Qt" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Qt</span></a> <a href="https://mastodon.online/tags/Qt5" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Qt5</span></a> <a href="https://mastodon.online/tags/PyQt" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>PyQt</span></a></p>
Paolo Melchiorre<p>I just filled out the 2024 Django Developer Survey ✅</p><p>If you've ever developed in Django, even just recently, go ahead and fill out the survey, and let us know what you think 👍🏻</p><p>We're interested in hearing from you all 🤗</p><p><a href="https://www.djangoproject.com/weblog/2024/nov/21/2024-django-developers-survey/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">djangoproject.com/weblog/2024/</span><span class="invisible">nov/21/2024-django-developers-survey/</span></a></p><p>CC <span class="h-card" translate="no"><a href="https://fosstodon.org/@django" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>django</span></a></span> </p><p><a href="https://fosstodon.org/tags/Django" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Django</span></a> <a href="https://fosstodon.org/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a></p>
Seth Michael Larson<p>My work on supply-chain security has only been possible through the "Developers-in-Residence" program at the Python Software Foundation.</p><p>Security work is unlikely to be anyone's favorite thing to do with <a href="https://fosstodon.org/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a>, my job is to do that work! Consider me Python's security janitor 🧼🫧🧽</p><p>You can support my mission! 🚀 The PSF is hosting its end-of-year fundraiser where direct donations go to lovely programs like the Developers-in-Residence. Thank you for your consideration.</p><p><a href="https://www.python.org/psf/donations/2024-q4-drive/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">python.org/psf/donations/2024-</span><span class="invisible">q4-drive/</span></a></p>
Jonathan Matthews<p>What's a decent <a href="https://fosstodon.org/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> equivalent of <a href="https://fosstodon.org/tags/Go" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Go</span></a>'s go:generate workflow?</p><p>I have a bunch of scattered files nested throughout a python project's repo, and they need to be regenerated on demand by some arbitrary scripts. What's the idiomatic way to do as little setup work as possible and get the python env to do the script orchestration for me? Bonus points for being built in to the tooling, as it is with <a href="https://fosstodon.org/tags/Golang" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Golang</span></a> ... <a href="https://fosstodon.org/tags/dev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dev</span></a> <a href="https://fosstodon.org/tags/development" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>development</span></a> <a href="https://fosstodon.org/tags/softwaredevelopment" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>softwaredevelopment</span></a></p>
Walker Boh🛡<p>I'm doing <a href="https://infosec.exchange/tags/adventofcode" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>adventofcode</span></a> again this year. Did it last year and it was fun.</p><p>Last year I rotated a few languages, this year I plan on just using <a href="https://infosec.exchange/tags/typescript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>typescript</span></a> and maybe some <a href="https://infosec.exchange/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> </p><p>To warm my brain back up for competitive programming (which is different and in most ways diametrically opposed to "real" programming), I went back and did the 2015 year puzzles.</p><p>Day 7 (writing a circuit parser), Day 22 (RPG magic combat) and Day 24 (package balancing) were all interesting. Most came down to figuring out how to reduce the problem space. Was fun.</p><p>I'm part of a "local" (relative term - not geographically) leaderboard thats much more fun than the main leaderboard (I'm good, but I'm not solved in under 60 seconds good thats the level of the main leaderboard).</p><p>If anyone here is interested in participating with us, you can contact me or <span class="h-card" translate="no"><a href="https://indieweb.social/@andrewhoyer" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>andrewhoyer</span></a></span> and you can play along with us on a leaderboard thats real.</p><p>Boosts for visibility appreciated.</p>
Simeon Schmauß<p>*Very happy coding noises*</p><p><a href="https://fosstodon.org/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> <a href="https://fosstodon.org/tags/astrodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>astrodon</span></a></p>
Trey Hunner 🐍<p>For the past 7 years, I've posted a summary of <a href="https://mastodon.social/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a>-related Black Friday &amp; Cyber Monday sales.</p><p>I'm posting extra early this year. I'll be updating as more sales are announced over the next week. Let me know if you hear of any I should add!</p><p><a href="https://treyhunner.com/2024/11/python-black-friday-and-cyber-monday-sales-2024/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">treyhunner.com/2024/11/python-</span><span class="invisible">black-friday-and-cyber-monday-sales-2024/</span></a></p>
🅺🅸🅼 🆂🅲🅷🆄🅻🆉<p>WTF is this AI command?</p><p>The OpenBSD wtf command has been a beloved tool for quickly decoding acronyms. Inspired by its simplicity, I created a modern version powered by OpenAI’s GPT. This updated wtf answers any query—not just acronyms—delivering concise explanations with references, all from the command line. Whether you’re curious about quantum computing or Kube</p><p><a href="https://schulz.dk/2024/11/21/wtf-is-this-ai-command/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">schulz.dk/2024/11/21/wtf-is-th</span><span class="invisible">is-ai-command/</span></a></p><p><a href="https://social.data.coop/tags/Code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Code</span></a> <a href="https://social.data.coop/tags/Misc" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Misc</span></a> <a href="https://social.data.coop/tags/projects" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>projects</span></a> <a href="https://social.data.coop/tags/chatgpt" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>chatgpt</span></a> <a href="https://social.data.coop/tags/commandline" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>commandline</span></a> <a href="https://social.data.coop/tags/linux" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>linux</span></a> <a href="https://social.data.coop/tags/openai" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>openai</span></a> <a href="https://social.data.coop/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a></p>
Veronica Olsen 🏳️‍🌈🇳🇴🌻<p>After having worked a fair but with SQLAlchemy lately, I'm not sure if I like it. It feels very hacky, and "alchemy" is very appropriate because it explodes a lot.</p><p>I guess it's still a decent tool, because who likes to deal with databases anyway.</p><p>I prefer to work with data processing/analysis or GUI code over backend code, but all of it beats working with web frontend. 😁 </p><p><a href="https://mastodon.online/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> <a href="https://mastodon.online/tags/Code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Code</span></a></p>
Ned Batchelder<p>String formatting in <a href="https://hachyderm.io/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> lets you left-, right-, or center-justify a value. You can specify the fill character to use. The syntax is colon, fill-char, &lt;^&gt;, width:</p>
heise online<p>heise+ | Google KI: Gemini in Python-Programmen einsetzen</p><p>Googles KI Gemini lässt sich per API nutzen. So kann man etwa selbst geschriebene Python-Programme mit KI-Funktionen erweitern – mit sieben Codezeilen.</p><p><a href="https://www.heise.de/ratgeber/Google-KI-Gemini-in-Python-Programmen-einsetzen-9996053.html?wt_mc=sm.red.ho.mastodon.mastodon.md_beitraege.md_beitraege&amp;utm_source=mastodon" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">heise.de/ratgeber/Google-KI-Ge</span><span class="invisible">mini-in-Python-Programmen-einsetzen-9996053.html?wt_mc=sm.red.ho.mastodon.mastodon.md_beitraege.md_beitraege&amp;utm_source=mastodon</span></a></p><p><a href="https://social.heise.de/tags/K%C3%BCnstlicheIntelligenz" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>KünstlicheIntelligenz</span></a> <a href="https://social.heise.de/tags/Google" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Google</span></a> <a href="https://social.heise.de/tags/GoogleGemini" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>GoogleGemini</span></a> <a href="https://social.heise.de/tags/Programmierung" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Programmierung</span></a> <a href="https://social.heise.de/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> <a href="https://social.heise.de/tags/news" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>news</span></a></p>
MakerSpace<p>Ever wonder how parking meters and vending machines detect and count the coins you insert? You can mimic that functionality with some particleboard, a Raspberry Pi Pico, a few extra chips, and some Python code<br><a href="https://www.makerspace-online.com/coin-counter/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">makerspace-online.com/coin-cou</span><span class="invisible">nter/</span></a><br><a href="https://mastodon.social/tags/counter" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>counter</span></a> <a href="https://mastodon.social/tags/RaspberryPi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>RaspberryPi</span></a> <a href="https://mastodon.social/tags/Pico" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Pico</span></a> <a href="https://mastodon.social/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> <a href="https://mastodon.social/tags/chips" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>chips</span></a> <a href="https://mastodon.social/tags/project" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>project</span></a></p>
Dr John A Stevenson<p>We had a <a href="https://fosstodon.org/tags/Python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Python</span></a> clinic session yesterday on introductory text parsing and regular expressions. There's a Jupyter notebook here with what we covered:</p><p><a href="https://github.com/BritishGeologicalSurvey/python-clinic/blob/master/edinburgh_materials/text_parse/text_parse.ipynb" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/BritishGeologicalSu</span><span class="invisible">rvey/python-clinic/blob/master/edinburgh_materials/text_parse/text_parse.ipynb</span></a></p><p>I find regular expressions to be an "unknown unknown" for people new to coding. If you don't know they exist, how do you know how you can use them?</p><p>The aim of the session was to show that they exist.</p><p><a href="https://fosstodon.org/tags/rse" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>rse</span></a> <a href="https://fosstodon.org/tags/regex" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>regex</span></a> cc: <span class="h-card" translate="no"><a href="https://mastodon.social/@ximenes" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>ximenes</span></a></span></p>
aziz<p>A new trend is hot: 1) async and await keywords are a pain 2) what was The Thing before that: Threads 3) Java's loom project was right all along, 4) OS Threads are the new async-await.</p><p>TODO: Spot the mistakes</p><p><a href="https://functional.cafe/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> <a href="https://functional.cafe/tags/rust" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>rust</span></a> <a href="https://functional.cafe/tags/javascript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>javascript</span></a> <a href="https://functional.cafe/tags/scheme" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>scheme</span></a></p>
datatofu<p>Accounting gained a new tool from spreadsheets. Those who knew how to use the tool gained an edge over those who did not.</p><p>ATMs provided a new tool for firms to offer service beyond their traditional working hours, at nominal cost.</p><p>Stats has been using machine learning since before anybody ever knew about it. GLMs, OLS, LOESS, and multivariate regression were first statistical tools before they became anything to machine learning _enthusiasts_.</p><p><a href="https://mastodon.social/tags/rstats" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>rstats</span></a> <a href="https://mastodon.social/tags/linux" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>linux</span></a> <a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> <a href="https://mastodon.social/tags/ai" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ai</span></a></p>
Friedrich Delgado<p>2/ - Symbols etc. have changed the module in which they live in, sometimes multiple times. In this case I have to find the first commit in the new file when they appear and then follow the old file. Or checkout the old commit and do git grep.</p><p>3/ - Symbols have been renamed. I'm not aware that git can trace this in any way. Something, something, lsp maybe?</p><p><a href="https://mastodon.social/tags/git" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>git</span></a> <a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a></p>
Friedrich Delgado<p>Hm, is there anything that can track the evolution of code in git in a more semantical way?</p><p>I happen to have a python codebase that has evolved over almost 13 years. Things that happened:</p><p>1/ - Moving from python 2 to python 3 in a `lib/python` code layout, which means that **everything** has moved from `lib/python` to `lib/python3`. Actually `git --follow` can follow the files here, which is helpful.</p><p><a href="https://mastodon.social/tags/git" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>git</span></a> <a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a></p><p>1/</p><p><a href="https://mastodon.social/tags/solved" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>solved</span></a> see <a href="https://mastodon.social/@TauPan/113515155709610673" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">mastodon.social/@TauPan/113515</span><span class="invisible">155709610673</span></a></p>

My latest coding project is moving the project data structure of @novelwriter from a Qt standard tree view into a custom model/view set.

The old implementation based on a QTreeWidget is a shadow copy of the project data, which needs to be kept in sync and is the most error prone part of the code.

The new model/view set holds the proper tree structure in memory and handles consistency directly in the hierarchy. But there is *so* much functionality to port over!

#Code#Python#Qt