Skip to content

Files

Latest commit

 

History

History
19 lines (12 loc) · 347 Bytes

consider-using-generator.md

File metadata and controls

19 lines (12 loc) · 347 Bytes

Pattern: Missing use of generator

Issue: -

Description

If your container can be large using a generator will bring better performance.

Example of incorrect code:

list([0 for y in list(range(10))]) # [consider-using-generator]

Example of correct code:

list(0 for y in list(range(10)))