[Pyrex] Access to nested structures and arrays

Anders Gustafsson andersg at 0x63.nu
Mon Mar 19 12:49:22 UTC 2007


Robert Bradshaw wrote:
> Yes, as __init__ cannot be a cdef function (otherwise it wouldn't be  
> callable via python).

Somewhat related: Is there some nice way to hinder instantiation of
classes from outside pyrex code?

I'm doing this currently:
---------

cdef object foo
foo = object()

class bar:
        def __init__(self, must_be_foo):
                if must_be_foo is not foo:
                        raise RuntimeError("Forbidden")

baz = bar(foo)


 anders




More information about the Pyrex mailing list