you have to declare the attribute as public.<br><br><a href="http://docs.cython.org/docs/extension_types.html">http://docs.cython.org/docs/extension_types.html</a><br><br>Cheers,<br><br>Chris<br><br><div class="gmail_quote">
On Tue, Jun 2, 2009 at 11:17 AM, Juha Salo <span dir="ltr"><<a href="http://jusa.sj">jusa.sj</a>@<a href="http://gmail.com">gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Unfortunately that didn't seem to work. I got the following error after the change:<div><br><div><div class="im"><div>>>> a = Foo()</div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div>
<div> File "foo.pyx", line 7, in foo.Foo.__cinit__ (foo.c:388)</div></div><div> self.count += 1</div><div>AttributeError: 'foo.Foo' object attribute 'count' is read-only</div><div><br></div>
<div><br>
</div><div>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.</div><div><br></div><br>
<div class="gmail_quote">
2009/6/2 Cristi Constantin <span dir="ltr"><<a href="mailto:darkgl0w@yahoo.com" target="_blank">darkgl0w@yahoo.com</a>></span><div class="im"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<br>Good day.<br>You should try <span style="font-weight: bold;">self.count += 1</span> instead of Foo.count += 1.<br></td></tr>
</tbody></table></blockquote></div></div><br></div></div>
<br>_______________________________________________<br>
Cython-dev mailing list<br>
<a href="mailto:Cython-dev@codespeak.net">Cython-dev@codespeak.net</a><br>
<a href="http://codespeak.net/mailman/listinfo/cython-dev" target="_blank">http://codespeak.net/mailman/listinfo/cython-dev</a><br>
<br></blockquote></div><br>