atlas news
    
Ned Batchelder
30  octobre     10h23
Side project advice
Ned Batchelder    Last night was a Boston Python project night where I had a good conversation with a few people that was mostly guided by questions from a nice guy named Mark.How to write nice code in researchMark works in research and made the classic observation that research code is often messy, and asked about...
21  octobre     11h14
Natural cubics, circular Simplex
Ned Batchelder    This post continues where Hobby Hilbert Simplex left off. If you haven’t read it yet, start there. It explains the basics of Hobby curves, Hilbert sorting and Simplex noise that I’m using.AnimationTo animate one of our drawings, instead of considering 40 lines, we’ll think about 140 lines. The...
26  septembre     12h14
Hobby Hilbert Simplex
Ned Batchelder    I saw a generative art piece I liked and wanted to learn how it was made. Starting with the artist’s Kotlin code, I dug into three new algorithms, hacked together some Python code, experimented with alternatives, and learned a lot. Now I can explain it to you.It all started with this post by aBe on...
22  septembre     16h04
Testing is better than DSA
Ned Batchelder    I see new learners asking about DSA a lot. Data Structures and Algorithms are of course important: considered broadly, they are the two ingredients that make up all programs. But in my opinion, DSA as an abstract field of study is over-emphasized.I understand why people focus on DSA: it’s a...
24  août     21h28
Finding unneeded pragmas
Ned Batchelder    To answer a long-standing coverage.py feature request, I threw together an experiment: a tool to identify lines that have been excluded from coverage, but which were actually executed.The program is a standalone file in the coverage.py repo. It is unsupported. I’d like people to try it to see what...
13  août     10h14
Starting with pytest’s parametrize
Ned Batchelder    Writing tests can be difficult and repetitive. Pytest has a feature called parametrize that can make it reduce duplication, but it can be hard to understand if you are new to the testing world. It’s not as complicated as it seems.Let’s say you have a function called add nums() that adds up a list...
28  juillet     16h04
Coverage.py regex pragmas
Ned Batchelder    Coverage.py lets you indicate code to exclude from measurement by adding comments to your Python files. But coverage implements them differently than other similar tools. Rather than having fixed syntax for these comments, they are defined using regexes that you can change or add to. This has been...
24  juillet     23h03
Coverage 7.10.0: patch
Ned Batchelder    Years ago I greeted a friend returning from vacation and asked how it had been. She answered, It was good, I got a lot done I understand that feeling. I just had a long vacation myself, and used the time to clean up some old issues and add some new features in coverage.py v7.10.The major new...
15  juillet     10h52
2048: iterators and iterables
Ned Batchelder    I wrote a low-tech terminal-based version of the classic 2048 game and had some interesting difficulties with iterators along the way.2048 has a 4à 4 grid with sliding tiles. Because the tiles can slide left or right and up or down, sometimes we want to loop over the rows and columns from 0 to 3,...
16  juin     04h00
Math factoid of the day: 63
Ned Batchelder    63 is a centered octahedral number. That means if you build an approximation of an octahedron with cubes, one size of octahedron will have 63 cubes.In the late 1700’s René Just Haüy developed a theory about how crystals formed: successive layers of fundamental primitives in orderly arrangements....