Some writing by Trek

& archive, twitter, github

Conceptual Diagram of Programming Languages I'm Using

by Trek on

There's a current discussion going on twitter between me, @swolchok, and a few others about my inability (after 9 months of daily use) to really understand a central design aesthetic to the Python language. This has mostly to do with how action happens in the language.

Sometimes you have a method call on an object (obj.method()), sometimes it's a global function with an object an as an argument (func(obj)), sometimes it's a module function with an object as an argument (module.func(obj)), sometimes it's a constructor with objects as arguments (MyClass(arg1, arg2)), sometimes it's special syntax like list comprehension ([3*x for [1,2,3] in vec if x > 3]).

That describes the how, which I'm fine with, but I've never gotten a clear picture of why. Constructors and comprehension have a special place in the language (although they could cover the same concept in a unified way), but between global functions, module function, and methods of objects I've never understood clearly when to use each and why.

I think, as a non-programmer, I just have a preference for symbolic reasoning syntaxes with smaller concept space: I prefer the combination of patterns to solve a problem over the creation of new patterns. I made a snarky little diagram to express this: [caption id="" align="alignnone" width="467" caption="erlang, ruby, python"]erlang, ruby, python[/caption]

This doesn't mean I don't like Python (I do). I'd just like it more if I could understand it cohesively; and I'm not the only one.

blog comments powered by Disqus