Skip to content

Commit

Permalink
Merge pull request pygame#2509 from Pierre-Sassoulas/use-a-generator-…
Browse files Browse the repository at this point in the history
…instead-of-a-list

Optimisation (?) in cursor: Use a generator instead of a list
  • Loading branch information
illume authored Mar 7, 2021
2 parents a4a3260 + ca65880 commit 2cc9d81
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src_py/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ def __init__(self, *args):
self.data = tuple(args)
elif len(args) == 4 and len(args[0]) == 2 and len(args[1]) == 2:
self.type = "bitmap"
# pylint: disable=consider-using-generator
# See https://github.com/pygame/pygame/pull/2509 for analysis
self.data = tuple([tuple(arg) for arg in args])
else:
raise TypeError("Arguments must match a cursor specification")

def __len__(self):
return len(self.data)

Expand Down Expand Up @@ -465,4 +467,4 @@ def bitswap(num):
maskdata.append(bitswap(int(x, 16)))

maskdata = tuple(maskdata)
return info[:2], info[2:], cursdata, maskdata
return info[:2], info[2:], cursdata, maskdata

0 comments on commit 2cc9d81

Please sign in to comment.