PySavvy

Software development terms and acronyms

What does “make your code DRY” even mean?! Here is a glossary of some common terms and acronyms used in software development.

'Read more'

Don't use mutable default values in Python functions

Perhaps you have heard the advice that you shouldn’t use mutable default values in Python functions, here is why.

Here is a simple function (about as simple as you can get) that takes one parameter my_list with a default value of [1, 2, 3] and returns...

'Read more'

What is `if __name__ == __main__` and why would I use it in Python?

You may have seen the line (usually at the end of a Python script):

if __name__ == '__main__':
    # some other code

And wondered what it does, and why it is there. After reading this you will never wonder why again!

What does it do?

In short,

'Read more'

What exactly is a Python package?

In Python, the term package has a very specific meaning that may be different than what you initially expect. Furthermore, a deep understanding of what exactly a package is doesn’t only allow you to correct your friends at parties (because you talk...

'Read more'

Properly calculate memory size of Python object

You are a conscientious developer and want to ensure that your Python program isn’t using too much memory, because ya know, it is the right thing to do. Or perhaps you are analyzing a large dataset and have already run out of RAM on your laptop… so...

'Read more'

How to debug an AttributeError in Python

Whether you have written 10 lines of Python or 10,000 lines it is always surprising when you get an AttributeError exception in your code. By the end of this post you will be well on your way to learning why this happens and how you can fix it.

First...

'Read more'