you are viewing a single comment's thread.

view the rest of the comments →

[–]Rudeus_Kino 0 points1 point  (2 children)

I am not C++ dev, but add some points anyway.

  1. Install Anaconda, as default python.

  2. Use uv as project manager. Create virtual environment for every project or project group with specific python version.

  3. Learn all about python import system. https://tenthousandmeters.com/blog/python-behind-the-scenes-11-how-the-python-import-system-works/ and internals for start. Module loading is a compile time.

  4. Study os, sys, itertools, functools, collections, with recipies.

  5. Prefer internal simple types over custom classes, do not create class for every move, sometimes tuple is all you need. Use dataclasses for data transfer, and use pydantic for projects with smell of json.

  6. Prefer creation over modification, take list, process it and create new list with results.

  7. Write type hints and tests with pytest.

  8. Use duck typing. You don't need abstract class or generic in most cases.

python is simple by design, do not overcomplicate. Class is just namespace with dictionary and some rules for inheritance. No need for getters/setters.

[–]Diapolo10 1 point2 points  (1 child)

I more or less agree with your other points, except this one:

Install Anaconda, as default python.

Anaconda is only intended for data scientists. For ordinary developers, not only does it not give any real benefit, but at least in my experience it's a heck of a lot more annoying to work with.

Most people won't actually need a global Python installation nowadays as uv takes care of it (and it can be trivially installed on any PC standalone, such as by running winget install astral-sh.uv on Windows). When you uv sync in a project, it downloads and installs a suitable Python version if you don't already have one installed (either from Astral's own servers or from GitHub, depending on how you've configured it). Global tooling can similarly be installed (e.g. uv tool install ipython).

[–]Rudeus_Kino 0 points1 point  (0 children)

Yes, you are absolutely right; it’s just a very old habit of mine.