Now this is an interesting #Python problem. I don't know if it's a #bug, but it's a change in behaviour that I don't see documented.

I upgraded from #Debian 12/Bookworm to 13/Trixie, so the default Python3 changed from 3.11 to 3.13. A script of mine broke, because `pathlib.Path.is_mount()` changed behaviour when the path is a symlink (at least to a directory).

i.e. I'm testing a path that is a symlink. The symlink points to a directory. That directory *is* a mountpoint. The `.is_mount()` test in 3.11 returned True, while in 3.13 it returns False.

This seems wrong to me. Most path-manipulation functions transparently treat symlinks as if they were the pointed-to object unless you pass an option/flag specifically to say you want the symlink itself.

Gonna have to dig to see what else I can find.

#pathlib #path #is_mount #stdlib #behaviour #symlink #filesystem #mountpoint #mount

stdlib - Technical Leadership Resources

Explore curated frameworks, templates, and guides for technical leadership. From 1:1 templates to architecture frameworks, find the tools you need to lead effectively.

Debugging Leadership

Stdlib: A library of frameworks, templates, and guides for technical leadership

https://debuggingleadership.com/stdlib

#HackerNews #Stdlib #TechnicalLeadership #Frameworks #Templates #Guides

stdlib - Technical Leadership Resources

Explore curated frameworks, templates, and guides for technical leadership. From 1:1 templates to architecture frameworks, find the tools you need to lead effectively.

Debugging Leadership

Brand new PEP by @emmatyping to add Zstandard to the standard library:
https://peps.python.org/pep-0784/

Will it make it in to 3.14 before the feature freeze on 2025-05-06? It'll be close but it's possible!

The PEP also suggests namespacing the other compression libraries lzma, bz2 and zlib, with a 10-year deprecation for the old names.

Join the discussion to give your support, suggestions or feedback:

https://discuss.python.org/t/pep-784-adding-zstandard-to-the-standard-library/87377

#PEP #PEP784 #zstd #zstandard #stdlib #Python #compression

PEP 784 – Adding Zstandard to the standard library | peps.python.org

Zstandard is a widely adopted, mature, and highly efficient compression standard. This PEP proposes adding a new module to the Python standard library containing a Python wrapper around Meta’s zstd library, the default implementation. Additionally, to a...

Python Enhancement Proposals (PEPs)
ePub derived from a specialized Anki deck with integrated Python REPL, focusing on the Python Standard Library. https://pin.it/6vMDXKvoj via @pinterest
#epub #ebook #python #anki #stdlib
Pin on Pins by you

This Pin was discovered by SeveTech. Discover (and save!) your own Pins on Pinterest.

Pinterest
Unix buffering: The clearest explanation I've ever seen about line buffering, block buffering, and tty output vs simple file / pipe
https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-buffering/
#buffering #stdlib #linux #shell #unix #cli #+
Why pipes sometimes get "stuck": buffering

Why pipes sometimes get "stuck": buffering

Julia Evans

@astraluma

It depends on what, exactly, you want. time.localtime() will give you a value in the system's configured #timezone. time.gmtime() will give you #UTC. The difference between those will tell you the current local time's offset from UTC.

If you want the name of the configured timezone, on many Unix-type systems, you can read /etc/timezone to get it.

If you want more specific info about a timezone, you can add an external dependency which includes (or provides access to a system-provided) database of timezone info. This stuff changes often, and is decided politically rather than technically, so it's a moving target and the #Python #stdlib doesn't try to include it. `pytz` is one such package with a fairly complete database.

And you can easily override any of these in a test framework. Using unittest.mock.MagicMock(), for example, lets you override any of the above with whatever value you want those functions to return.

#pytz #test #mock #MagicMock

Una apparente #maledizione si è appena abbattuta su di me oggi: non riesco a far funzionare un #programma C!!! 😭️

Il problema è il seguente: il programmino di ieri per pubblicare su WordPress dal #3DS funziona benissimo, ma mi sono ricordata che dal browser del 3DS non si può caricare come #foto la schermata del gioco in pausa, ma solo cose dall’album… e non tutti i giochi permettono di salvare lì. Per salvare #screenshot da qualunque gioco c’è il menù #Rosalina, ma salva foto non-JPEG e in una cartella diversa. 😪️

Ho pensato per un attimo di forkare #LumaCFW (ho controllato e nessuno lo ha fatto, almeno non per versioni recenti), e modificare la funzione di screenshot per salvare in #JPEG, ma dopo qualche prova mi sa che evito, perché è un casino: l’ambiente di esecuzione è talmente ristretto che non vanno nemmeno tutte le funzioni della #stdlib #C, quindi non è immediato far funzionare tutto. 😮‍💨️

La seconda opzione, più sfavorevole ma comunque decente, sarebbe un #homebrew che converte le foto da #BMP a #JPG e le mette nella cartella giusta… e ovviamente non esiste, esistono cose simili ma non questo, quindi devo farlo io. Ho trovato questa repo da cui posso semplicemente rubare il #codice di #conversione, che sul 3DS compila e quindi dovrebbe tranquillamente fungere. E però mi sto incartando su tutto il resto, cioè la navigazione tra le cartelle e la gestione dei #file (automatica, non pianifico di mettere menù o cose, deve semplicemente aprirsi, convertire, e chiudersi). #Mannaggia! 🤢️

Purtroppo C per fare cose di #utilità pratica (ossia non videogiochini, o roba tipo demo audiovisive, e così via) è #tedioso… soprattutto perché la #API della stdlib fa proprio schifo, con tutti i nomi di funzioni e tipi scritti tutti in minuscolo e spesso senza vocali perché a qualcuno pesava il culo di scrivere parole intere. E quindi finisci per creare millemila macro e funzioni intermedie di astrazioni per evitare di ripetere di continuo le stesse criptiche righe ma così vai a creare astrazioni ancora più astruse per passare i dati in giro e così via. Mi chiedo come sia possibile usarlo per fare addirittura interi sistemi operativi, #pezzi. Vabbè, oggi si soffre. 💀️

https://octospacc.altervista.org/2024/02/10/cazo/

#3DS #API #BMP #C #codice #conversione #file #foto #homebrew #JPEG #JPG #LumaCFW #maledizione #Mannaggia #pezzi #programma #Rosalina #screenshot #stdlib #tedioso

Test WuppìMini - fritto misto di octospacc

Se tutto funziona a modino, questo #post è stato interamente composto e pubblicato dal #Nintendo3DS, con #WuppìMini. Non dico altro, #scrivere col pennino è una tortura. http://wuppimini.octt.eu.org/

fritto misto di octospacc
2) Python Standard Library: #Python #stdlib comes with batteries included, that means even though there are several ways to do something, in specific cases using a certain stdlib function like `chain()` will be the fastest. Or not, like when cloning a 2d list it's faster to `copy()` manually in a loop than to pickle-unpickle

@doctorwhom

Well done, but ...

>>> import fractions
>>> fractions.Fraction(0.125)
Fraction(1, 8)
>>> fractions.Fraction(0.3333)
Fraction(6004199023210345, 18014398509481984)
>>> fractions.Fraction(0.3333).limit_denominator(1000)
Fraction(1, 3)

A lesser-known part of the #stdlib

😂