you have to declare the attribute as public. http://docs.cython.org/docs/extension_types.html
Cheers, Chris On Tue, Jun 2, 2009 at 11:17 AM, Juha Salo <[email protected]> wrote: > Unfortunately that didn't seem to work. I got the following error after the > change: > >>> a = Foo() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "foo.pyx", line 7, in foo.Foo.__cinit__ (foo.c:388) > self.count += 1 > AttributeError: 'foo.Foo' object attribute 'count' is read-only > > > To clarify, I want the value of the count variable to remain the same > between all instances. So if I create 3 Foo objects, each object should show > 3 as the value in the count variable. > > > 2009/6/2 Cristi Constantin <[email protected]> > >> >> Good day. >> You should try self.count += 1 instead of Foo.count += 1. >> > > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > >
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
