@@ -19,12 +19,14 @@ def to_string(
19
19
"""
20
20
Convert any value to a string, a sequence of strings or None.
21
21
22
- - ``None`` or ``False`` will be converted to ``None``.
22
+ The general rules are:
23
+
24
+ - ``None``/``False`` will be converted to ``None``.
23
25
- ``True`` will be converted to an empty string.
24
26
- A sequence will be joined by the separator if a separator is provided. Otherwise,
25
27
each item in the sequence will be converted to a string and a sequence of strings
26
28
will be returned.
27
- - Any other value will be converted to a string if possible.
29
+ - Any other type of values will be converted to a string if possible.
28
30
29
31
If a mapping dictionary is provided, the value will be converted to the short-form
30
32
string that GMT accepts (e.g., mapping PyGMT long-form argument ``"high"`` to GMT's
@@ -35,10 +37,10 @@ def to_string(
35
37
An optional prefix (e.g., `"+o"`) can be added to the beginning of the converted
36
38
string.
37
39
38
- Need to note that this function doesn't check if the given parameters are valid, to
39
- avoid the overhead of checking. For example, if ``value`` is a sequence but
40
- ``separator`` is not specified, a sequence of strings will be returned. ``prefix``
41
- makes no sense here, but this function won't check it .
40
+ To avoid extra overhead, this function does not validate parameter combinations. For
41
+ example, if ``value`` is a sequence but ``separator`` is not specified, the function
42
+ will return a sequence of strings. In this case, ``prefix`` has no effect, but the
43
+ function does not check for such inconsistencies .
42
44
43
45
Parameters
44
46
----------
0 commit comments