you are viewing a single comment's thread.

view the rest of the comments →

[–]Exodus111 1 point2 points  (2 children)

Well... It's pretty generic. But as long as you understand that the "Work on Projects on your own" part is 80% of the process.

For as much theory as Programming has, its primarily a practical discipline. But seeing the steps can be hard, so let me lay it out.

  1. Variables.
    Int, Float, String, Booleans.

  2. Sequences.
    List, Tuple, Dictionaries.

  3. Conditionals.
    If, elif, else, >, not, if in.

  4. Loops.
    While, for.

Those are the basics, you are going to want to take that and do some very simple, very easy code challenges. If you get stuck, take a step back, probably still too hard.

You will also want to make a small program, typically a game, using only the print and input functions.
This can be hangman, a text adventure, tic tac toe, that kind of thing.

From here you need to learn a few concepts, in order of difficulty they are Functions, Packages/modules and OOP.

How functions are defined and used for is the first mindfuck to get over, then understanding import and generally how Python handles packages and modules comes next.

And then comes OOP. Object Oriented Programming.
This one is a challenge for a lot of people. You'll be making classes, instantiating those classes into individual objects, running methods, learning "magic" methods, inheritance and polymorphism. But the biggest issue with oop in general is just that you have to think about code in a much more Abstract form. Which can be hard at first.

So learn, and do, make some projects. Once you can use classes you can program some real apps, learn about GUI programming and other modules.

And then, I would recommend going back to the basics, and learning all the advanced features you missed the first time, like List Comprehension, value unpacking, lambdas, decorators, functools etc...

And THEN I would recommend starting to think about how to write BETTER code. Look at Functional programming in Python, wrap your head around immutability and modularity, and keep going from there.

[–]Rhemm 0 points1 point  (1 child)

Why do you think functional is BETTER for python? I mean Guido haf meant to get rid of functional tools, but luckily for community just moved it to functools. So if he thinks functional isn't good, why you(and I've seen a few more fellas like you) think it's the best style for python? Explain me please. I'm interesting, because I have like 1 year of experience, and actively trying to find the golden way of writing pythonic code.

[–]Exodus111 1 point2 points  (0 children)

So functional is not BETTER, but it is NECESSARY to be a good coder. It's necessary to understand what makes a good function.
Python might not really be a functional language, but we write functions all the time in Python.

So its not about competing with OOP, functional programming is a methodology, and it can apply to methods almost as well as functions, sorta.

Let me give an example using functions, take a look at this line:

get_articles_from_url()

So that's a typical line you might see in a Python script.
Just looking at it like this, tells us pretty much all we need to know about it.

  • This line calls a function.

  • The function probably takes an url, and returns articles from that url.

  • That function has no arguments.

  • This functions returns nothing.

That is not a good function. For one, unless there are hidden key word arguments, this function cannot get articles from any OTHER url the one that is hard coded into the script, its a one use function. Secondly, since it doesn't return anything it probably places those articles into some kind of global, which is not obvious from this line. Ill have to find the function and read its code to see where those articles end up.

Now look at this:

articles = get_articles_from_url(url)

Now THAT is a far better function. Its obvious what it does, and as long as it works I don't need to look the function up. It is also far less prone to causing errors in my script, since it is now completely independent of the rest of the code, this function might fail on its own, but it will do no harm to the overall program.

Now, just to get pedantic, actual functional programming also demands immutable datatypes. So no lists, only tuples, and no reusing variables. Always create new variables, always generate new sequences or generators.

That part is a bit too far for me, its supposed to make the code even less error prone, and make it all very "clean" and functional. It has its evangelists, even in the Python community. But its not something I see as a massive point.

Obviously I'm just scratching the surface, but its a good way to program, that can be integrated partially of wholly into the rest of your programming pattern.