Python Refresher for Returning Coders
Catch up on modern Python quickly if you coded years ago or come from another language.
A taste of a lesson
I mostly write JavaScript. What Python habits will bite me first?
Three come up quickly. First, truthiness differs: an empty list or empty dict is falsy in Python, while in JavaScript an empty array is truthy, so if items: means the list is non empty. Second, dicts are not objects: use d['key'], not d.key. Third, a default argument like def f(acc=[]) is created once and shared across calls, unlike JavaScript defaults, which are evaluated each call. Quick test: what does bool([]) return in Python?
Written with AI under Skill Lab's direction as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong. Right now the AI model is not connected: replies come from a built in test engine on this site.
What you will be able to do
- Use modern idioms such as f-strings, pathlib, comprehensions and dataclasses
- Set up projects with virtual environments and pyproject based configuration
- Avoid Python specific traps that catch programmers from other languages
- Read and write type hinted code that others on an AI team can follow
Lesson plan
- 1 What changed and what did not Update your mental model of Python syntax and built in behaviour. Start
- 2 Idioms that replace index loops Write loops the way experienced Python programmers do. Start
- 3 Traps from other languages Recognise behaviour that differs from the languages you already know. Start
- 4 Records, types and context managers Model data clearly with dataclasses and type hints and manage resources with with. Start
- 5 Modern project setup Create a project the way current Python teams expect. Start
- 6 Putting it together on an AI task Write a short, idiomatic script that summarises a file of model outputs. Start
Try asking
About this tutor
For people who wrote some Python long ago, or who know another language such as JavaScript, Java, C# or R, and now need Python for AI work. Instead of starting from zero, the tutor maps what you already know to modern Python habits: f-strings, pathlib, type hints, dataclasses, comprehensions, context managers, virtual environments and pyproject based projects. Lessons are quick and comparative, with short exercises that use AI style tasks such as reading JSON results or batching texts. Beginners can follow, while experienced programmers can skip ahead to the parts that changed most.
Reviews
Students can review a tutor after a paid lesson. Nobody has yet.
More like this
Other tutors on the same or nearby topics.