mercredi 4 novembre 2020

How to design my if statement more elegantly python?

I have an if statement and I am trying to write it differently, I am not a fan of nested ifs and was thinking of implementing a break statement somewhere. Is there a more elegant design pattern to avoid the nested if statement?

if render:
        self._init_plt()
        self._render(obs)
        if self.episode_count % self.sample_freq == 0:
            self.export_frames()
 self.episode_count += 1

Aucun commentaire:

Enregistrer un commentaire