In a tutorial for developing a processing-plugin for QGIS I found the following Python3-code:
# Compute the number of steps to display within the progress bar and
# get features from source
total = 100.0 / source.featureCount() if source.featureCount() else 0
features = source.getFeatures()
My question: What kind of language construct is this single line:
total = 100.0 / source.featureCount() if source.featureCount() else 0
This looks weird: Frist an assignment , which is followed by an if-else-construct in the same line??