CXX Doc Sample FAILS on VC6!!! (was)Re: simple CXX Q's: pls help

S. Hoon cpu at bigfoot.com
Sun May 30 21:09:07 EDT 1999


Hi,

  This seems to be pretty dumb, but I am keep answering my own Q's.
I have the corrected code on the bottom. I hope LLNL updates their Docs.

Beyond that I still have one Q that's outstanding. I don't think I am going
to arrive at the answer to this one anytime soon.
> Does LLNL offer docs on how to use Numpy with CXX as well?
If not, please send me any working codes or docs or point me to them.
> mailto:hoon at bigfoot.com
 Thanks much in Adv,

static PyObject *
ex_Atuple(PyObject* self, PyObject* args)
{
Float mult;
 try {
  Tuple t(args); // set up a Tuple pointing to the arguments.
  if(t.length() != 2) throw Exception("Incorrect number of arguments."); //
***** HERE FIX
  Sequence s = t[0]; // get argument and be sure it is a sequence
  mult       = t[1];
  List rr;
  int i;
  for(i=0; i<s.length(); i++) {
   rr.append(s[i]*mult);
  }
  return new_reference_to(rr);
  file://return new_reference_to(Int(s.length()));
 }
 catch(const Exception&) {
  cout << "Exception caught HNtst, passing it on to Python\n";
  return Null ();
 }
}







More information about the Python-list mailing list