Re: [C++-sig] [] subscript notation with boost::python

2009-02-23 Thread Maik Beckmann
troy d. straszheim schrieb am Montag 23 Februar 2009 um 19:51: > Maik Beckmann wrote: > > Considering what Murray done so far, I really doubt he makes this kind of > > a mistake. :P > > Experts can make this mistake too. I wasn't being condescending. The > error message speaks for itself: > >

Re: [C++-sig] [] subscript notation with boost::python

2009-02-23 Thread troy d. straszheim
Maik Beckmann wrote: Considering what Murray done so far, I really doubt he makes this kind of a mistake. :P Experts can make this mistake too. I wasn't being condescending. The error message speaks for itself: "Boost.Python.class' object is unsubscriptable" If the problem was what

Re: [C++-sig] [] subscript notation with boost::python

2009-02-23 Thread Maik Beckmann
troy d. straszheim schrieb am Montag 23 Februar 2009 um 19:15: > > Murray Cumming schrieb am Montag 23 Februar 2009 um 12:39: > >> I'm trying to support this notation in python: > >> something = record["somefieldname"] [snip] > You're trying to subscript a class, not an instance of a class. I be

Re: [C++-sig] [] subscript notation with boost::python

2009-02-23 Thread troy d. straszheim
Maik Beckmann wrote: Murray Cumming schrieb am Montag 23 Februar 2009 um 12:39: I'm trying to support this notation in python: something = record["somefieldname"] [snip] I'm now trying to do this with boost::python, like so, because googling has suggested that this should work: boost::python:

Re: [C++-sig] [] subscript notation with boost::python

2009-02-23 Thread Maik Beckmann
Murray Cumming schrieb am Montag 23 Februar 2009 um 12:39: > I'm trying to support this notation in python: > something = record["somefieldname"] [snip] > I'm now trying to do this with boost::python, like so, because googling > has suggested that this should work: > > boost::python::class_("Record

[C++-sig] [] subscript notation with boost::python

2009-02-23 Thread Murray Cumming
I'm trying to support this notation in python: something = record["somefieldname"] I had that working with the Python C API, by implementing the len and getitem functions, setting them in the PyTypeObject::tp_as_mapping struct field. I'm now trying to do this with boost::python, like so, because