Go for Python Developers
Transfer your Python experience to Go: typed values, control flow, slices, functions, methods, interfaces and error handling. Build a tested multi-file order pipeline.
Python and Go side by side
The same program in Python and in Go, from the lessons of this course.
Files and the first run
Python executes module statements in order. Go compiles a package and starts at main; functions in sibling files share that package without importing file names.
Python1print("Python", 3)Go1package main2import ("fmt")3 4func main(){fmt.Println("Go", 3)}If and scoped names
Python uses indentation for blocks and an if block does not create a local scope. Go uses braces; variables declared in an if initializer are scoped to its branches.
Python1n = len("go")2if n > 1:3 print("long")4else:5 print("short")Go1package main2import ("fmt")3 4func main(){if n := len("go"); n > 1 { fmt.Println("long") } else { fmt.Println("short") }}Arrays are values
Python lists are reference-based resizable collections; an explicit shallow copy separates their outer storage. Go fixed arrays copy on assignment and their length is part of the type. A slice has different sharing behavior.
Python1a = [3, 5]2b = a.copy()3b[0] = 94print(a[0], b[0])Go1package main2import ("fmt")3 4func main(){a:=[2]int{3,5}5b:=a6b[0]=97fmt.Println(a[0],b[0])}Typed function contracts
Python function parameters are dynamically typed unless external checks enforce annotations. Go parameter and result types are compile-time contracts. Go has no default arguments or overloads, so use explicit parameters or separate names.
Python1def is_even(n):2 return n % 2 == 03print(is_even(6))Go1package main2import ("fmt")3func IsEven(n int) bool { return n%2==0 }4func main(){fmt.Println(IsEven(6))}Struct values
Python class instances normally share identity when assigned; dataclasses do not change assignment semantics. Go struct assignment copies fields. Referenced storage inside pointer, map or slice fields can still be shared after that copy.
Python1from dataclasses import dataclass, replace2@dataclass3class Label:4 text: str5a = Label("old")6b = replace(a)7b.text = "new"8print(a.text, b.text)Go1package main2import ("fmt")3type Label struct { Text string }4func main(){a:=Label{Text:"old"}5b:=a6b.Text="new"7fmt.Println(a.Text,b.Text)}Errors are returned values
Python commonly signals invalid data with exceptions. Go normally returns an error value alongside the result and checks it explicitly. Do not translate ordinary Python try/except into panic/recover; reserve panic for exceptional failures.
Python1def positive(n):2 if n <= 0:3 raise ValueError("not positive")4 return n5try:6 positive(-2)7except ValueError:8 print("rejected")Go1package main2import ("fmt";"errors")3func Positive(n int)(int,error) { if n<=0{return 0,errors.New("not positive")};return n,nil }4func main(){_,e:=Positive(-2)5fmt.Println(e!=nil)}
Syllabus
9 chapters48 lessons1 project48 challenges99 quiz questionsValues and expressions
7 lessonsControl flow
5 lessonsCollections
6 lessonsFunctions and pointers
6 lessonsTypes and behavior
8 lessonsErrors and organization
6 lessonsText and absence
4 lessonsOrder pipeline
Project4 lessonsFinal challenges
2 lessonsFrequently asked questions
Who is Go for Python Developers for?
For people who already write Python and want to learn Go. Each lesson starts from Python you know and shows how Go does the same thing, so you skip the beginner basics.
Do I need to know Go already?
No. The course starts with your first Go program. You need Python basics: variables, conditions, loops, functions and collections.
How many lessons does Go for Python Developers have?
Go for Python Developers contains 48 interactive lessons you can complete at your own pace.
What does Go for Python Developers cover?
The course is organized into chapters covering: Values and expressions, Control flow, Collections, Functions and pointers, and more.
Is Go for Python Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.