Hacker News new | ask | show | jobs
by esaym 4156 days ago
I can't stand the '.' syntax. Someone that doesn't know python would have no idea if those are method calls or what.

And in both cases, that is terrible code. Use a class or something...goodness.

1 comments

>I can't stand the '.' syntax. Someone that doesn't know python would have no idea if those are method calls or what.

How is what someone who DOESN'T know Python would think relevant?

That said, after even the smallest familiarity with the language, he sees that it's obviously not method calls unless it ends in ().

Someone who doesn't know Lisp also doesn't know what (foo 4 2) or (quote foo 4 2) is.

I'm going to disagree with you: as someone who has worked in an extensive Python codebase, based on the snippet above, I have zero clue what is actually going on. Those could just be attributes in the object, or they could be properties with arbitrarily complex code to calculate the resulting object. It could be the same object, or a freshly-allocated object, or an object that exists already. The index operator could be on a list, dictionary, or custom class with, again, arbitrarily complex code. All of that code could even be written in pure C for all I know! That single line of code could be a rats nest of a thousand lines of Python, or C, or both. And that's not even getting started with the possibility of metaprogramming or creating new classes by wrapping an existing class at runtime.

Saying that the snippet is obviously not using method calls is naive. Python is too flexible and allows programmers to do too many clever things for that, all hidden under "nice" syntax.

EDIT: Forgot a case for what that code could be doing: it could be accessing a module with globals.

>How is what someone who DOESN'T know Python would think relevant?

Because most of the people that complain about Perl don't know it either.

I have no problem reading perl code of any kind (because I know it). Perl is a beautiful language IMHO.