Python's assert can take both a condition and a string, which will cause
it to print the string if the assertion trips. (You can't use parens as
that creates a tuple.) Doing "condition and string" works in C, but
doesn't have the desired effect in Python.
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
if num_str.lower().startswith('0x'):
return int(num_str, base=16)
else:
- assert(not num_str.startswith('0') and 'octals numbers not allowed')
+ assert not num_str.startswith('0'), 'octals numbers not allowed'
return int(num_str)
class Field(object):