Paul Ganssle
·
2023-01-04T11:14:28-05:00
In tort law, there is a doctrine called attractive nuisance, where a property owner can be held liable for injuries that happen to children if the injury was caused by something on the property that is likely to attract...
Paul Ganssle
·
2022-04-05T12:06:20-04:00
Back in 2019, I exhorted everyone to stop using datetime.utcnow() and datetime.utcfromtimestamp() because as of Python 3, naïve datetimes stopped representing abstract calendar dates and started representing the current...
Paul Ganssle
·
2021-12-13T11:50:45-05:00
In previous posts, I've extolled the virtues of xfail, and showed how I incorporate it into my workflow, but in this post, I'd like to point out a downside of heavy use of xfail: it can artificially inflate your code cov...
Paul Ganssle
·
2021-11-22T04:21:19-05:00
After coming to the conclusion that xfail is a good thing, I've also started to occasionally integrate it into my workflow to get some of the benefits of test driven development without needing any sort of discipline or...
Paul Ganssle
·
2021-11-09T06:47:00-05:00
Although I was initially skeptical, several years ago I was convinced that xfail is a quite useful tool for managing an evolving codebase. I was first convinced as a result of J. Brock Mendel's[1] suggestion to add an xf...
Paul Ganssle
·
2021-11-13T09:11:26-05:00
TL;DR: The setuptools team no longer wants to be in the business of providing a command line interface and is actively working to become just a library for building packages. What you should do instead depends on your us...
Paul Ganssle
·
2021-10-12T09:36:28-04:00
Some time ago, I was introduced to the idea of Regular numbers (also called a Hamming number), which is the set of all numbers which can be expressed by the equation 2n × 3m × 5k. Generating these numbers is harder than...
Paul Ganssle
·
2020-04-28T12:15:24-04:00
I recently made an ill-advised post on Twitter, wherein I implied that I had a deeply-considered opinion by suggesting that more people should be using the pytest-subtests package, even going so far as to state that &quo...
Paul Ganssle
·
2019-12-30T12:14:21-05:00
I recently created a utility for backing up file system metadata called metadata-backup, which is my first project to make use of Gitlab's CI/CD offering. It was pretty easy to set up, but I was shocked to find that by d...
Paul Ganssle
·
2019-11-15T16:14:39-05:00
I had always been under the impression that since strings are immutable in Python, it would be inefficient to build a string incrementally with + or +=; I assumed that each concatenation would require the allocation of a...
Paul Ganssle
·
2022-10-09T10:32:18-04:00
If you are the kind of developer who prefers to work in UTC, you may have seen Python's datetime.utcnow() and datetime.utcfromtimestamp() methods and thought, "Ah, yes, this is what I should do to work in UTC!"...
Paul Ganssle
·
2019-08-23T13:30:00-04:00
For small projects and projects you only intend to run on your local computer, it is often convenient that Python searches the local directory for modules to import, but once your project grows to the point where you wan...
Paul Ganssle
·
2018-06-13T11:32:03-04:00
Recently we added a feature to dateutil (issue #635, PR #672) that involves holding a cache of weak references to objects so that only values that would otherwise still be alive remain in the cache. This is useful for wh...
Paul Ganssle
·
2020-04-01T14:08:00-04:00
Whenever I give a talk about time zones, someone comes up to me afterwards and tells me that they have broken code currently in production, because they misunderstood how pytz works. This is because pytz uses its own non...
Paul Ganssle
·
2020-06-23T14:25:33-04:00
One of the most frequent items on my list of reasons why one can't "just use UTC" in all situations is that frequently you need "wall time" semantics – i.e., the property you care about is the relatio...