Re: [C++-sig] Static, again...
by David Abrahams other posts by this author
Nov 13 2002 1:19PM messages near this date
Re: [C++-sig] Static, again...
|
Re: [C++-sig] Static, again...
Hugo van der Merwe <hugo@[...].za> writes:
> On Wed, Nov 13, 2002 at 08:51:12AM +0200, Hugo van der Merwe wrote:
> > Do properties currently only handle straight forward single parameter
> > "setters"? How difficult would it be to allow it to do two parameters,
> > with e.g. "object.property[5] = 10"? (Or can it do that already?)
>
> I just saw this in another email:
>
> > > It seems natural to expose class Heavy with 3 attributes: x,y and z which
> > > will behave like dictionaries.
> > > How to do that?
> >
> > Use the add_property member of class_<>:
> >
> > http://www.boost.org/libs/python/doc/v2/class.html#class_-spec-modifiers
>
> Cool, I'll try testing it later. Is there a way to expose a 3
> parameter "setter" (which can then be addressed like a matrix)? I'd
> think this is asking a bit too much, at this point one should probably
> just stick with "Get(x,y)" and "Set(x,y,value)" methods.
Yes, but I'll leave it as an "exercise for the reader". Properties are
a Python 2.2 thing, not a Boost.Python feature. Try it in pure
Python. If you can get that to work, you can probably get it to work
in Boost.Python. Hint: you'll need a proxy class.
--
David Abrahams
dave@[...].com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Hugo van der Merwe
Scott A. Smith
David Abrahams
Scott A. Smith
Nicodemus
Scott A. Smith
Mike Rovner
David Abrahams
David Abrahams
Hugo van der Merwe
Hugo van der Merwe
David Abrahams
Hugo van der Merwe
David Abrahams
|