Re: [libvirt] [PATCH 09/22] apibuild: Simplify conditional statements

2018-03-19 Thread Radostin Stoyanov
On 19/03/18 10:52, Daniel P. Berrangé wrote: >> -o = ord(line[i]) >> -if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \ >> - (o >= 48 and o <= 57): >> +if re.match(r"[a-zA-Z0-9]", line[i]): > Why not just use isalnum()

Re: [libvirt] [PATCH 09/22] apibuild: Simplify conditional statements

2018-03-19 Thread Daniel P . Berrangé
On Sat, Mar 17, 2018 at 02:23:27PM +, Radostin Stoyanov wrote: > Improve readability by reducing the complexity and length of > conditional statements. > > Example: The following condition: > > if (o >= 97 and o <= 122) or > (o >= 65 and o <= 90) or > (o >= 48 and o

[libvirt] [PATCH 09/22] apibuild: Simplify conditional statements

2018-03-17 Thread Radostin Stoyanov
Improve readability by reducing the complexity and length of conditional statements. Example: The following condition: if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or (o >= 48 and o <= 57) or (" \t(){}:;,+-*/%&!|[]=><".find(line[i]) == -1): Will be