I just recently found myself writing this line of code, which i did not like too much:
if ('upload' in request.POST) or ('delete' in request.POST):
I allready thought about list comprehension, which would look like this:
if [value for value in ['upload','delete'] if value in request.POST]:
Which is not exactly better. My very simple question is: can this be simplified? Or is this just trying to be too smart?
You could write it more concisely by using set intersection:
Or more explicitly: