|
Re: How to specify __contains__ method?: msg#00022python.pyrex
> When I compile the following simple example: > > cdef class foo: > def __contains__(self, key): > return 1 > > I get the error message: > > d:\msl\gb\python\my\Matrix\bug2.pyx:3:11: Return with value in void function This appears to be a bug. I'll look into it. > If I change "def" to "cdef int", it gets past Pyrex but the C compiler > complains: That's probably a bug too, but in any case this isn't what you want to do. Special methods are supposed to be declared with def, not cdef. Probably I should disallow using cdef in this case. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@xxxxxxxxxxxxxxxxxxxxx +--------------------------------------+ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Segfault when trying to set attribute of another class: 00022, Greg Ewing |
|---|---|
| Next by Date: | Newbie Question: 00022, Michael |
| Previous by Thread: | Re: How to specify __contains__ method?i: 00022, Andreas Kostyrka |
| Next by Thread: | Re: How to specify __contains__ method?: 00022, Gary Bishop |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |