Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-03-03 Thread Robert Bradshaw
On Thu, Mar 3, 2011 at 4:13 AM, W. Trevor King wrote: > On Wed, Mar 02, 2011 at 06:08:12PM -0800, Robert Bradshaw wrote: >> On Wed, Mar 2, 2011 at 5:54 PM, W. Trevor King wrote: >> > Previous discussions in this thread [1,2] have discussed the issues >> > associated with overloading the 'public'

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-03-03 Thread W. Trevor King
On Wed, Mar 02, 2011 at 06:08:12PM -0800, Robert Bradshaw wrote: > On Wed, Mar 2, 2011 at 5:54 PM, W. Trevor King wrote: > > Previous discussions in this thread [1,2] have discussed the issues > > associated with overloading the 'public' keyword. For an example of > > the difficulties this causes

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-03-02 Thread Robert Bradshaw
On Wed, Mar 2, 2011 at 5:54 PM, W. Trevor King wrote: > Previous discussions in this thread [1,2] have discussed the issues > associated with overloading the 'public' keyword.  For an example of > the difficulties this causes, see the ugly workaround [3] in my recent > commit [4].  Definately wort

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-03-02 Thread W. Trevor King
Previous discussions in this thread [1,2] have discussed the issues associated with overloading the 'public' keyword. For an example of the difficulties this causes, see the ugly workaround [3] in my recent commit [4]. Definately worth fixing this syntax. How do syntax changes with deprecations

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-03-02 Thread W. Trevor King
On Sat, Feb 26, 2011 at 07:11:48PM -0800, Robert Bradshaw wrote: > On Sat, Feb 26, 2011 at 6:14 PM, W. Trevor King wrote: > > On Sat, Feb 26, 2011 at 10:01:43AM -0800, Robert Bradshaw wrote: > >> On Sat, Feb 26, 2011 at 3:48 AM, W. Trevor King wrote: > >> > On Fri, Feb 25, 2011 at 11:11:03PM -080

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-26 Thread Robert Bradshaw
On Sat, Feb 26, 2011 at 6:14 PM, W. Trevor King wrote: > On Sat, Feb 26, 2011 at 10:01:43AM -0800, Robert Bradshaw wrote: >> On Sat, Feb 26, 2011 at 3:48 AM, W. Trevor King wrote: >> > On Fri, Feb 25, 2011 at 11:11:03PM -0800, Robert Bradshaw wrote: >> >> On Tue, Feb 22, 2011 at 12:02 PM, W. Trev

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-26 Thread W. Trevor King
On Sat, Feb 26, 2011 at 10:01:43AM -0800, Robert Bradshaw wrote: > On Sat, Feb 26, 2011 at 3:48 AM, W. Trevor King wrote: > > On Fri, Feb 25, 2011 at 11:11:03PM -0800, Robert Bradshaw wrote: > >> On Tue, Feb 22, 2011 at 12:02 PM, W. Trevor King wrote: > >> > An easy, if uglier, workaround would b

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-26 Thread Robert Bradshaw
On Sat, Feb 26, 2011 at 3:48 AM, W. Trevor King wrote: > On Fri, Feb 25, 2011 at 11:11:03PM -0800, Robert Bradshaw wrote: >> On Tue, Feb 22, 2011 at 12:02 PM, W. Trevor King wrote: >> > An easy, if uglier, workaround would be to prepend attributes with the >> > class name, e.g. CBinding.visibilit

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-26 Thread W. Trevor King
On Fri, Feb 25, 2011 at 11:11:03PM -0800, Robert Bradshaw wrote: > On Tue, Feb 22, 2011 at 12:02 PM, W. Trevor King wrote: > > An easy, if uglier, workaround would be to prepend attributes with the > > class name, e.g. CBinding.visibility -> CBinding.c_binding_visiblity. > > Then the Ctx class cou

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-25 Thread Stefan Behnel
W. Trevor King, 22.02.2011 21:02: On Tue, Feb 22, 2011 at 08:18:21PM +0100, Stefan Behnel wrote: I also doubt that Cython allows you to call an attribute "cdef", you'll need to change that. It seems to work for me: >>> import Cython.Compiler.Parsing as P >>> P.__file__ 'Cython/Compi

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-25 Thread Robert Bradshaw
On Tue, Feb 22, 2011 at 12:02 PM, W. Trevor King wrote: > On Tue, Feb 22, 2011 at 08:18:21PM +0100, Stefan Behnel wrote: >> W. Trevor King, 22.02.2011 18:55: >> > I've been working on a more explicit parser that removes the ambiguity >> > behind the various visibilities.  This will help me ensure

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-22 Thread W. Trevor King
On Tue, Feb 22, 2011 at 08:18:21PM +0100, Stefan Behnel wrote: > W. Trevor King, 22.02.2011 18:55: > > I've been working on a more explicit parser that removes the ambiguity > > behind the various visibilities. This will help me ensure proper > > impolementation of my cdef-ed enums/structs/..., an

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-22 Thread Stefan Behnel
W. Trevor King, 22.02.2011 18:55: I've been working on a more explicit parser that removes the ambiguity behind the various visibilities. This will help me ensure proper impolementation of my cdef-ed enums/structs/..., and make it easier to update visibility syntax in the future. Take a look an

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-22 Thread W. Trevor King
On Sat, Feb 19, 2011 at 06:31:26PM -0500, W. Trevor King wrote: > On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: > > On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: > > > Ah. Sorry for all the c(p)def/qualifier confusion, but I'm trying to > > > consolidate the way these

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Greg Ewing
Stefan Behnel wrote: The same argument could be brought up against "cdef" vs. "def" (between which the semantic difference is *huge*) There are a couple of differences: - 'cdef' and 'def' look very different (at least to me) because they *start* with a different letter. Whereas 'cdef' and 'c

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Stefan Behnel
Greg Ewing, 21.02.2011 22:12: Stefan Behnel wrote: With "preferred way", I was suggesting that we could *deprecate* cdef public int x cdef readonly object y for cdef class properties in favour of cpdef int x cpdef readonly object y I think I've just realised one of the reasons for my gut d

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Greg Ewing
Stefan Behnel wrote: With "preferred way", I was suggesting that we could *deprecate* cdef public int x cdef readonly object y for cdef class properties in favour of cpdef int x cpdef readonly object y I think I've just realised one of the reasons for my gut dislike of the "

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Robert Bradshaw
On Mon, Feb 21, 2011 at 10:26 AM, Stefan Behnel wrote: > Robert Bradshaw, 21.02.2011 19:11: >> >> On Sun, Feb 20, 2011 at 1:26 AM, Stefan Behnel wrote: >>> >>> W. Trevor King, 20.02.2011 00:31: On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: > > On Sat, Feb 19, 2

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Lisandro Dalcin
On 21 February 2011 15:26, Stefan Behnel wrote: > Robert Bradshaw, 21.02.2011 19:11: >> >> On Sun, Feb 20, 2011 at 1:26 AM, Stefan Behnel wrote: >>> >>> W. Trevor King, 20.02.2011 00:31: On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: > > On Sat, Feb 19, 2011 at

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Stefan Behnel
Robert Bradshaw, 21.02.2011 19:11: On Sun, Feb 20, 2011 at 1:26 AM, Stefan Behnel wrote: W. Trevor King, 20.02.2011 00:31: On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: It is unclear to me what `cdef public struct` m

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Robert Bradshaw
On Sun, Feb 20, 2011 at 1:26 AM, Stefan Behnel wrote: > W. Trevor King, 20.02.2011 00:31: >> >> On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: >>> >>> On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: It is unclear to me what `cdef public struct` means.  I think it

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-21 Thread Greg Ewing
Stefan Behnel wrote: Given that Cython has "cpdef" already, why not just use that? That seems like a reasonable idea. -- Greg ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread W. Trevor King
On Mon, Feb 21, 2011 at 10:09:42AM +1300, Greg Ewing wrote: > W. Trevor King wrote: > > Hmm, that means that > > > > cimport numpy > > a = numpy.numpy.ndarray > > > > also compiles. > > Compiles and runs, or just compiles? You're right. Cython compilation worked, but it didn't run:

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread Greg Ewing
W. Trevor King wrote: On Sat, Feb 19, 2011 at 04:41:27PM -0800, Robert Bradshaw wrote: On Sat, Feb 19, 2011 at 3:31 PM, W. Trevor King wrote: cython $ grep class Cython/Includes/numpy.pxd ctypedef class numpy.dtype [object PyArray_Descr]: ctypedef extern class numpy.flatiter [o

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread Stefan Behnel
Greg Ewing, 20.02.2011 21:13: Robert Bradshaw wrote: BTW, the "public" keyword is the wrong thing to use here, as that actually controls name mangling and (c-level) symbol exporting. The fact that means a different thing for members than for top-level symbols isn't ideal, but at least it's unam

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread Greg Ewing
Robert Bradshaw wrote: BTW, the "public" keyword is the wrong thing to use here, as that actually controls name mangling and (c-level) symbol exporting. The fact that means a different thing for members than for top-level symbols isn't ideal, but at least it's unambiguous as members need not be

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread Stefan Behnel
W. Trevor King, 20.02.2011 03:32: On Sat, Feb 19, 2011 at 04:41:27PM -0800, Robert Bradshaw wrote: On Sat, Feb 19, 2011 at 3:31 PM, W. Trevor King wrote: I think it's better to keep cdef meaning "backed by C data", not necessarily "written using C syntax", since you're trying to do more with Cy

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-20 Thread Stefan Behnel
W. Trevor King, 20.02.2011 00:31: On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: It is unclear to me what `cdef public struct` means. I think it should mean "Python bindings can alter this struct's definition", which does

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 6:32 PM, W. Trevor King wrote: > On Sat, Feb 19, 2011 at 04:41:27PM -0800, Robert Bradshaw wrote: >> On Sat, Feb 19, 2011 at 3:31 PM, W. Trevor King wrote: >> > On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: >> >> On Sat, Feb 19, 2011 at 1:45 PM, W. Trevo

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Sat, Feb 19, 2011 at 04:41:27PM -0800, Robert Bradshaw wrote: > On Sat, Feb 19, 2011 at 3:31 PM, W. Trevor King wrote: > > On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: > >> On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: > >> > On Sat, Feb 19, 2011 at 12:47:41PM -080

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 3:31 PM, W. Trevor King wrote: > On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: >> On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: >> > On Sat, Feb 19, 2011 at 12:47:41PM -0800, Robert Bradshaw wrote: >> >> On Sat, Feb 19, 2011 at 11:22 AM, W. Trev

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Sat, Feb 19, 2011 at 02:04:16PM -0800, Robert Bradshaw wrote: > On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: > > On Sat, Feb 19, 2011 at 12:47:41PM -0800, Robert Bradshaw wrote: > >> On Sat, Feb 19, 2011 at 11:22 AM, W. Trevor King wrote: > >> > However, the filename <-> module mappi

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 1:45 PM, W. Trevor King wrote: > On Sat, Feb 19, 2011 at 12:47:41PM -0800, Robert Bradshaw wrote: >> On Sat, Feb 19, 2011 at 11:22 AM, W. Trevor King wrote: >> >> >> > If you try to override anything in a .so compiled module at runtime, >> >> > you'd get the same kind of e

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Sat, Feb 19, 2011 at 12:47:41PM -0800, Robert Bradshaw wrote: > On Sat, Feb 19, 2011 at 11:22 AM, W. Trevor King wrote: > > >> > If you try to override anything in a .so compiled module at runtime, > >> > you'd get the same kind of error you currently do trying to rebind a > >> > compiled clas

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 1:06 PM, W. Trevor King wrote: > So should I go ahead and update the expected error messages in my branch? Yes. ___ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Sat, Feb 19, 2011 at 12:52:38PM -0800, Robert Bradshaw wrote: > On Sat, Feb 19, 2011 at 11:35 AM, W. Trevor King wrote: > > On Thu, Feb 17, 2011 at 03:53:13PM -0800, Robert Bradshaw wrote: > >> On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: > >> > * Extending class cdef/cdpef/public/re

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 11:35 AM, W. Trevor King wrote: > On Thu, Feb 17, 2011 at 03:53:13PM -0800, Robert Bradshaw wrote: >> On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: >> > * Extending class cdef/cdpef/public/readonly handling to cover enums, >> >  stucts, and possibly unions. >> >>

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 11:22 AM, W. Trevor King wrote: >> > If you try to override anything in a .so compiled module at runtime, >> > you'd get the same kind of error you currently do trying to rebind a >> > compiled class' method. >> >> That's the desired behavior for statically-bound globals,

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Thu, Feb 17, 2011 at 03:53:13PM -0800, Robert Bradshaw wrote: > On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: > > * Extending class cdef/cdpef/public/readonly handling to cover enums, > > stucts, and possibly unions. > > This seems like the best first step. > > > Problems with me ge

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread W. Trevor King
On Fri, Feb 18, 2011 at 02:08:04PM -0800, Robert Bradshaw wrote: > On Thu, Feb 17, 2011 at 8:38 PM, W. Trevor King wrote: > > On Thu, Feb 17, 2011 at 3:53 PM, Robert Bradshaw wrote: > >> On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: > >>> On Thu, Feb 17, 2011 at 01:25:10PM -0800, Robert B

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Robert Bradshaw
On Sat, Feb 19, 2011 at 1:24 AM, Stefan Behnel wrote: >>> A side effect of this cpdef change would be that now even bare .pxd >>> files (no matching .pyx) would have a Python presence, >> >> Where would it live? Would we just create this module (in essence, >> acting as if the

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-19 Thread Stefan Behnel
Robert Bradshaw, 18.02.2011 23:08: On Thu, Feb 17, 2011 at 8:38 PM, W. Trevor King wrote: On Thu, Feb 17, 2011 at 3:53 PM, Robert Bradshaw wrote: On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: Compilation is an issue. I think that .pxd files should be able to be cythoned directly, sin

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-18 Thread Robert Bradshaw
On Thu, Feb 17, 2011 at 8:38 PM, W. Trevor King wrote: > On Thu, Feb 17, 2011 at 3:53 PM, Robert Bradshaw wrote: >> On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: >>> On Thu, Feb 17, 2011 at 01:25:10PM -0800, Robert Bradshaw wrote: On Thu, Feb 17, 2011 at 5:29 AM, W. Trevor King wrote

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread Stefan Behnel
Robert Bradshaw, 18.02.2011 00:54: Forgot reply-all... didin't we have this discussion before about making that the default for this list as it is by-far the most common desired behavior? Yes we did. And I guess it would be "the default" for mailing lists if it was just that: a default, not so

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread W. Trevor King
On Thu, Feb 17, 2011 at 3:53 PM, Robert Bradshaw wrote: > On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: >> On Thu, Feb 17, 2011 at 01:25:10PM -0800, Robert Bradshaw wrote: >>> On Thu, Feb 17, 2011 at 5:29 AM, W. Trevor King wrote: >>> > On Wed, Feb 16, 2011 at 03:55:19PM -0800, Robert Brad

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread Robert Bradshaw
Forgot reply-all... didin't we have this discussion before about making that the default for this list as it is by-far the most common desired behavior? On Thu, Feb 17, 2011 at 3:53 PM, Robert Bradshaw wrote: > On Thu, Feb 17, 2011 at 3:12 PM, W. Trevor King wrote: >> On Thu, Feb 17, 2011 at 01:

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread W. Trevor King
On Thu, Feb 17, 2011 at 01:25:10PM -0800, Robert Bradshaw wrote: > On Thu, Feb 17, 2011 at 5:29 AM, W. Trevor King wrote: > > On Wed, Feb 16, 2011 at 03:55:19PM -0800, Robert Bradshaw wrote: > >> On Wed, Feb 16, 2011 at 8:17 AM, W. Trevor King wrote: > >> > What I'm missing is a way to bind the M

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread Robert Bradshaw
On Thu, Feb 17, 2011 at 5:29 AM, W. Trevor King wrote: > This thread is coming over to cython-dev (and the new cython-devel) > from cython-users because it turns out it will probably require > chaning the Cython code.  To get everyone who hasn't been following on > cython-users up to speed, here's

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread Lisandro Dalcin
On 17 February 2011 11:35, W. Trevor King wrote: > On Thu, Feb 17, 2011 at 10:53:15AM -0300, Lisandro Dalcin wrote: >> Cython could certainly support "cpdef struct", it is just a matter to >> define a proposal and find a contributor to implement it :-) > > Is there a CEP template (a la PEPs 9 and

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread W. Trevor King
On Thu, Feb 17, 2011 at 10:53:15AM -0300, Lisandro Dalcin wrote: > Cython could certainly support "cpdef struct", it is just a matter to > define a proposal and find a contributor to implement it :-) Is there a CEP template (a la PEPs 9 and 12) that should be discussed on the mailing list, or do I

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread W. Trevor King
On Thu, Feb 17, 2011 at 08:29:41AM -0500, W. Trevor King wrote: > cpdef struct Foo: > cpdef public int intA > cpdef readonly int intB > cdef void *ptr Oops, for consistency with classes, the variables declarations should read `cdef public` and and `cdef readonly`. Perh

Re: [Cython] [cython-users] Cython .pxd introspection: listing defined constants

2011-02-17 Thread W. Trevor King
This thread is coming over to cython-dev (and the new cython-devel) from cython-users because it turns out it will probably require chaning the Cython code. To get everyone who hasn't been following on cython-users up to speed, here's a summary of what I'm trying to do: That's what I was trying t