python

Back Open Paginator
05.05.2024 00:19
pythontest (@pythontest@fosstodon.org)

Python Test 220: Getting the most out of PyCon, including juggling - Rob Ludwick

podcast.pythontest.com/episode

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




Show Original Post


04.05.2024 23:10
aksharvarma (@aksharvarma@mathstodon.xyz)

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 --> ???




Show Original Post


04.05.2024 23:07
diazona (@diazona@techhub.social)

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.

#programming




Show Original Post


04.05.2024 22:20
josevnz (@josevnz@fosstodon.org)

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





Show Original Post


04.05.2024 22:05
jobsfordevelopers (@jobsfordevelopers@mastodon.world)

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 jobsfordevelopers.com/jobs/sta
#jobalert #jobsearch #hiring




Show Original Post


04.05.2024 21:53
akkana (@akkana@fosstodon.org)

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.) shallowsky.com/blog/programmin




Show Original Post


04.05.2024 21:52
federation (@federation@owncast.deadtom.me)

I've gone live on Owncast!

Doing some testing

#games #TTRPG #Minecraft #tech #Overcooked #LetsPlay #JustChatting #DungeonsAndDragons #LegoCityUndercover #Python #Linux #Debian #videogames

https://owncast.deadtom.me





Show Original Post


04.05.2024 21:45
jelly (@jelly@gts.dodgy.download)

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




Show Original Post


04.05.2024 21:30
diazona (@diazona@techhub.social)

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. stackoverflow.com/q/78427983/5




Show Original Post


04.05.2024 21:20
python_discussions (@python_discussions@mastodon.social)

Reboot Your Router with a Python Script

github.com/slyfox1186/script-r

Discussions: discu.eu/q/https://github.com/




Show Original Post


04.05.2024 20:57
carapace (@carapace@mastodon.social)

One of my favorite weird quirks of (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




Show Original Post


04.05.2024 20:48
carapace (@carapace@mastodon.social)

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.




Show Original Post


1 2 3 4 5 6 7 8 9 ...285
UP