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

Correct Style For Element-wise Operations On Lists Without Numpy (python)

I would like to operate on lists element by element without using numpy, for example, i want add([1… Read more Correct Style For Element-wise Operations On Lists Without Numpy (python)

Python: Unintentionally Modifying Parameters Passed Into A Function

A few times I accidentally modified the input to a function. Since Python has no constant reference… Read more Python: Unintentionally Modifying Parameters Passed Into A Function

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?

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

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?

Best Style For Iterating Over A Small Number Of Items In Python?

I was just reading a presentation on python and I noted that the author had missed out the round br… Read more Best Style For Iterating Over A Small Number Of Items In Python?