Published on

Initial Impressions of Working With Python

Authors

I have been working with Python from a professional perspective for a few weeks now and I am really enjoying coding in it. The more I work with it the more I like it unlike some other scripting languages I've worked with which I despise more and more as I work with them.

Some of the thing I really enjoy are:

  • How it drops a lot of the verbose cruft many other languages have (it should be called Pythin ;) :
    • No semi colons woopie!
    • No need to add frivolous prefix words to your variable declarations like var, let, const, val etc.
  • How readable it is.
  • Declaring functions is really succinct
  • List comprehensions are amazing
  • Having native support for type hints.
    • I find transpiling (common to some other languages) a pain in the ass, it makes things like setting up breakpoints and debugging painful.
  • How the Pythonic way to "for loop" is so clean
  • PyCharm community edition rocks and more than caters for my needs
  • Tabbing being part of the language is a really great idea. Code formatting is generally more uniform without having to resort to code formatters.
  • I love how easy it is to try out a script simply define a main in the file and run what you need in a function:
...

if __name__ == "__main__":
  # run your method here

Some things I'm still wrapping my head around and adjusting to:

  • I cannot find what the Python equivalent of the scripts in an npm file or maven file are
    • In the interim I've been using a makefile got this
  • The Pythonic way to do things I'm used to in other languages
  • It is still a scripting language so you need to be careful when passing types around. I still really miss the type safety compiled languages give you for free.
  • Not trying to use Javascript style dot notation on dictionaries :/
  • When you have more than 2 layers of nesting for if statements, or loops it can be really difficult to see what is going on. Although to be fair you should be breaking big chunks of code into smaller functions for readability anyway.
  • The conventions for making something private vs public vs protected are not immediately obvious and private fields are easy to mix up with dunders. But once you've learnt the conventions it's actually very easy to follow. IDEs like PyCharm will not code assist suggest variables and methods you do not have scope of although you can still manually type these in.
  • Having to have an empty __init__.py in a directory to make the package/module searchable.