From: Joseph Sutton Date: Wed, 12 Oct 2022 00:56:19 +0000 (+1300) Subject: python: Use list comprehension in string_to_byte_array() X-Git-Tag: talloc-2.4.0~679 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a2ba0fa3ad30bb1c9a010849a8f6a79bfc5ca543;p=thirdparty%2Fsamba.git 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 --- 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):