diff options
author | Mats Wichmann <mats@linux.com> | 2019-01-04 18:26:04 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-01-04 19:45:56 (GMT) |
commit | d7949f9c4e7d70de3b5e060cb402b2d5f9f69a8d (patch) | |
tree | 256460d829d2b582d444396969eb2104db46ce77 /doc/man | |
parent | d2e6e13d697412b8d60ff30fc812f7d905e5e8f6 (diff) | |
download | SCons-d7949f9c4e7d70de3b5e060cb402b2d5f9f69a8d.zip SCons-d7949f9c4e7d70de3b5e060cb402b2d5f9f69a8d.tar.gz SCons-d7949f9c4e7d70de3b5e060cb402b2d5f9f69a8d.tar.bz2 |
Update some doc examples
map() now returns an interable instead of a list, update
examples which assumed they could just print() the result
of a map().
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'doc/man')
-rw-r--r-- | doc/man/scons.xml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml index f61c491..805164c 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -3014,7 +3014,7 @@ function to get at the path name for each Node.</para> <literallayout class="monospaced"> print(str(DEFAULT_TARGETS[0])) -if 'foo' in map(str, DEFAULT_TARGETS): +if 'foo' in [str(t) for t in DEFAULT_TARGETS]: print("Don't forget to test the `foo' program!") </literallayout> </listitem> @@ -3028,13 +3028,13 @@ list change on on each successive call to the function:</para> <literallayout class="monospaced"> -print(map(str, DEFAULT_TARGETS)) # originally [] +print([str(t) for t in DEFAULT_TARGETS]) # originally [] Default('foo') -print(map(str, DEFAULT_TARGETS)) # now a node ['foo'] +print([str(t) for t in DEFAULT_TARGETS]) # now a node ['foo'] Default('bar') -print(map(str, DEFAULT_TARGETS)) # now a node ['foo', 'bar'] +print([str(t) for t in DEFAULT_TARGETS]) # now a node ['foo', 'bar'] Default(None) -print(map(str, DEFAULT_TARGETS)) # back to [] +print([str(t) for t in DEFAULT_TARGETS]) # back to [] </literallayout> <para>Consequently, be sure to use @@ -5279,11 +5279,11 @@ arguments may be lists of Node objects if there is more than one target file or source file. The actual target and source file name(s) may be retrieved from their Node objects -via the built-in Python str() function:</para> +via the built-in Python <function>str</function> function:</para> <literallayout class="monospaced"> target_file_name = str(target) -source_file_names = map(lambda x: str(x), source) +source_file_names = [str(x) for x in source] </literallayout> <para>The function should return |