single.py: rework to support double