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

How Do I Avoid Users Of My Code Having To Type Redundant Import Lines?

So I have a project called 'Pants' that lives on GitHub.com. Originally the project was a … Read more How Do I Avoid Users Of My Code Having To Type Redundant Import Lines?

Python Print Out Float Or Integer

How can i print out float if the result have decimal or print out integer if the result have no dec… Read more Python Print Out Float Or Integer

Tool To Enforce Python Code Style/standards

I'm trying to find a tool to check for coding style in python. For PHP I've seen there is t… Read more Tool To Enforce Python Code Style/standards

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?

File Open: Is This Bad Python Style?

To read contents of a file: data = open(filename, 'r').read() The open file immediately st… Read more File Open: Is This Bad Python Style?

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?