Consider using a generator instead 'tuple(slice(ghost_zones, -ghost_zones) for ghost_zones in self.num_ghost)'
952
953 new_grid = self.grid.ghost_zones_removed()
954 # We remove the borders from the data using the slicing operator
955 slicer = tuple( 956 [
957 slice(ghost_zones, -ghost_zones)
958 for ghost_zones in self.num_ghost
Description
Using a container in place of a generator for a calls that can accept both, slows down the performance. Consider using generators for all function calls which accept both containers and genertors.
Bad practice
# List comprehension is unnecessary here
set([student.name for student in student])
sum([y**2 for y in list(range(10))])
Recommended
set(student.name for student in students)
sum(y**2 for y in list(range(10)))