Technically it sets it, but I'd imagine that checking each time whether it's true vs resetting it to true even if it is already true would execute at roughly the same speed, so you can do either, at least for things like booleans and other simple variables. But once you get into more advanced objects that must be initialized, you'll want the first approach as it will run considerably faster. For example:
bio=None
for i in range(10):
if i>5 and not bio: bio=io.BytesIO(someLongString)
would execute much faster than if you had removed that second claws of the statement, because making a new BytesIO object with your string is internally harder work than assigning to a bool. I also tested this, it seems the first approach when comparing rather than always setting, even with bool, run 10 times is just a couple ms faster than the second approach, where you set it no matter what. The difference is so small in that case it probably doesn't matter though, however I'd still avoid it in longer loops, or programs where your goal is efficiency rather than simple code that just works. But you should really avoid it when actually making new objects, as that is much more intensive. and should only be done if your object doesn't already exist.
I am a web designer, and a game developer. If you wish see me at
http://www.samtupy.com