In #Python, @classmethod can used to create alternate constructors for making objects in other ways. Here's a simple example:
=> More informations about this toot | View the thread
https://nedbatchelder.com/blog/202501/nat_running.html
=> More informations about this toot | View the thread
Comparison operators in #Python can be chained together, but using them that way could be controversial. I wrote this this other day:
=> More informations about this toot | View the thread
Years ago, I tried ads on my site. My business card cube page got some attention, so I had $200 revenue for the year. When my tax guy saw that, he said, "Why don't you just make 1000 sites?" He was ahead of his time...
https://nedbatchelder.com/text/cardcube.html
=> More informations about this toot | View the thread
Wow, Apple somehow added a notification with a circle-x close button that literally does not work, and the thing appears on every video call:
=> More informations about this toot | View the thread
Happy #Python New Year!
=> More informations about this toot | View the thread
Any restaurant recommendations for Tucson?
=> More informations about this toot | View the thread
I've had a few responses. Anyone got a monster test suite they want to try it on?
python3 -m pip install git+https://github.com/nedbat/coveragepy@67f1440e0a384000e337
https://hachyderm.io/@coveragepy/113708693164348781
=> More informations about this toot | View the thread
Today's coverage․py headache: 3.14 deferred annotations really are code, but they are usually not run. How should coverage handle them?
https://github.com/nedbat/coveragepy/issues/1908
=> More informations about this toot | View the thread
For Boston's first real day of snow, a repost: https://nedbatchelder.com/blog/201902/a_boston_story.html
=> More informations about this toot | View the thread
Announcing the Partition Principle of #Python Pedagogy:
No matter what you are showing people or how unusual it is, if it uses str.partition() most of the comments will be, "I didn't know about str.partition()!"
https://docs.python.org/3/library/stdtypes.html#str.partition
BTW: also str.rpartition()...
=> More informations about this toot | View the thread
Some nice #pytest techniques here as @brianokken updates my "Testing some tidbits" post: https://pythontest.com/pytest/testing-tidbits-pytest/
=> More informations about this toot | View the thread
Is this the greatest song ever? Code Monkey by Jonathan Coulton.
https://www.youtube.com/watch?v=AEBld6I_AKs
=> More informations about this toot | View the thread
Today is the 20th anniversary of my first release of coverage․py: https://coverage.readthedocs.io/en/7.6.9/changes.html#version-2-0-2004-12-12
May all your lines be covered!
(Note: the project is more than 20 years old, Gareth Rees started it in 2001.)
=> More informations about this toot | View the thread
Is this #Python too compact? Perhaps, but there could be useful things to learn. Full explanation unpacked at https://nedbatchelder.com/blog/201802/a_python_gargoyle.html
=> More informations about this toot | View the thread
I have no opinion about the content of this blog post, but it's the first one I've seen with a minimap alongside it: https://mcyoung.xyz/2024/12/10/json-sucks/ (also the headings are wild.)
=> More informations about this toot | View the thread
Sometimes you get lucky! Wildly obscure bug, but reproducible. Git bisect finds the commit. Revert the change made to the one line from that commit that appears in the stack trace. Fixed!
https://github.com/nedbat/coveragepy/issues/1902
=> More informations about this toot | View the thread
Splitting a string once in #Python: .split() has maxsplit=, but .partition() can be better:
=> More informations about this toot | View the thread
BTW, about those #Python tidbits I post: sometimes I actually test them too: https://nedbatchelder.com/blog/202412/testing_some_tidbits.html
=> More informations about this toot | View the thread
I got a lot of replies with suggestions, so here are more #Python expressions to check if a (possibly empty) string has only 0's and 1's in it:
https://hachyderm.io/@nedbat/113578406735752229
=> More informations about this toot | View the thread
=> This profile with reblog | Go to nedbat@hachyderm.io account This content has been proxied by September (ba2dc).Proxy Information
text/gemini