Python and micropayments
13th March 2003
Fredrik Lundh has started posting his book The Standard Python Library online, in response to O’Reilly’s decision not to publish a second edition of the book. I’d never read it before, but having sampled the first two chapters I’m hooked. It works a bit like a “cookbook”, with a plethora of code samples explained in detail accompanied by tips and tricks relating to the language. The Lazy Import class, which loads a module only when an attribute of the module is called for the first time, is a classic example:
class LazyImport: def __init__(self, module_name): self.module_name = module_name self.module = None def __getattr__(self, name): if self.module is None: self.module = __import__(self.module_name) return getattr(self.module, name) string = LazyImport("string") print string.lowercase
Frederick plans to release a chapter every Friday until the whole book has been posted. Alernatively, you can buy the whole 1999 edition from him as a PDF file for the princely sum of $5.00, which works out at £3.18 in GBP via PayPal.
I think that was my first ever micropayment.
More recent articles
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024