The idea of putting an ancient Roman calendar in a terminal is oddly fun. How did you handle the weird month lengths?
The Ancient Roman Calendar in Your Python Terminal: A Love Letter to Useless Code
2 Comments
@[MightyMeta] Thanks — glad the idea landed! The weird month lengths were actually the fun part.
The key is that Roman dates aren't counted from the start of the month but backward from three fixed points: Kalendae (the 1st), Nonae (the 5th or 7th), and Idus (the 13th or 15th). Which pair applies depends on the month — March, May, July, and October get the later dates (7th/15th), everything else gets 5th/13th.
For lengths themselves I don't hardcode anything: calendar.monthrange(year, month) gives me the last day, so leap-February comes for free. The one genuinely fiddly case is February 29 — in the Roman system the leap day was inserted after Feb 24 (ante diem VI Kalendas Martias), so I handle days 25–29 with a small special branch that mimics the original bis sextum insertion rather than just doing arithmetic.
There are also a couple of ugly-but-necessary hacks on the input side (the parser sometimes misreads the year, and Feb 29 needs a default year). Not pretty, but as I said in the post — beautiful and useless is the whole point. And hey, at least I'm not counting days backward and inclusively and dealing with a calendar that got reformed every other Tuesday. The Romans would be proud — or possibly confused, which is basically the same thing.
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
More From nevmenandr
Related Jobs
- Full-stack Engineer 4 (Manager, IC - TypeScript/JavaScript, Python/Java | AWS Cloud Infra | Automated Frameworks)Capital One · Full time · Richmond, VA
- Python DeveloperBeacon Analytics · Full time · Japan
- Freelance AI Trainer - Civil Engineering & PythonMind Rift · Full time · Italian Republic