Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm learning Python as part of a data science class and not for building web apps.

This article mentions a-ha moments in relation to Python conditionals. What is so special about Python conditionals? They seem pretty ordinary to me.



Imagine that you're learning your first programming language. You don't read Hacker News, and you can't imagine why having curly braces on a keyboard is more useful than a snowman character. Then, getting a working conditional statement might be a revelation.

I still remember the first program I ever wrote. It was about 15 years ago, and all it did was convert a Celsius temperature to Fahrenheit in C. It was thrilling, and I don't think it even included a conditional!


If that first language is python you may get quite a long way before you see any reason why having curly braces on a keyboard is more useful than a snowman character :)


Dictionaries rule.


For me, the big aha moment with Python specifically was grokking list comprehensions. That was a great day.


Also related, the whole generator/iterator pattern, and how by designing your logic into the right kind of objects, you can create extremely elegant interfaces.


could you point out some resources for the same?


True. The moment you realize you rarely ever need a classical for cycle -- for (i=0;i<100;i++) -- is truly a Aha moment.


I think understanding conditionals lies somewhere between "well how do I use this stuff?" to "Eureka!"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: