Advertisement · 728 × 90

Posts by Ned Batchelder

Have you tried the Microsoft NERD center?

1 month ago 1 0 1 0
EdText edtext is a utility inspired by the ed editor for selecting and manipulating lines of text.

I got tired of hacking ad-hoc text selection functions, so I wrote edtext: line selection and manipulation using ed address ranges.
nedbatchelder.com/blog/202602/...

1 month ago 1 0 0 0

We can agree to disagree :)

2 months ago 1 0 0 0
Preview
Responsible Pytest Usage, Wed, Jan 21, 2026, 6:00 PM | Meetup A presentation sponsored by Matterbeam David Sturgis: Responsible Pytest Usage PyTest is an increasingly popular framework for automated software testing in Python. In so

This Wednesday! #Boston #Python
www.meetup.com/bostonpython...

2 months ago 3 1 1 0
Preview
Responsible Pytest Usage, Wed, Jan 21, 2026, 6:00 PM | Meetup A presentation sponsored by Matterbeam David Sturgis: Responsible Pytest Usage PyTest is an increasingly popular framework for automated testing in Python. In some ways,

Boston Python presentation night in one week: Responsible Pytest Usage by David Sturgis, sponsored by Matterbeam.

www.meetup.com/bostonpython...

Join us if you are in the area!

2 months ago 4 1 0 0
Post image

Needed to clean code after my first major rewrite.

'Coverage.py' is awesome, showed exactly what isn't getting called. I silently broke something on the path to email alerts for the error logger. Oops...

@nedbat.com #python #coding

3 months ago 4 1 0 0
Generating data shapes with Hypothesis I used Hypothesis to generate random data structure schemas, and then generate random data using them. I learned a lot along the way.

In which the author dives very deep (far deeper than called for) into using Hypothesis to generate data for #Python tests:

nedbatchelder.com/blog/202512/...

3 months ago 5 0 0 0
A testing conundrum A useful class that is hard to test thoroughly, and my failed attempt to use Hypothesis to do it.

A useful class that is hard to test thoroughly, and my failed attempt to use Hypothesis to do it: nedbatchelder.com/blog/202512/...

3 months ago 6 0 0 0
Advertisement

I learned this 1+ year ago from @nedbat.com and had to use it yesterday with the code shown above.

I was so annoyed by my code on the left and SUDDENLY I remembered Ned's trick and voilà, my code became so much nicer...

3 months ago 8 2 0 0

Did you get more from him about why that seemed absurd to him?

4 months ago 0 0 1 0
Preview
Sponsor the PSF The official home of the Python Programming Language

How much is your company spending to support the Python Software Foundation?
For comparison, how much do they spend for tips on expensed meals?
The PSF runs PyPI, where pip installs from. You depend on PyPI.

Fund the PSF. Tip your server!
www.python.org/psf/sponsors...

4 months ago 33 20 1 2
Preview
Autism Adulthood, 3rd edition My wife’s book is out today, you should buy it.

"If you have someone in your life on the spectrum, or are on it yourself, I guarantee you will find new ways to understand the breadth of what autism means and what it can be."

nedbatchelder.com/blog/202511/...

4 months ago 5 0 0 0
Preview
Python Software Foundation Sponsors The official home of the Python Programming Language

Forget about supporting the PSF, too abstract.

Pip installs from PyPI. It would be bad if `pip install` stopped working. Support the org that runs PyPI.

Surprise, it's the PSF! Your company depends on #Python. You want it to keep working and keep being good.

python.org/psf/sponsors/

4 months ago 46 20 0 0
Side project advice A chat about side projects from a Boston Python project night: choose your paths and forgive yourself.

Boston Python is a good place to connect with people and even have have non-technical discussions:
nedbatchelder.com/blog/202510/...

5 months ago 8 1 0 0
Preview
test: no longer need to support multiple 'lines' · nedbat/coveragepy@f8f3edc Since 3.10 is our minimum, and it conforms to PEP 626, we know what lines will be reported, and don't need multiple options.

Nice! My coverage dropped from 94.370% to 94.366%!
(I deleted code that had been covered, but was no longer needed)

