Torch toggle

This line below:
if $Torch.enabled:
$Torch.enabled = false
else:
$Torch.enabled = true

Could also be made with one line
$Torch.enabled != $Torch.enabled

I always forget about that trick and it blows my mind every time someone reminds me. Nice!

$Torch.enabled != $Torch.enabled

should be $Torch.enabled = !$Torch.enabled

Just a typo.

= should be before ! me thinks.

1 Like

Derp. Yeah a typo.

In my opinion $Torch.enabled = not $Torch.enabled is way more readable

Privacy & Terms