Python Tip #102 (of 365):
Use pathlib.Path(directory, filename) to join path strings
To join path strings together, instead of:
joined = Path(directory) / filename
Or:
joined = Path(directory).joinpath(filename)
You can do this:
joined = Path(directory, filename)
#Python #DailyPythonTip
Posts by Brett Cannon
Nearly 5 years, countless PRs, a program grown from 1 to 5. Thank you, Łukasz Langa, for defining the CPython Developer in Residence role. Best of luck on the next step of your journey and we'll see you around the community!
We're entering the final stretch of collecting responses for the 2026 Python Developers Survey! 🐍 📊
It only takes 10-15 minutes, and you could win a US$100 Amazon gift voucher.
Complete it here: surveys.jetbrains.com/s3/python-de...
The 28th Virginia battle flag is a Confederate battle flag that belonged to the 28th Virginia Infantry Regiment. Captured by the 1st Minnesota Infantry Regiment at the Battle of Gettysburg, the flag was brought to Minnesota and exhibited at the state's capitol for several years before passing into the permanent collection of the Minnesota Historical Society after 1896 where it has remained since.
Happy Confederate Surrender Day from Minnesota where we still have your goddamn flag and we’re not giving it up.
en.wikipedia.org/wiki/28th_Vi...
Niche but since folks have asked: If you've noticed the prometheus runner (Windows) on doesjitgobrrr.com looking worse lately: tail calls were enabled since that's what shipped in 3.15.0a8, so it's an "interpreter got better" situation, not a JIT regression.
🛡️ Trusty Pub now has a home on the web! lmmx.github.io/trusty-pub/
I’ve really not used GitHub Pages in a minute but was ironically a fitting time to throw zizmor and other good practices in the repo as a demo
Also has a (non-exhaustive!) reading list under the Resources tab 👓📖
Just sAw it in IMAX while on a staycation and it was pretty great!
opensource.snarky.ca/Python/Workf... has my notes. And we can establish it by shipping a `py` command on all platforms from python.org that provides the workflow and acts as THE way to install Python. The tricky bit is community buy-in as to what that baseline is.
I said digital attestations and `pylock.toml` would have helped with the litellm attack. People asked for more details, so I wrote a blog post explaining why it would have helped.
snarky.ca/why-pylock-t...
Guido van Rossum has decided to start a new project: interviewing "key Python developers from the first 25 years".
Here is the one he did with @snarky.ca, posted early this month (h/t @pycoders.com's latest newsletter).
#Python
[1/2]
gvanrossum.github.io/interviews/B...
It's all about lowering risk. At this point I think a baseline experience around user and developer workflows exists that should be pushed out to everyone so it's easier to have. Having something like that be controlled by a company that's getting put into READMEs is a risk.
It makes me pretty sad tbh. I see my friends burning out from having to triage all this trash.
I see repos that I used to work on where all human comments on PR reviews are LLM generated. I get folks are using AI but can we not converge toward being 12 LLMs in a trenchcoat maintaining a project?
The hair cut is the bigger news to me!
I was already working towards things to de-emphasize uv for the community, so it doesn't change that goal for me. I'm taking a wait-and-see, but I was already trying to help the community hedge any bets that uv might not work out.
High availability? This isn't a telephone switch.
No opinion (yet)?
Rain should be off and on while you're here
If you’re looking for a nice, modern, featureful #Python package and environment manager, may I suggest PDM?
And maybe also toss some funding their way.
pdm-project.org
Hence why my proposal uses a new keyword, so it isn't "a function" to begin with.
I don't know what that kind of dual "is it a statement or an expression?" usage would do to @pablogsal.com .
Like "I better skip work to get to see it in the theatre" good? Like "stake your reputation in this household about movie reviews" good?
Yeah, what is there to get mad about?!?
But maybe that's required to make it work inline as a protocol like PEP 764.
Eric Snow once said he would rather see it be a callable like `types.SimpleNamespace`. One issue with that is where does the docstring go? As well, a `record` type like I'm suggesting is already pushing syntax a bit, so having function signature syntax work inline would be even more of a stretch.
There's nothing saying some `record` type can't be treated as a protocol by type checkers but behave like a class. And I don't see why that's hard to teach as typing is usually a much later topic where someone can hopefully understand what a protocol is.
Because dataclasses have to look at type annotations for e.g. `KW_ONLY`, they will cause lazy imports of type hints to reify. One perk to my record idea is that wouldn't be an issue (snarky.ca/my-proof-of-...).
/cc @bitecode.dev
BC is getting rid of changing the time after spring forward March 6! Pacific Time FTW!
BC got tired of waiting for the west coast of the US to get their act together to change simultaneously.
www.cbc.ca/news/canada/...
Wrote a blog post to give a status update on WASI support for CPython as PEP 816 got accepted!
snarky.ca/state-of-was...
Navy background, pink headline "New ways to support Gleam!"; below the headline there's a graphic that shows screen of the "Sponsor" page from gleam.run and its text: "Sponsorship and donations. Support Gleam's development by sponsoring us! he Gleam project" and the description as well as 3 pink buttons: Github Sponsors, Bank Transfer, Liberapay.
Thanks to one of the discussions at the #GleamGathering, we decided to add more options to support Gleam development financially: now you can do it via direct bank transfer ⭐
All the details: gleam.run/sponsor