265 posts

TIL: Python Exception Handling with raise from

TIL 2020-08-06 Python’s raise statement has a from clause - This preserves full tracebacks when re-raising exceptions, providing better debugging information. The Python raise statement documentation - Official documentation covering all forms of the raise statement including exception chaining.

August 6, 2020 · 1 min

TIL: Python Raise Statement and Traceback Preservation

Python Exception Handling Python’s Raise Statement with From Clause Python’s raise statement has a from clause, to preserve full tracebacks The Python raise statement Critical for maintaining debugging information when re-raising exceptions Preserves the original exception context and traceback chain Exception Chaining Syntax Basic Exception Chaining 1 2 3 4 5 6 try: # Some operation that might fail risky_operation() except SomeException as e: # Re-raise with context preserved raise NewException("Custom message") from e Benefits of Exception Chaining Full Traceback Preservation: Maintains complete error history Better Debugging: Shows both original and current exception contexts Clear Error Propagation: Makes it obvious how errors propagated through code Professional Error Handling: Industry best practice for exception management Exception Handling Best Practices When to Use Exception Chaining Converting between exception types (e.g., library exceptions to domain exceptions) Adding context to low-level errors Creating more meaningful error messages for users Maintaining debugging information in complex call stacks Exception Suppression 1 2 # Suppress original exception (use sparingly) raise NewException("Message") from None Debugging Benefits Helps identify root cause of complex errors Provides complete context for error investigation Essential for production debugging and error monitoring Improves error reporting and logging quality

August 6, 2020 · 1 min

TIL: Python's raise from Statement, Grub Customization, Liquorix Kernel, and Hardware Benchmarking

Today I learned about Python's raise from clause for exception chaining, customizing the Grub bootloader, the Liquorix kernel for desktop performance, and comprehensive hardware benchmarking with Phoronix Test Suite.

August 5, 2020 · 6 min

TIL: EC2 Free Tier, Juju Configuration Management, and Python Charms

TIL 2020-08-02 EC2 Free Tier - EC2 has a Free tier! You can request a bunch of machines to experiment with cloud infrastructure. Juju Configuration Management - Juju is a tool that helps manage server providers, whether they are GCP, AWS, your own servers or Azure, among others, giving you one unified way to start, setup and run your servers. Juju Charms - Juju’s configurations are called charms, and these are written in Python. ...

August 2, 2020 · 1 min

TIL: Linux Kernel 5.8 and Grub Multi-Kernel Boot

Linux System Administration Linux Kernel 5.8 Features Linux Kernel 5.8 has a lot of hardware level optimizations Significant improvements in hardware support and performance Better power management and efficiency Enhanced driver support for newer hardware Performance improvements across various subsystems Multi-Kernel Installation and Management You can install more than one kernel into a Linux installation and choose which to boot from in Grub Enables testing newer kernels while keeping stable fallback options Useful for development, testing, and troubleshooting Grub bootloader provides menu for kernel selection at boot time Benefits of Multi-Kernel Setup System Stability Ability to rollback to previous kernel if new version causes issues Critical for production systems and development environments Reduces risk when updating system components Development and Testing Test new kernel features without losing stable system Compare performance between kernel versions Debug kernel-specific issues by switching between versions Recovery Options Broken kernel update doesn’t render system unbootable Always have working kernel available for system recovery Essential for maintaining system uptime and reliability

August 2, 2020 · 1 min

TIL: Python Collections, Git Commands, and Node.js Process

TIL 2020-08-01 Python collections.defaultdict - Takes a type not a value. It will initialize based on the default value for that type. Git Last Commit ID - git log --format="%H" -n 1 | cat outputs the last commit ID. Node.js Command Line Arguments - Node.js uses the process object to access command line arguments.

August 1, 2020 · 1 min

TIL: Python Collections, Git Commands, Juju, and EC2

Python Programming Collections Module - defaultdict collections.defaultdict takes a type not a value It will initialize based on the default value for that type Common mistake: passing a value instead of a callable type Example: defaultdict(list) not defaultdict([]) Cleaner than manually checking if keys exist before accessing Version Control Git Commands and Tricks git log --format="%H" -n 1 | cat outputs the last commit ID Useful for scripting and automation The cat ensures the output is properly formatted %H format specifier gives the full commit hash -n 1 limits to the most recent commit Cloud Infrastructure and DevOps AWS EC2 Free Tier EC2 has a Free tier! I can request a bunch of machines here Great for learning and experimenting with cloud infrastructure Limited resources but sufficient for development and testing Good entry point for understanding cloud computing concepts Juju - Multi-Cloud Orchestration Juju is a tool that helps manage server providers, whether they are GCP, AWS, your own servers or Azure, among others Gives you one way to start, setup and run your servers across different cloud providers Abstracts away cloud provider differences Enables consistent deployment across hybrid and multi-cloud environments Juju Configuration System Juju’s configurations are called charms These are written in Python Charms define how services should be deployed and configured Reusable deployment patterns for common software stacks Community-maintained charm store with pre-built configurations

August 1, 2020 · 2 min

TIL: Docker Networking Deep Dive, Julia Evans' Systems Knowledge, and Kubernetes from the Ground Up

Today I learned about Docker graph drivers and container networking, Julia Evans' excellent systems programming explanations, and comprehensive Kubernetes architecture through Kamal Marhubi's ground-up approach.

July 30, 2020 · 7 min

TIL: Linux Productivity Tools and Rust Ownership Concepts

Today I learned about Linux productivity enhancements including volume control in xmonad, mouse gestures with Fusuma, and fundamental Rust ownership principles.

July 28, 2020 · 8 min

TIL: Programming Challenges, System Tools, and Learning Resources

Today I learned about Advent of Code programming challenges, GPU hash tables, Python gotchas, Rust concurrent data structures, and various development tools and learning resources.

July 27, 2020 · 15 min

Subscribe to Newsletter

Get the latest posts and insights delivered to your inbox.

Built using Picoletter.