Category Archives: Programming

Python naming – a broken style

The issue I take with the pythonic style of variable/method/object naming is that such a style conflicts with how the brain works. When you read, you don’t read letters, you read a block of squiggles that together represent words. When you read the word “dog”, your brain doesn’t concentrate on the d or the o or the g. It actually pattern matches on the combination of letters, the whole word. And what separates these blocks of squiggles are open areas between word patterns, namely, spaces. Spaces are the visual cues that your brain uses to separate word patterns. Now when you read the word dogfood, your brain initially identifies that this new pattern is a contraction of two patterns. But in future reading of that same pattern, dogfood, your brain will see that pattern as a single representational entity.

If you, on the other hand, were to divide those two patterns by a space
“dog food” your brain will continue to see them as two separate patterns. I hold that the underscore is an equivalent replacement for the space. That the variable name “dog_food” remains as TWO words. And that being two words your brain must do extra duty to identify this as a SINGLE thing.

DogFoodWithGravy — can be interpreted, by your brain, as a single entity.

dog_food_with_gravy — will ALWAYS be interpreted as four separate words that your brain must parse EVERY TIME you read it.

This, this is the primary reason that pythonic naming is a failed style.