I started with Python, but couldn't wrap my head around what it was actually doing for many of the code snippets and examples I was looking through while I was learning. On top of that, there were 23 ways to write the same expression with 16 standard library choices you could use. After a month or so of frustration, I quit programming for about a year.
Then, I tried to learn Java. The amazing thing was, there was little magical syntactical sugar (compared to Python), and so I could actually read and comprehend code. The JVM was confusing, but as an introductory language, having conventional long variable names and descriptive methods was really helpful.
I know this isn't everyone's experience, and in fact it's the opposite of many people's, but Python was way too "wishy-washy" when I was starting. Now, though, I love it.
(P.S. this was my experience based on the way I learn things, and your results may [have] differ[ed].)
(P.P.S. I learned to code back in the day with codingbat.com. If you're just getting started, it has the most basic of the basic, no-frills tutorials. Even CodeCademy or similar has a bunch of extra stuff, that may be helpful, or may not.)
Every time I've asked about how to pre-allocate some space in a dictionary where I know the exact keys I want to have, I've always gotten the answer of "don't worry about it" or "stop trying to prematurely optimize your code". In any other programming language, this would just be a part of the process of writing the code. I really do want to learn Python better (I've done some work on Python projects without really knowing what I'm doing, just winging it), but it's not something that I can just stop caring about.
In any other programming language, this would just be a part of the process of writing the code.
Not really. In low level-languages you can do that, and often mus do it. But it's not neccessary for getting things rolling. Usually it's just pointless overhead. It becomes important later if you wanna optimize your code, after you have a working solution.
Python in the first place is a goal-orientated language. Optimization comes later. And in best case it's done automatically from the machine. Though, that best case it still in progress for python.
And I would add, when you do get down to optimization, forget (or at least attenuate) everything you know about performance from other languages. Especially when it comes to dicts.
Like, you used to hear that one should avoid hash maps if at all possible for performance reasons. This is terrible advice in Python.
83
u/Pancakepalpatine Jan 05 '18
I actually did this exact same thing.
I started with Python, but couldn't wrap my head around what it was actually doing for many of the code snippets and examples I was looking through while I was learning. On top of that, there were 23 ways to write the same expression with 16 standard library choices you could use. After a month or so of frustration, I quit programming for about a year.
Then, I tried to learn Java. The amazing thing was, there was little magical syntactical sugar (compared to Python), and so I could actually read and comprehend code. The JVM was confusing, but as an introductory language, having conventional long variable names and descriptive methods was really helpful.
I know this isn't everyone's experience, and in fact it's the opposite of many people's, but Python was way too "wishy-washy" when I was starting. Now, though, I love it.
(P.S. this was my experience based on the way I learn things, and your results may [have] differ[ed].)
(P.P.S. I learned to code back in the day with codingbat.com. If you're just getting started, it has the most basic of the basic, no-frills tutorials. Even CodeCademy or similar has a bunch of extra stuff, that may be helpful, or may not.)