[Mesa-dev] [PATCH v2 7/9] python: Simplify list sorting
Dylan Baker
dylan at pnwbakers.com
Thu Aug 9 23:51:10 UTC 2018
All patches up to here (including this one) have been pushed to master. I had
comments on patch 8, and I want to follow up with our CI team to make sure we
have all the dependencies for python 3 in our CI.
Dylan
Quoting Mathieu Bridon (2018-08-09 01:27:24)
> Instead of copying the list, then sorting the copy in-place, we can just
> get a new sorted copy directly.
>
> Signed-off-by: Mathieu Bridon <bochecha at daitauha.fr>
> ---
> src/mapi/mapi_abi.py | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/src/mapi/mapi_abi.py b/src/mapi/mapi_abi.py
> index d4c48ec430..dc48fa5935 100644
> --- a/src/mapi/mapi_abi.py
> +++ b/src/mapi/mapi_abi.py
> @@ -291,8 +291,7 @@ class ABIPrinter(object):
> self.entries = entries
>
> # sort entries by their names
> - self.entries_sorted_by_names = self.entries[:]
> - self.entries_sorted_by_names.sort(key=attrgetter('name'))
> + self.entries_sorted_by_names = sorted(self.entries, key=attrgetter('name'))
>
> self.indent = ' ' * 3
> self.noop_warn = 'noop_warn'
> @@ -441,8 +440,7 @@ class ABIPrinter(object):
> def c_stub_string_pool(self):
> """Return the string pool for use by stubs."""
> # sort entries by their names
> - sorted_entries = self.entries[:]
> - sorted_entries.sort(key=attrgetter('name'))
> + sorted_entries = sorted(self.entries, key=attrgetter('name'))
>
> pool = []
> offsets = {}
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180809/8edf8d36/attachment.sig>
More information about the mesa-dev
mailing list