|
Boost : |
Subject: Re: [boost] [python] extracting a string and a one-length list containing a string
From: Allan Johns (allan.johns_at_[hidden])
Date: 2011-03-13 19:20:46
Ok the problem is nothing to do with boost python, but some lack of python
knowledge on my behalf. I didn't know about the quirky syntax for
construction of 1-length tuples, and was wondering why this argument was
being extracted as a string and not a 1-length tuple:
>>> foo( ("str") )
Of course, it was a string all along.
thx
A
On Sat, Mar 12, 2011 at 10:35 PM, Dave Abrahams <dave_at_[hidden]> wrote:
> At Thu, 10 Mar 2011 09:33:27 +1100,
> Allan Johns wrote:
> >
> > Hello,
> >
> > Given a boost::python object, how can I the difference between that
> object
> > containing a string, or a sequence of length 1 whos zeroeth element is a
> > string? Ie:
> >
> > "foo" --vs-- ["foo"]
> >
> > bp::extract<std::string> succeeds in both cases.
>
> I'm shocked. Really? Can you show the code?
>
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk