I tried a number of permutations figuring that %attribute might not like it. It seems to be a bug where property setters never get invoked (which I think I might have fixed). I am using python 2.6 and swig 1.3.39

On Wed, Jul 29, 2009 at 9:28 AM, David Piepgrass <dpiepgrass@mentoreng.com> wrote:

How exactly are you using %attribute and which version of SWIG are you using? (older versions had a bug if the attribute had the same name as the getter or setter methods)


From: Andrew McHarg [mailto:amcharg@gmail.com]
Sent: Tuesday, July 28, 2009 12:46 PM
To: swig-user@lists.sourceforge.net
Subject: [Swig-user] Trouble getting python style properties mapped


I am having a hard time getting python style properties working when I have C++ methods. The docs seem to allude that it will do this for but it does not seem to be the case.


Take for instance this simple example:


class Cake {

    bool m_lie; // is this cake a lie?


    bool lie() const { return m_lie; }

    void lie(bool val) { m_lie = val; }



I tried using attribute.i but it seems to not work very well and is only documented in attribute.swg as near as I can tell? I also tried using the builtin python property function but since swig overrides the getattr and setattr functions or some such the setter does not function.