SAMP MType parameters issue

Luigi Paioro luigi at lambrate.inaf.it
Fri Nov 7 01:46:04 PST 2008


I think I've not been completely clear explaining my issue. Using the 
standard SAMP API, the use of a general string defining an MType 
parameter is not a problem, since it is a simple string (and 
Python/SAMPy obviously supports it).

As Thomas has just pointed out, the problem comes when I try to exploit 
a specific Python feature that allows to directly map a dictionary to a 
set of function arguments. This is really user friendly at scripting 
level. An example:

In oder to send a notification message with SAMPy/Python using the 
standard SAMP API I would write something like:

hub.notifyAll("my-client-pkey", {"samp.mtype": "table.load.votable", 
"samp.params": {"url": "file:///path/of/a/votable", "table-id": 
"1234abcd"}})

while using a more "Pythonic" API (which would be pertinent only in 
SAMPy) the same operation would be:

cli.enotifyAll("table.load.votable", url="file:///path/of/a/votable",
table-id="1234abcd")

I think this is really more comfortable... thus my proposal. I repeat 
that it is not my intention to create much trouble to the rest of the 
SAMP community, but the constraints to the parameters names I proposed 
would be really appreciated by me and, as others has already suggested, 
even other languages could benefit from this feature (I guess).

Regards,

   Luigi


Mike Fitzpatrick ha scritto:
> Forgive my Python ignorance, but could somebody post a snippet of
> sample code demonstrating the problem?  The mtype is a string in a
> bit of XML, how/why is this conflicting with the syntax for a variable
> name?
> 
> If adopted, the BNF has to be a requirement in order to counter the
> freedom we give to create  user-defined mtypes (where guys like
> me would naturally use an hyphen if needed).  Another alternative is
> to simply use camelCase mtypes.
> 
> -Mike
> 
> 
> 

-- 

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