Hi,
I got a simple problem regarding so called class variables in Cython. I'm
trying to declare a simple counter as a class variable which is shared
between all instances of that class. The counter's value should be
incremented as instances of the class are created. Cython allows me to
declare a
Good day.
You should try self.count += 1 instead of Foo.count += 1.
--- On Tue, 6/2/09, Juha Salo jusa...@gmail.com wrote:
From: Juha Salo jusa...@gmail.com
Subject: [Cython] Syntax for declaring Cython class variables
To: cython-dev@codespeak.net
Date: Tuesday, June 2, 2009, 3:43 AM
Hi,
I
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
Review this. Tell me if you like it.
AFAIK, this should always work (even iff an embedder plays with
loading/unloading the Python shared library ??)
diff -r 88fa346e169d Cython/Compiler/Symtab.py
--- a/Cython/Compiler/Symtab.py Tue May 26 22:54:46 2009 +0200
+++ b/Cython/Compiler/Symtab.py Tue
This is correct, forget what I said. I should have tried it out before I
said anything. My apologies.
On Tue, Jun 2, 2009 at 12:44 PM, Lisandro Dalcin dalc...@gmail.com wrote:
No, that will not work. AFAIK, Class attributes are not currently
supported for cdef classes.
Juha, you will have
On Tue, Jun 2, 2009 at 2:48 PM, Juha Salo jusa...@gmail.com wrote:
OK, thanks for the info. It's interesting, though, that I can code something
like this in Cython and it works:
cdef class Foo:
foos = {}
def __cinit__(self, name):
Foo.foos[name] = self
a = Foo('Larry')
b
Sebastien Binet wrote:
On Tuesday 02 June 2009 20:03:25 Lisandro Dalcin wrote:
On Tue, Jun 2, 2009 at 2:48 PM, Juha Salo wrote:
OK, thanks for the info. It's interesting, though, that I can code
something like this in Cython and it works:
cdef class Foo:
foos = {}
def
No time right now to look at this... All doctests fail on Py3.1rc1,
with errors like the traceback below. Are we needing a (trivial?) fix
or is something broken on Py3.1?
==
ERROR: compiling (cpp) and running withstat