github.com/nedbat/cover...

github.com/nedbat/cover...

5 months ago 8 0 0 0
Advertisement
Preview
The official home of the Python Programming Language

TLDR; The PSF has made the decision to put our community and our shared diversity, equity, and inclusion values ahead of seeking $1.5M in new revenue. Please read and share. pyfound.blogspot.com/2025/10/NSF-...
🧵

5 months ago 6408 2751 124 451
A stack of stamped envelopes, ready for mailing

A stack of stamped envelopes, ready for mailing

I'm writing letters to defend democracy, how are you spending your day? votefwd.org

5 months ago 12 0 1 0
Preview
Vote Forward Vote Forward volunteers send heartfelt handwritten letters to unregistered and low-propensity voters encouraging them to participate in our democracy. The letters have been shown to significantly boos...

If you can go out to a march, you can spend an hour writing letters to encourage voters. votefwd.org

5 months ago 4 1 0 0
Preview
Vote Forward Vote Forward volunteers send heartfelt handwritten letters to unregistered and low-propensity voters encouraging them to participate in our democracy. The letters have been shown to significantly boos...

Vote Forward is running letter-writing campaigns to US voters. votefwd.org
Does it help? Not sure. Doom-scrolling doesn't!

5 months ago 2 0 0 0
Preview
Hobby Hilbert Simplex An exploration and explanation of how to generate interesting swoopy art

I learned a few algorithms for generative art, you can too:
nedbatchelder.com/blog/202509/...

6 months ago 8 1 0 0
Testing is better than DSA People should spend less time learning DSA, more time learning testing.

People should spend less time learning DSA, more time learning testing.

nedbatchelder.com/blog/202509/...

6 months ago 8 4 1 0
Preview
Vote Forward Vote Forward volunteers send heartfelt handwritten letters to unregistered and low-propensity voters encouraging them to participate in our democracy. The letters have been shown to significantly boos...

Vote Forward is running letter-writing campaigns to US voters. votefwd.org
Does it help? Not sure. Doom-scrolling doesn't!

6 months ago 0 0 0 0
Preview
A Lifetime of Autism and Summer Vacations Personal Perspective: As empty-nesters, we can go anywhere, do anything. But in the summer, we don't. We go to that same rental, even though it is way too big for just the two of us.

My wife's latest for Psychology Today. That's me in the pic, about 22 years ago..

www.psychologytoday.com/us/blog/all-...

7 months ago 6 1 0 0

Thanks to an amazing contribution by Alex Gaynor, `coverage combine` is now twice as fast! Not released yet, but give it a try and report back.
python3 -m pip install git+https://github.com/nedbat/coveragepy

7 months ago 10 1 0 0

Love it! And stacking parametrize for combinations is cool, too!

7 months ago 7 1 0 0
Advertisement
Starting with pytest’s parametrize Pytest’s parametrize feature is powerful but it looks scary. I hope this step-by-step explanation helps people use it more.

The pytest.mark.parametrize feature is amazing, and more people should use it, especially people new to writing #Python tests. But it looks scary. I wrote an explainer: nedbatchelder.com/blog/202508/...

7 months ago 16 3 1 0
Change history for coverage.py — Coverage.py 7.10.3 documentation

I fixed a handful of issues with the new `patch = subprocess` feature in coverage․py. Try 7.10.3 and let me know how it goes!

coverage.readthedocs.io/en/7.10.3/ch...

7 months ago 6 0 0 0
A hexagonal grid with tightly-packed paths connecting same-colored dots.

A hexagonal grid with tightly-packed paths connecting same-colored dots.

Every puzzle contains another puzzle: how was it constructed? The game Flow Free asks you to find the paths to connect same-colored dots on a grid. How are these layouts created?

7 months ago 6 1 2 0

You are a treasure, and I hope you have someone who treasures you.

8 months ago 26 5 2 0
Coverage.py Regex Pragmas | Hacker News

"Coverage is one of those tools that's just silently awesome."

news.ycombinator.com/item?id=4472...

8 months ago 12 0 0 0