From a2ba0fa3ad30bb1c9a010849a8f6a79bfc5ca543 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Wed, 12 Oct 2022 13:56:19 +1300 Subject: [PATCH] python: Use list comprehension in string_to_byte_array() Samba is now a mature user of Python and can cope with a list comprehension from time to time. Signed-off-by: Joseph Sutton Reviewed-by: Douglas Bagnall --- python/samba/__init__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/python/samba/__init__.py b/python/samba/__init__.py index ec540a61521..54c67fed233 100644 --- a/python/samba/__init__.py +++ b/python/samba/__init__.py @@ -334,12 +334,7 @@ def current_unix_time(): def string_to_byte_array(string): - blob = [0] * len(string) - - for i in range(len(string)): - blob[i] = string[i] if isinstance(string[i], int) else ord(string[i]) - - return blob + return [c if isinstance(c, int) else ord(c) for c in string] def arcfour_encrypt(key, data): -- 2.11.4.GIT