Is learning Godot a good way to learn Python?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By doncic41

Hi!
I want to learn Python. I know Godot is not pure python, but could it be a good way to learn Python? What are the difference between GDScript and Python?

:bust_in_silhouette: Reply From: kidscancode

Superficially, Python and GDScript appear similar. GDScript’s syntax is based on Python’s after all. However, I wouldn’t recommend Godot as a way to learn Python.

The main difference between the two is that while Python is a general purpose language which can be used for just about any type of project, GDScript is a “domain specific” language for use in a particular development environment (Godot). This means the language is very tightly integrated into Godot and a lot of what you use it for only applies to Godot. You can’t really use it without also understanding how the rest of Godot works.

As a teacher who has students using both Python and Godot, I would highly recommend starting with Python in the first place, especially if your goal is to learn Python. There are a huge number of Python resources out there - books, videos, courses, etc. - to get started with. It’s a much more manageable task to learn programming in Python than to learn programming PLUS game development in Godot.

I’m in kinda similar place as OP is, and as contrargument I can say one thing.
In enviroment like Godot it’s is more straight forward goal-wise.
You want to move your RigidBody.
You want to change colour of Sprite.
You want to make a pop-up button.

It just feels right to give yourself a challenge and do it. GDScript narrowness is IMO it’s advantage in this field, becouse broad use of Python can make it hard to set a specific goal.
And built-in Godot functions, still Python-like, can give good insight into Python programming and how things work.

Kaizu | 2018-12-18 23:14

Thanks for the reply. I should have been more specific when I asked. I sort of know the Python syntax, or at least I can read it, but I have not written a lot of it since I don’t have any projects in Python yet. So I don’t have it my hands yet. My fear is that I will start to write bad code that will not transfer to Python later on. Do you think that will be an issue?

doncic41 | 2018-12-19 17:24

First of all, if you’re a beginner you’re going to write bad code. That’s part of learning, just accept it and don’t feel bad about it. :slight_smile:

You asked specifically about learning Python. If that’s your goal, then using Godot could very well sidetrack you from that as you go down the rabbit hole of learning animation or 3D modeling or any of a dozen other things that have little to do with writing Python code. If Python is your goal, then focus on it.

kidscancode | 2018-12-19 21:00

In enviroment like Godot it’s is more straight forward goal-wise.

This is not true at all given the OP’s actual question. Their goal is to learn Python. They didn’t even indicate desiring general programming learning. Nothing about Godot’s node, physics, or UI systms are going to help you with that specific goal.

kidscancode | 2018-12-19 21:03

:bust_in_silhouette: Reply From: Charlie

I would respectfully disagree with the No answer provided. Yes, you’ll be learning a lot of Godot interface stuff that isn’t directly Python. But that would be true in other applications too (if you’re using Python to interface with an astronomy simulator, well, you’re going to learn about orbital elements…). Having used PERL, Python and C++ professionally, and Lua and GDScript for hobby programming, I would say that the important lessons are in the logic of programming, not in specific syntax differences (which are superficial).

Full disclosure: My WORST grade as an undergrad was in a programming class. 12 years later I was hired as professor in large part for bioinformatic studies for which I did my own coding. But maybe you should ignore my advice if you’re just trying to get a good grade.

Thanks for the reply. I find it weird that you got some downvotes without anyone replying back to you.

I should have been more specific when I asked. I sort of know the Python syntax, or at least I can read it, but I have not written a lot of it since I don’t have any projects in Python yet. So I don’t have it my hands yet. My fear is that I will start to write bad code that will not transfer to Python later on. Do you think that will be an issue?

doncic41 | 2018-12-19 17:27

If I program in one language for a few days, then it might take me an hour so so to get back in the groove of another language, and I might momentarily forget some syntax difference. For example, although GDScript looks more like Python than Lua, it allows an optional syntax for dictionary construction that is from Lua. If you learn that syntax while coding GDScript, well, you might try it when scripting Python and loose a couple seconds trying to figure out what you did wrong.

So if you mean “bad code” as in “I can’t paste my GDScript directly into a Python editor”, well, yes. Although I’ve done exactly this for some code snippets with only minor changes. If you mean “bad code” as in poor logic or poor programming practice, I don’t think so.

I agree with the comment above that Godot might provide you a better goal-oriented learning environment than you can find elsewhere. Whatever it is that gets you to code is what will make you a better coder.

Charlie | 2018-12-19 19:23