how to cast an instance id

Eric Texier erict at millfilm.co.uk
Tue Sep 17 11:15:22 EDT 2002


"Gonçalo Rodrigues" wrote:

> AFAIK there isn't - You probably have to go down the bowls of the C
> implementation to do it. But why would you need such a contortionist's
> act?

Yes I know it sound a little bit twisted.


> If you explain your problem maybe the people here in the list can
> figure out a Pythonic way to do it.

Here is why (simplification)
I designed a generic class which is customizable through a python like
scripting.
Script let you instantiate, add, set/get attribute and much more...

script example:
taskName = "ExecBatch" # default name
ARGUMENT : taskName = '%(taskName)s'
taskRef = Fac.createInstance( "progCommand" ,taskName)
print taskRef,"created",taskRef.getName()
taskRef.Set(command = "someExe -batch")
top.addChild(taskRef)


Now, I would like to give the user some way to save preference, and for
consistency I tought it will be nice to be able to have a script of the
same
kind:

ataskid = 0
ARGUMENT : 'ataskid = 0x%(taskName)x'
if id != 0:
   ataskRef = Fac.getInstance(id)
   if ataskRef != None:
         ataskRef.Set('whoToTell',value = ['someOne','someoneElse'])
         ataskRef.Set('sendEmail',value = 1)




>
> Best regards,
> Gonçalo Rodrigues
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020917/009d993f/attachment.html>


More information about the Python-list mailing list