If you are using Python because you need to do batch processing of many files, you should consider the gpt BandMaths operator.
Python has a much larger user community than SNAP, so you will get the most expert help in Python forums. For starters, however, you should investigate numpy masked arrays.