r/learnpython • • Feb 04 '26

Writing professional level python

I've only ever used python with scripts, advent of code and leetcode, how can I learn to write python to a professional level, I've worked within web and done some Django tutorials. However I am interviewing and want to use python I am also using it such as

def function(some_param: type):
  
do something
   
return something

def function_2(some_param: type):
  do something
   return something

var = function()
function_2(var)

What should I be doing to make this code look more senior level

2 Upvotes

15 comments sorted by

View all comments

4

u/pachura3 Feb 04 '26
  • typehints (also return values!)

  • docstrings

  • splitting large scripts into multiple files/modules

  • using the if __name__ == "__main__": pattern

  • using well-known libraries instead of implementing e.g. date formatting logic by yourself

  • meaningful function/variable names

  • logging

  • unit tests

  • pyproject.toml, .gitignore, .python-version, README.md, uv.lock

  • perhaps some OOP