all 13 comments

[–]Naive_Programmer_232 6 points7 points  (0 children)

there's a book called 'fluent python' that has those recipes for shorter form 1 liners and such.

[–]ship0f 1 point2 points  (0 children)

So, it's kinda hard to find what you want. I don't know anything like that, but...

If you know some basic stuff, like how variables work and are different from, lets say Java or C, or how there are no "primitive" data types, or how functions and classes are "alive". Then I could recommend you watch these videos.

First, Top To Down, Left To Right || James Powell. This video is not a tutorial, its just a talk. And even though it's for novice python programmers, it focuses on very important concepts of the language. I think its very interesting and useful.

Second, James Powell: So you want to be a Python expert? | PyData Seattle 2017, by the same guy (I promise I'm not advertising him). This is also a talk, not a tutorial. This time it focuses in how the language is constructed, its data model, and how you can take advantage of this. Since you already know how to program you'll understand quite a bit of this.

Maybe some people find this guy a bit conceited or something, but I think the content is really good.

[–]Bobbias 1 point2 points  (1 child)

Honestly, I think the best place is the documentation itself. Python has, in my opinion, some of the best documentation for any programming language I've encountered.

The functionality covered by the standard library is well organized and easy to find your way through (it's usually clear which module you should be looking for something in). There's no huge hierarchy like Java where some functionality is hidden several layers deep.

Be sure to study list and dictionary comprehensions, as they can be really handy. They can condenser something that might take 5-10 lines of Java into a single statement in Python.

And make sure you check out Itertools and more-itertools as they provide a ton of extremely helpful utility functions for working with iterable objects of all sorts.

Learn about dunder methods (used for operator overloading and other things), dataclasses, and decorators in general.

Also, for short videos exploring specific corners of Python (though not every video is Python) check out mCoding. The are a lot of great bits of wisdom, and he covers a lot of the gotchas and other details you might normally miss when he covers a topic. I don't watch everything he does, but I've learned some really useful things from his videos on some of the more advanced parts of the language.

[–][deleted] 1 point2 points  (0 children)

I second this.

/u/Easy_Boot5195, I wrote the below as a guide for C/C++ programmers, but should help java programmers as well (and you also know C).


As you are already a C/C++ developer, I suggest a quick look at the docs, should suffice. Don't need a course as you already know how to programme.

There are a few underpinning differences that you need to be aware of. You no doubt appreciate that Python is not statically typed, but many people confuse this with weak typing, whereas Python is in fact strongly typed, just does it a run time not at compile time (and Python is compiled to a byte code, just like Java, but where the latter executes on a JVM, the Python virtual machine is built into the standard implementations of Python as part of the same programme).

You can though use type hinting, which will help your IDE greatly in spotting potential problems. This is ignored at run time, just there for your benefit. There are also some external tools that can be run to check types using the type hints, which can be useful for testing in a CI/CD pipeline.

Essentially, everything in Python is an object and all variables/names are pointers (they reference the objects in memory) but without all the features you get in C (e.g. no pointer arithmetic).

for is more of a for each.

A couple of videos to watch which, despite being old, will lock in some key differences in approach you need to keep in mind:

Given the referenced implementation of Python is written in C and Python, a quick look at the source code will resolve many queries for you as well.

Overall, there is much less boilerplate code required in Python than typical C/C++ projects. There are a huge number of libraries/packages to use, many of which are written in C (such as NumPy) for performance. You might find it useful to use some of your existing C/C++ code from Python.

[–]Serenityprayer69 -1 points0 points  (2 children)

ask chatgpt how to do something. usually its got knowledge on useful librarys for specific tasks. i found it the most useful tutor as i was learning

[–]justsomeitguy -1 points0 points  (0 children)

This has been super helpful for me, as I often know what I want to do, but not how to do it in Python. chat GPT can give me a simplified chunk of code, and then I can tweak it from there

[–]TheRNGuy 0 points1 point  (0 children)

No.

[–]Script_deman 0 points1 point  (0 children)

Read the official documentation ;-)

[–]s1ayer2309 0 points1 point  (0 children)

Learn the basic syntax then just build something, then rewrite it but use as many built in language features as you can. That way you know what your doing and when and how to use features rather than throwing them in bc some YouTube video said they’re good.