python

Back Open Paginator
06.03.2026 08:14
mopicmp (@mopicmp@mastodon.social)

Python Tip: enumerate() with start

items = ['a', 'b', 'c']
for i, item in enumerate(items, start=1):
print(f'{i}. {item}')
# 1. a 2. b 3. c

enumerate() has a start parameter. No more manual counter variables.

raccoonette.gumroad.com/l/Pyth




Show Original Post


06.03.2026 08:13
mopicmp (@mopicmp@mastodon.social)

Python Tip: Type Hints for Clarity

def greet(name: str, times: int = 1) -> str:
return (f'Hello, {name}! ' * times).strip()

result: str = greet('World', 3)

Type hints make code self-documenting and enable IDE autocomplete. Your future self will thank you.

raccoonette.gumroad.com/l/Pyth




Show Original Post


06.03.2026 07:51
mopicmp (@mopicmp@mastodon.social)

Python Tip: Context Managers

from contextlib import contextmanager

@contextmanager
def timer():
start = time.time()
yield
print(f'Took {time.time()-start:.2f}s')

with timer():
heavy_computation()

Create your own context managers with @contextmanager. Clean resource management and timing.

raccoonette.gumroad.com/l/Pyth




Show Original Post


06.03.2026 07:51
mopicmp (@mopicmp@mastodon.social)

Python Tip: Walrus Operator :=

# Assign AND test in one line
if (n := len(data)) > 10:
print(f'Too long: {n}')

The walrus operator (:=) assigns a value and returns it. Perfect for avoiding redundant...

raccoonette.gumroad.com/l/Pyth




Show Original Post


06.03.2026 07:07
tinoeberl (@tinoeberl@mastodon.online)

#Steady #Klimacrew

Wie erfolgreich war die #Energieerzeugung meines #Balkonkraftwerk​s?

Am Ende jeden Monats wird hier automatisch ein #Säulendiagramm getrötet, das die monatliche #Energieerzeugung mit der #Ertragsprognose vergleicht. Wie man mit Vibe Coding ein #Python-Skript erstellt, das die #Wechselrichterdaten und #Prognosedaten auswertet und die Grafik erstellt, erfahrt ihr im Artikel. 😀

tino-eberl.de/vibe-coding/vibe

#Steckersolar #PVGIS #Datenvisualisierung #VibeCoding




Show Original Post


06.03.2026 06:43
WanderingInDigitalWorlds (@WanderingInDigitalWorlds@sunny.garden)

Learning how to program is fun, the math aspect of it is a bit difficult for me though.

I am personalizing my lessons in the hopes of retaining something worthwhile before moving on to learning Python proper.

That is when I will begin to practice little, medium, and large projects!

#Programming #Python




Show Original Post


06.03.2026 06:36
r (@r@fed.brid.gy)

Perl Weekly Challenge 363's tasks are "String Lie Detector" and "Subnet Sheriff". I challenge anyone to not think of I Shot The Sheriff given those tasks. #PerlWeeklyChallenge #raku #perl #python #elixir

Perl Weekly Challenge: I Shot ...




Show Original Post


06.03.2026 06:07
247CodeGirl (@247CodeGirl@mastodon.social)

Season 1 Lesson 7 Part 1 - Your First Steps - Do you know how to show - Number Signs in Python





Show Original Post


06.03.2026 05:43
darbales (@darbales@rollenspiel.social)

Habe gerade spontan 2 #python lerncodes geübt. Der 2 war dem ersten sehr ähnlich es wurde nur eine Kleinigkeit hinzugefügt. So konnte ich etwas interessantes erfahren. Was mir vorher noch nicht bewusst war. Aber ich lerne ja auch noch alles. Interessant was man alles durch Training lernen kann.




Show Original Post


06.03.2026 04:05
Anarcat (@Anarcat@kolektiva.social)

Wallabako retirement and Readeck adoption anarc.at/blog/2026-03-05-walla #wallabako #debian-planet #python-planet




Show Original Post


06.03.2026 03:58
phlogiston (@phlogiston@mastodon.nz)

An interesting #licence war is happening in the #Python world.

The popular `chardet` package has apparently been re-written (by assistance of the Claude #LLM). Undergoing this *version* change to v 7.0.0 the current maintainer has shifted the licence away from the #LGPL to the more permissive MIT licence.

I'm not a lawyer, and I don't know about the deeper backgrounds. While a complete clean slate implementation may justify a different licence, I don't think that anyone who's been maintaining a package for years can claim complete lack of influence on the existing code base. So a licence change from one version to another without consent of the (original) contributors seems wildly inadmissible.

Additionally, if the author claims a complete re-write using Claude, in many jurisdictions (including the US) AI generated content cannot be IP protected. So in that case he'd have had to remove the #copyright (c) claim to his name as well to be at least consistent with the narrative.

This is completely independent of the authenticity of the supposed statement by Mark Pilgrim (original author) of `chardet`.

I'm interested to hear what others think ...

theregister.com/2026/03/06/ai_

#license #GenAI #IntellectualProperty




Show Original Post


06.03.2026 01:05
jobsfordevelopers (@jobsfordevelopers@mastodon.world)

Roblox is hiring Principal Enterprise Applications Engineer

🔧 #golang #python #api #terraform #principalengineer
🌎 San Mateo, California
⏰ Full-time
🏢 Roblox

Job details jobsfordevelopers.com/jobs/pri
#jobalert #jobsearch #hiring




Show Original Post


1 ...373 374 375 376 377 378 379 380 381 382 383 ...1592
UP