Skip to content Skip to sidebar Skip to footer
Showing posts with the label Coding Style

Adding Function To Sys.excepthook

Say I have something like this, which sends unhanded exceptions to logging.critical(): import sys … Read more Adding Function To Sys.excepthook

Are There Any 'gotchas' With This Python Pattern?

Here's the pattern I'm thinking of using: class Dicty(dict): def __init__(self): … Read more Are There Any 'gotchas' With This Python Pattern?

Pythonic Alternative To Dict-style Setter?

People tend to consider getters and setters un-Pythonic, prefering to use @property instead. I'… Read more Pythonic Alternative To Dict-style Setter?

Python: Is There Syntax-level Support For Unpacking, From Tuples, The Arguments To An *anonymous* Function?

Suppose we have the following: args = (4,7,5) def foo(a,b,c): return a*b%c Python conveniently all… Read more Python: Is There Syntax-level Support For Unpacking, From Tuples, The Arguments To An *anonymous* Function?

Accessing "module Scope" Vars

I'm currently learning Python, and I have to work on a Python 2.7 project. Accessing 'modul… Read more Accessing "module Scope" Vars

Is It A Good Practice To Add Names To __all__ Using A Decorator?

Is this a good practice in Python (from Active State Recipes -- Public Decorator)? import sys def … Read more Is It A Good Practice To Add Names To __all__ Using A Decorator?