[Mistakenly sent to the author instead of the mail list, now re-sent. Plus, perhaps Phil can set the `Reply-To:' flag in the configuration of the mail list program so that replies are by default sent to the list?]
Again, I found that static members of classes are read-only when used from the class directly, for example: test.h: > struct test { static int x; }; > extern test Test; > int get(); > void set(int x); test.cpp: > #include "test.h" > int test::x = 0; > test Test; > int get() { return Test.x; } > void set(int x) { Test.x = x; } test.sip: > %Module test > %ModuleHeaderCode > #include "test.h" > %End > struct test { static int x; }; > test Test; > int get(); > void set(int x); test.py: > import test > test.get() # prints 0 > test.test.x # also prints 0 > test.Test.x # also prints 0 > > test.set(1) # set using set function > test.test.x # prints 1, so the [C++ -> python] data transfer > # succeeded. > > test.Test.x = 2 # set using instance of class > test.get() # prints 2, so the [python -> C++] data transfer > # succeeded. > > test.test.x = 3 # set using the class directly > test.get() # prints 2, so the [python -> C++] data transfer > # failed. > test.Test.x # prints 3, so `x' in the `test' class does not > # refer to its former C++ counterpart now. So is there a way to make the modifications via uninstantiated classe to static members available to their C++ counterparts? Thanks very much :) On Wed, Jul 03, 2013 at 09:30:29AM +0100, Phil Thompson wrote: > You can't do it. Python needs to support module level descriptors for it > to be implemented. -- My current OpenPGP key: 4096R/0xE18262B5D9BF213A (expires: 2017.1.1) D69C 1828 2BF2 755D C383 D7B2 E182 62B5 D9BF 213A _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt