News for hackers. Stuff that matters.
Re:Python has brought computer programming to a vast new aud... by danso on Thursday July 19, 2018 @06:12PM (#17570792)
> whereas a more idiomatic approach is imho a better way to go.

I don't know what you mean by "idiomatic approach". That phrase, I thought, refers to languages that are highly opinionated about using a specific style -- this philosophy is encoded in Python's philosophy:

https://www.python.org/dev/peps/pep-0020/

There should be one-- and preferably only one --obvious way to do it.

> Pretty much every popular OOP language does it either by naming a constructor the same name as the class name or through some form of a `construct` notation

Seems kind of arbitrary to complain about the constructor keyword `__init__` when the constructor word for pre-ES6 JS, C, Perl, Ruby varies between prototype, constructor, __construct(), and new. Not sure how you say Python's use of `__init__` is somehow worse. As for why `self`, no idea, but seems to be a pretty easy convention to figure out.

As for the complaint about the `if __name__ == '__main__':`, to which language are you referring to that has a more self-evident way of encapsulating that functionality?

Re:Python has brought computer programming to a vast new aud... by andreygrehov on Thursday July 19, 2018 @07:23PM (#17571229)
I'm not talking about highly opinionated languages, but common idioms across OOP languages.

C doesn't have classes. pre-ES6 - agreed, but who writes it? I think Perl is a bad example, it's dying and is one of those highly opinionated guys, with all its `method`, `trusts`, etc.

> As for the complaint about the `if __name__ == '__main__':`, to which language are you referring to that has a more self-evident way of encapsulating that functionality?

My gut tells me that this is an error-prone idiom.

I'm not saying Python is bad, I just don't like it. I'd love to know what are the strongest sides of the language though?