web | https://www.b-list.org/ |
---|---|
Author | James Bennett |
Dec. 17, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Being methodical about Python Python classes support three basic types of methods: Instance methods, which are what you get by default when writing a def statement inside a class body. These are … Read full entry
Read MoreDec. 17, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. An URL-y warning Suppose you’re writing a blog in Django, and you get to the point where you’re setting up the URLs for the entries. Django has two ways to write … Read full entry
Read MoreDec. 15, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. A lurking problem Imagine you write a Python library named, say, foo. And you diligently set up the configuration to package it for distribution (which is not that hard; you can … Read full entry
Read MoreDec. 15, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Functionally a database On top of the basic query syntax we’re all used to, SQL databases tend to have a large number of built-in functions — some of which are standardized, some … Read full entry
Read MoreDec. 14, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. A view to a database Most databases support creating and working with views, which, if you’ve never encountered them before, are like a virtual table — instead of being defined by … Read full entry
Read MoreDec. 13, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Inheritance and its discontents People can, and do, debate whether inheritance in object-oriented programming languages is a thing that ought to exist. There are even debates about what “inheritance” ought to mean … Read full entry
Read MoreDec. 12, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Let’s have an argument Suppose you write a function like this: def divide(dividend, divisor): """ Divide ``dividend`` by ``divisor`` and return the result. """ return dividend … Read full entry
Read MoreDec. 10, 2023 » James Bennett » [Archived Version]
This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction. Consider a docstring Suppose you’re writing a Python function and, as you’re supposed to do, you give it a docstring, and you even provide some examples of how the function is supposed … Read full entry
Read MoreOct. 20, 2023 » James Bennett » [Archived Version]
There is no single development, in either technology or management technique, which by itself promises even a single order-of-magnitude improvement within a decade in productivity, in reliability, in simplicity. If “The Mythical Man-Month” — or at least the popular distillation of it into a single pithy saying — is the most famous thing the late Fred Brooks ever wrote, then “No Silver Bullet”, the essay quoted above, must surely be the most infamous, o…
Read MoreDec. 19, 2022 » James Bennett » [Archived Version]
This is the second in a series of posts I intend to write about how to build, deploy, and manage Python applications in as boring a way as possible. In the first post in the series I gave a definition of what I mean by “boring”, and it’s worth revisiting: I don’t mean “reliable” or “bug-free” or “no incidents”. While there is some overlap, and some of the things I’ll be recommending can help to reduce … Read full entry
Read More