Rezha Julio

The Hard Coded Chemist

Keyword argument demystify

2017-05-22
There’s a lot of baffling among Python programmers on what exactly “keyword arguments” are. Let’s go through some of them. If you somehow are writing for a Python 3 only codebase, I highly recommend making all your keyword arguments keyword only, especially keyword arguments that represent “options”. There are many problems with this sentence. The first is that this is mixing up “arguments” (i.e. things at the call site) and “parameters” (i. Continue reading

EAFP Coding Style in Python

2015-04-27

What is EAFP ?

EAFP (Easier to Ask for Forgiveness than Permission) is a coding style that’s commonly used in Python community. This coding style assumes that needed variables, files, etc. exist. Any problems are caught as exceptions. This results in a generally clean and concise style containing a lot of try and except statements. This technique is really contrasts with common style in many other language like C with LBYL (Look Before You Leap) approach which is characterized by the presence of many if statements.

Continue reading