def _new_particle(self):
        # Find all particles on the Screen when we create our first particle
        # and sort by distance from the origin.
        if self._particles is None:
            self._particles = []
            for x in range(self._screen.width):
                for y in range(self._screen.height):
                    ch, fg, attr, bg = self._screen.get_from(x, y)
                    if ch != 32:
                        self._particles.append((x, y, ch, fg, attr, bg))
            self._particles = sorted(
                self._particles, key=self._sort, reverse=True)

        # Stop now if there were no more particles to move.
        if len(self._particles) == 0:
            return None

        # We got here, so there must still be some screen estate to move.
        x, y, ch, fg, attr, bg = self._particles.pop()
        r = min(10,
                max(0.001,
                    sqrt(((x - self._x) ** 2) + ((y - self._y) ** 2))))
        return Particle(chr(ch), x, y,
                        (x - self._x) * 40.0 / r ** 2,
                        (self._y - y) * 20.0 / r ** 2,
                        [(fg, attr, bg)],
                        self._life_time,
                        self._move)
dataset/ETHPy150Open peterbrittain/asciimatics/asciimatics/particles.py/ShotEmitter._new_particle/swapped operands of `-`