Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K

    Ned Batchelder

    nedbatchelder.com · Personal blog · on HN since 2007

    Ned Batchelder, a Python developer who created coverage.py and Cog, writes about Python, Unicode, and software practice.

    Visit blogRSSHN submissions
    ProgrammingLanguages & CompilersOpen Source & Linux
    What HN says

    HN commenters link Cog for generating C++ code from Python, and his talk on Python names and values; one describes him as creator of coverage.py.

    Stats for nerds
    208HN people shared it
    256linked in comments
    5.5Kstory points
    Feb 2026last shared
    2009people per year2026

    Top posts on HN

    1. 1
      Print this file, your printer will jam (2008)
      5 people · 769 points · first shared 2008 · 208 comments on HN
    2. 2
      Bug #915: Please help
      1 person · 591 points · first shared 2020 · 95 comments on HN
    3. 3
      Bug #915: Solved
      2 people · 345 points · first shared 2020 · 106 comments on HN
    4. 4
      Goodbye Freenode
      2 people · 279 points · first shared 2021 · 118 comments on HN
    5. 5
      What’s in Which Python
      3 people · 214 points · first shared 2022 · 72 comments on HN
    6. 6
      Testing is better than data structures and algorithms
      1 person · 188 points · first shared 2025 · 176 comments on HN
    7. 7
      On Python security amidst recent Rails/YAML vulnerabilities
      3 people · 176 points · first shared 2013 · 44 comments on HN
    8. 8
      Why a mock doesn’t work
      2 people · 176 points · first shared 2019 · 76 comments on HN
    9. 9
      GitHub monoculture
      1 person · 156 points · first shared 2014 · 104 comments on HN
    10. 10
      How to Be Helpful Online
      2 people · 154 points · first shared 2020 · 57 comments on HN

    What HN people wrote when they linked it

    • dfcarneyFeb 2013

      Their server is down. Here's the content:

      -- by Rohit Sethi on February 13, 2013
      -- http://blog.sdelements.com/author/rohit/

      The latest Rails security flaw [1] is example of a common anti-pattern. Ned Batchelder wrote an awesome post [2] explaining how a similar issue may also exist in Python’s YAML parser [3]. Looking at these vulnerabilities, I am reminded of similar flaws in other frameworks and libraries.

      The issue in each case is an abuse of extensibility. At first glance the idea is clever: allow for run-time execution of new code or binding of server-side variables without changing your compiled code, thereby greatly enhancing extensibility. For example, provide extensions to your Python YAML parser that allow you to create arbitrary objects and execute Python code; provide extensions to XML Template parsing that allows for arbitrary command execution [4]; or dynamically assign user-supplied parameters to server-side variables [5] (aka mass assignment) based on the parameter name. This kind of vulnerability is by design in contrast to many other by accident vulnerabilities. We called the mass assignment anti-pattern out [6] several years ago when doing a security analysis of the Core Java EE Patterns for OWASP.

      I have a strong feeling we’ll see more vulnerabilities of this type, particularly with the rising popularity of standards like SAML that are built upon several layers of libraries implementing and extending complex specifications. These kind of issues can…

    • lumpaFeb 2021

      Makes sense, I think you can get some answers in HN (worth asking again, maybe direct the question to "parents of children in the autistic spectrum"?), but there are better places to ask. It's great that you're taking steps to give your son the best environment you can, please take these as attempts to help you achieve that.

      You say you don't know about what I asked and if asked directly they'll justify as necessary focusing on the affected children. That doesn't help you much, maybe there's something already published you can find yourself and read to help figuring things out? What do Dane psychologists/neurologists say in articles they write? Are the comparisons of the different systems in Europe? You have to go a bit deeper to figure out what is best, reading about about autism is part of the package IMO. Some people[0][1] find that writing about it also helps.

      Also, you're (going to be?) THE expert on your son and his needs, no doubt about that. So if you study a lot right now it'll help to make your case (and/or mind, if you haven't decided what's best yet) and get the assistance he needs sooner. You can be the best people at fighting for what your son needs, it's a necessary skill to have in the long run. Asking and caring about the best way shows you've already started on this journey.

      Being somewhat of an outsider does complicate some things, but it also offers you perspective and that may be more important for you and your son in the long run. So don't blame…

    • jordighApr 2015

      This is a quibble, but there are cases when the physics of the computer cannot be disregarded and must be considered. Two of my favourite examples are cosmic rays flipping bits [1] and printers jamming. [2]

      Regardless, I agree with his overall thesis: the machine is just a hunk of atoms with no meaning of its own. It is us who place a meaning on the machinations of the computer. Computer people have come to accept the abstractions of computer science as tangible and consider the abstractions of mathematics intangible. I think both abstractions are comparable. Both end up being interpreted and executed by humans and by computers, and it is merely the overwhelming prevalence of CS abstractions being executed by computers and mathematical abstractions being executed by humans that
      is causing this divide between the two tribes.

      There is much that computer scientists can learn from remembering that the machine is just a represantion of abstractions, just like mathematicians can benefit from remembering that occasionally the physics of the machine are relevant.

      ----

      [1] An entirealy reasonable explanation at times,

      http://lwn.net/Articles/219983/

      [2] http://nedbatchelder.com/blog/200811/print_this_file_your_printer_will_jam.html

    • MawrMay 2021

      The difference is that with exceptions sloppy code is the default.

      As you write code in a language with explicit errors, the language makes you acknowledge that the code you call can error out. This makes you stop and think what to do about the error. You can choose to ignore it, but that's a conscious decision that the language forces you to make.

      With exceptions, there's no such feedback mechanism from the language/compiler. In order to write robust code you yourself must have the discipline to add exception handlers around the appropriate calls.

      In short, defaults matter. It's simply easier to write correct, robust code when you don't have to go out of your way to do it.

      See https://devblogs.microsoft.com/oldnewthing/20050114-00/?p=36693:

      > It’s really hard to write good exception-based code since you have to check every single line of code (indeed, every sub-expression) and think about what exceptions it might raise and how your code will react to it.

      ... which leads us straight to favorite exceptions-caused bug: https://nedbatchelder.com//blog/202001/bug_915_solved.html:

      > Inside tempfile.NamedTemporaryFile, the error handling misses the possibility that _TemporaryFileWrapper will fail.

    • rogualMar 2025

      This is what I do, these days. Whenever I would previously have reached for X-macros or some other macro hack, I tend to use Cog [1] now instead.

      It's quite a clever design; you write Python to generate your C++ code and put it inside a comment. Then when you run the Cog tool on your source file, it writes the generated code directly into your C++ file right after your comment (and before a matching "end" comment).

      This is great because you don't need Cog itself to build your project, and your IDE still understands your C++ code. I've also got used to being able to see the results of my code generation, and going back to normal macros feels a bit like fiddling around in the dark now.

      [1] https://nedbatchelder.com/code/cog/

    • resc1440Nov 2015

      Mitsuhiko has written extensively about Py3 unicode problems, e.g. http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/

      I think a lot of it boils down to, sometimes you really really don't want to care about unicode. Linux filenames are one thorny issue - Linux thinks of them as strings of bytes, and a tool is broken if it can't also deal with them that way. Py3 makes it very difficult to do that correctly. There are also issues with stdin/out being opened as unicode vs byte streams.

      For web development, the "unicode sandwich" (http://nedbatchelder.com/text/unipain.html) works great in my experience. However, I can see his point that for some kinds of tasks, Py3 is unambiguously a downgrade.

    Related

    Nick Coghlancuriousefficiency.org28 people

    Languages to improve your Python

    Nick Coghlan
    Personal · last shared 2024
    Hynek Schlawackhynek.me83 people

    I’m a productive programmer with a memory of a fruit fly

    Hynek Schlawack
    Personal · last shared 2026
    Cory Benfieldlukasa.co.uk24 people

    Debugging Your Operating System: A Lesson in Memory Allocation

    Cory Benfield
    Personal · last shared 2021
    Armin Ronacherlucumr.pocoo.org417 people

    996

    Armin Ronacher
    Personal · last shared 2026
    Will McGuganwillmcgugan.com44 people

    Building Rich Terminal Dashboards

    Will McGugan
    Personal · last shared 2026
    Bite Codebitecode.dev54 people

    A year of uv: pros, cons, and should you migrate

    Bite Code
    Personal · last shared 2026
    Doug Hellmannpymotw.com16 people

    Python Module of the Week

    Doug Hellmann
    Personal · last shared 2024
    Cal Patersoncalpaterson.com102 people

    Firefox usage is down despite Mozilla's top exec pay going up

    Cal Paterson
    Personal · last shared 2026