SAMP MType parameters issue

Luigi Paioro luigi at lambrate.inaf.it
Wed Nov 5 05:52:15 PST 2008


Dear all,

   I've got an issue I'd like to submit to you regarding the MTypes 
parameters names and how they can be mapped as arguments in a Python 
function (in particular in SAMPy).

In general, a SAMP message is encoded as a map containing:

"samp.mtype": <the MType>
"samp.params": <sequence of key/value pairs>

Well, exploiting a Python specific facility, I can simplify (at 
scripting level) the creation of those maps introducing an additional 
"Pythonic" API that transforms each "samp.params" entry into an actual 
function (or method) argument.

Example:

I want to notify the URL of a certain VOTable, sending this MType:

MType: table.load.votable
Arguments: url [, table-id, name]

With SAMPy I can do something like:

cli.enotify("table.load.votable", url="file:///path/of/a/votable")

In general the syntax is:

<function>(<MType>, <arg1>=<arg1 value>, <arg2>=<arg2 value>, ...)

which is an user friendly expression that hides the low level details of 
SAMP.

Here comes the issue a would like to discuss: if (using the example 
above) I wanted to notify the optional parameter "table-id" as well, I 
would get a syntax error from the Python shell, since Python function 
arguments (identifiers) can be only of the form:

identifier ::= (letter|"_") (letter | digit | "_")*
letter     ::= lowercase | uppercase
lowercase  ::= "a"..."z"
uppercase  ::= "A"..."Z"
digit      ::= "0"..."9"


I understand that this is purely a Python issue, but it would be easily 
solved simply modifying the present MTypes parameters (as proposed at 
the URL http://www.ivoa.net/cgi-bin/twiki/bin/view/IVOA/SampMTypes) 
replacing the - (minus) with a _ (underscore):

table-id -> table_id
row-list -> row_list
image-id -> image_id

and possibly following this naming convention even for any future MType 
parameter name. Without generating much trouble for the rest of the SAMP 
community,

would anyone object against this proposed modification?


Best regards,

   Luigi



-- 

Luigi Paioro

INAF - IASF Milano
Via Bassini 15, I-20133 Milano, Italy

Phone  (+39) 02 23 699 470
Fax    (+39) 02 26 660 17
Site   http://www.iasf-milano.inaf.it/luigi/



More information about the apps-samp mailing list