Toots for nedbat@hachyderm.io account

Written by Ned Batchelder on 2025-01-18 at 18:10

In #Python, @classmethod can used to create alternate constructors for making objects in other ways. Here's a simple example:

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2025-01-14 at 19:05

https://nedbatchelder.com/blog/202501/nat_running.html

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2025-01-13 at 13:49

Comparison operators in #Python can be chained together, but using them that way could be controversial. I wrote this this other day:

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2025-01-09 at 23:18

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

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2025-01-08 at 22:37

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:

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2024-12-31 at 18:23

Happy #Python New Year!

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2024-12-31 at 01:32

Any restaurant recommendations for Tucson?

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2024-12-24 at 17:17

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

Written by Ned Batchelder on 2024-12-22 at 15:01

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

Written by Ned Batchelder on 2024-12-20 at 23:24

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

Written by Ned Batchelder on 2024-12-17 at 15:38

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

Written by Ned Batchelder on 2024-12-17 at 11:42

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

Written by Ned Batchelder on 2024-12-14 at 14:53

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

Written by Ned Batchelder on 2024-12-13 at 00:51

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

Written by Ned Batchelder on 2024-12-12 at 11:49

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

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2024-12-11 at 03:14

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

Written by Ned Batchelder on 2024-12-11 at 00:57

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

Written by Ned Batchelder on 2024-12-06 at 16:40

Splitting a string once in #Python: .split() has maxsplit=, but .partition() can be better:

=> View attached media

=> More informations about this toot | View the thread

Written by Ned Batchelder on 2024-12-04 at 12:35

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

Written by Ned Batchelder on 2024-12-04 at 12:30

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

=> View attached media

=> More informations about this toot | View the thread

=> This profile with reblog | Go to nedbat@hachyderm.io account

Proxy Information
Original URL
gemini://mastogem.picasoft.net/profile/109355037643980277
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
436.744574 milliseconds
Gemini-to-HTML Time
11.047016 milliseconds

This content has been proxied by September (ba2dc).