Python Test 220: Getting the most out of PyCon, including juggling - Rob Ludwick
https://podcast.pythontest.com/episodes/220-juggling-pycon
Even if you never get a chance to go to PyCon, I hope this interview helps you get a feel for the welcoming aspect of the Python community. #Python #PyCon #juggling
Evolution of how I think of #loops while #coding:
1. When I first learned "loops":
while (condition is true) {do these things, adjust things so a slightly new condition is checked}
// That's where I first saw infinite loop and how there are intentional infinite loops.
2. A small step to move condition update out of the loop body:
for (i=0; i< N; i++) {do these things}
// After the couple of days it took to get used to them, I found them neater and closer to how I think of things.
3. Most of the time, the i from before is indexing into something, so let's directly deal with the item being indexed:
for item in collection:
do stuff
# After the few days to rewire syntax muscle memory, going back would decidedly feel like a step back.
# I don't want to give up automatic (and transparent) out-of-bound checks.
4. There are actually only about 3/4 things one does inside a loop:
map/fold/scan/filter function-to-call collection-to-traverse-through
;; Getting rid of explicit indexing was just step one.
-- After a few days/months/years, I now realize that it is more important and less buggy if I think only of the function to call (and whether I want to end up with a new (maybe pruned) collection, a single thing, or "both" (that's how I think of scans))
----------
Alternatively, my evolution as I learned new #programming languages idioms:
#KandR -->
#cpp or #java -->
#python -->
#lisp or #haskell --> ???
I remember having a discussion about argument parsing in #Python a while ago where someone recommended a small library that was kind of like argparse except that instead of returning an argparse.Namespace, it returns a fully typed object (which you define), a dataclass or something similar. Anyone know what I'm talking about? I wanted to try that library but I forgot what it is and I can't find the discussion.
After a long time and looking for a suitable home for one of my articles I'm done. Draft is completed, waiting for editorial review and soon you will learn how to run a tower race on the Empire State and write code to analyze the results, all with Python and Open Source tools.
#esru #EmpireStateRunUp #empirestate #python #linux #pandas
Gemini is hiring Staff Site Reliability Engineer
🔧 #c #cplusplus #golang #java #python #ruby #scala #node #blockchain #cryptocurrency #web3 #aws #azure #gcp
🌎 New York, United States; Seattle, Washington
⏰ Full-time
🏢 Gemini
Job details https://jobsfordevelopers.com/jobs/staff-site-reliability-engineer-at-gemini-com-sep-20-2023-5ff194?utm_source=mastodon.world&utm_medium=social&utm_campaign=posting
#jobalert #jobsearch #hiring
Create an image with wrapped text (like to generate book cover images for an #ebook) using #Python PIL. (This is what I was so frustrated with yesterday; hopefully this will help other people looking for a working example.) https://shallowsky.com/blog/programming/PIL-image-text.html
I've gone live on Owncast!
Doing some testing
#games #TTRPG #Minecraft #tech #Overcooked #LetsPlay #JustChatting #DungeonsAndDragons #LegoCityUndercover #Python #Linux #Debian #videogames
If anyone already wants to play with Python 3.13 on Arch Linux, I've made a toolbox. Note that none of the repository packages are rebuild and only bootstrapped build tools are available from this repository https://pkgbuild.com/~jelle/python313/
toolbox create --image ghcr.io/jelly/archlinux-python313 -c python313
#archlinux #python
This is a fun and weird thing: in #Python versions prior to 3.12, `dict( id=1, **{"id": 2})` raises a different error depending on whether it happens inside an exception handler or not. https://stackoverflow.com/q/78427983/56541
Reboot Your Router with a Python Script
https://github.com/slyfox1186/script-repo/blob/main/Python3/reboot-router.py
Discussions: https://discu.eu/q/https://github.com/slyfox1186/script-repo/blob/main/Python3/reboot-router.py
One of my favorite weird quirks of #Python (that bites newbies sometimes) is that default args are evaluated at the time and in the scope the 'def' statement is evaluated.
That's why you gotta do e.g.:
noooooo = [(lambda n: n**k) for k in range(10)]
print(' '.join(str(p(2)) for p in noooooo))
512 512 512 512 512 512 512 512 512 512
yeeeees = [(lambda n, k=k: n**k) for k in range(10)]
print(' '.join(str(p(2)) for p in yeeeees))
1 2 4 8 16 32 64 128 256 512
1/2
I'm pretty sure this is the most elaborate default argument I've ever used. It's a dict mapping characters to type-checker functions, but we only need the __getitem__ method (a function that maps char -> func or raises KeyError.) In effect, the dict is stored in a closure of its own method! The self argument to the __getitem__() method is "filled in" when the interpreter calls __getattr__() "under the hood" of the resolution of the '.' method/attribute lookup operator here.