When photographing trains, and even more so trams (which is more my main interest in photography) it is virtually impossible not to get people in the picture, and indeed shots with people in them are generally the more interesting ones.
I have had some, but remarkably few, interactions with people who objected.
By far the largest number of run ins I had were not with people who objected to their picture being taken, but by over-zealous security guards.
I was in one country in the east recently and what they really wanted was money. I fortunately had a smaller bank note in my pocket and could buy them off before they forcibly deleted pictures or confiscated the camera.
The steup was that they told me that I needed to get a photo permit from some office that conveniently happened to be closed on that day. When I asked to talk to their superior officer or manager, strangely he could not be found either.
But if i would give them a small amount of money they promised to "protect" me.
The entire conversation and exchange of money took place in full view of a security camera (this was in a station). So I guess they had the power to make evidence disappear and it was wise not to challenge them unnecessarily.
But i don't think anything like that would be the case in Switzerland.