From a6b67fd5888f5d31d34d3485ff85fe1fbd60ef74 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 30 Oct 2017 17:28:41 +0100 Subject: Explain how to get the integer value for int/hex --- kconfiglib.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 6b6eff6..c9d015f 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -1993,13 +1993,16 @@ class Symbol(object): when printing the symbol. str_value: - The value of the symbol as a string. Gives the string value for - string/int/hex symbols. For bool/tristate symbols, gives "n", "m", or - "y". + The value of the symbol as a string. Gives the value for string/int/hex + symbols. For bool/tristate symbols, gives "n", "m", or "y". This is the symbol value that's used in relational expressions (A = B, A != B, etc.) + Gotcha: For int/hex symbols, the exact format of the value must often be + preserved (e.g., when writing a .config file), hence why you can't get it + directly as an int. Do int(sym.str_value) to get the integer value. + tri_value: The tristate value of the symbol as an integer. One of 0, 1, 2, representing n, m, y. Always 0 (n) for non-bool/tristate symbols. -- cgit v1.2.3