Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/pyrap/docs/pyrap_util.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 12:28:25 2011 Кодировка: IBM-866 Поисковые слова: п п п п п п п п п п п п |
Utilities for pyrap modules.
Substitute global python variables in a command string.
This function parses a string and tries to substitute parts like $name by their value. It is uses by image and table to handle image and table objects in a command, but also other variables (integers, strings, etc.) can be substituted. The following rules apply:
The objlist argument is a list of tuples or lists where each tuple or list has three fields:
Apart from substituting variables, it also substitutes $(expression) by the expression result. It correctly handles parentheses and quotes in the expression. For example:
a=2
b=3
substitute('$(a+b)+$a') # results in '5+2' (not '7')
substitute('$((a+b)*(a+b))') # results in '25'
substitute('$(len("ab cd( de"))') # results in '9'
Substitution is NOT recursive. E.g. if a=1 and b=”$a”, the result of substitute(“$b”) is “$a” and not 1.