tuple creation in C extensions
Louis M. Pecora
pecora at anvil.nrl.navy.mil
Sun Jun 11 09:26:54 EDT 2000
In article <m33dml6p34.fsf at brant.geog.ubc.ca>, Phil Austin
<phil at geog.ubc.ca> wrote:
> Peter Schneider-Kamp <petersc at stud.ntnu.no> writes:
>
> > I have to create a tuple (of two integer values) in a
> > C extension. At the moment I use the following (rather
> > ugly in my eyes) construction:
> >
>
> [snip]
>
> > Is there "A Better Way(TM)"?
> >
>
> If you're able to use the CXX extension, the sequence is:
>
> Tuple t(2);
> t[0]=Int(a);
> t[1]=Int(b);
>
> If the conversion fails, Int will throw an exception that
> can be caught on the python side.
Phil,
What about reference counting for these CXX examples?
More information about the Python-list
mailing list