Live data from Hacker News

Why People Should Learn Python

iluxonchik.github.io

1–10 of 329 posts

Re: Why People Should Learn Python

#2
Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language.

Don't get me wrong: I like Python and know it's truly good, but __why__??

Re: Why People Should Learn Python

#3
Why is a beginner's introduction to one of the common scripting languages at the top of HN?

Most everyone here should know at least one of the usual suspects (Ruby, Perl, Python, etc). They are all quite similar in capabilities.

Is introduction to loops at the top, in an hour?

Edit: The few newbies here which don't know a scripting language are hardly the ones voting this up...

Edit 2: BanzaiTokyo is free to explain the glaring superiority of one of the scripting languages over others...? :-)

Edit 3: erelde, so you really think a beginner's guide to a scripting language "gratifies [HN reader's] intellectual curiosity" enough to be top of HN...?

Re: Why People Should Learn Python

#4
A new & free introduction to Python from Jake VanderPlas can be gotten here:

http://www.oreilly.com/programming/free/a-whirlwind-tour-of-...

I was looking for a dense & concise guide to the language, but one of the most popular books "Learning Python 5e" by Lutz was too long @ 1600 pages.

Re: Why People Should Learn Python

#5
post #2

Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language. Don't get me wrong: I like Python and know it's truly good, but __why__??

So people don't call it directly Defense mechanism of sorts

Re: Why People Should Learn Python

#6
post #3

Why is a beginner's introduction to one of the common scripting languages at the top of HN? Most everyone here should know at least one of the usual suspects (Ruby, Perl, Python, etc). They are all quite similar in capabilities. Is introduction to loops at the top, in an hour? Edit: The few newbies here which don't know a scripting language are hardly the ones voting this up... Edit 2: BanzaiTokyo is free to explain…

>Why is a beginner's introduction to one of the common scripting languages at the top of HN?

I think there might be more non-programmers here than you think. Also, those who do program may have friends who don't and they may find the article interesting as something they can refer those friends to.

Re: Why People Should Learn Python

#7
post #2

Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language. Don't get me wrong: I like Python and know it's truly good, but __why__??

[deleted]

Re: Why People Should Learn Python

#8
post #2

Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language. Don't get me wrong: I like Python and know it's truly good, but __why__??

It is a convention for protocols. There are others you see __len__, __eq__, __new__, __str__ and so on. It did seem odd at first (I learned, C, Java, C++) first. But then after a while saw how it fits in a consistent way in the language. Make many things simpler, fits with duck-typing, fits with how classes are constructed, and so on. Visually it stands out right away, you so you know by looking these are special methods (say instead of being called "init", "eq" or "new")

Felt the same way about "self" argument. But then now I really like it and see it as a very nice idea.

Re: Why People Should Learn Python

#10
post #2

Now that I have a chance to ask: I've always found the def __init__ method with 4 (!) underscores one of the ugliest things I've seen in a programming language. Don't get me wrong: I like Python and know it's truly good, but __why__??

"The use of double underscores to indicate "magic" words goes at least as far back as the C preprocessor, which used that convention starting in the 1970s (e.g., __FILE__, __LINE__). It did so because there were no symbols that were off-limits to the preprocessor, so a rarely-used naming pattern (multiple underscores and upper case words) virtually ensured a lack of conflicts."

http://programmers.stackexchange.com/a/228340/84451

Post reply on HN