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 <wk...@drexel.edu> 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 <wk...@drexel.edu> 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 <wk...@drexel.edu> > >> >> 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 could subclass the current CtxAttribute classes > >> >> > instead of binding instances of each of them. That way Ctx would keep > >> >> > its traditional flat attribute namespace and easy deepcopy, but > >> >> > eveyone in Nodes, etc. that will use the attributes would become > >> >> > class-name dependent. > >> >> > >> >> I'd be up for flattening this. In particular, changing every > >> >> "entry.name" to "entry.python_binding.name" seems to be a lot of churn > >> >> and extra verbiage for not much benefit. The only overlap I see is > >> >> name and visibility, and keeping name/cname and adding cvisibility > >> >> would be preferable to me. > >> > > >> > That works for me, but I see possible ambiguity in cname. From the > >> > "external C code" docs: > >> > > >> > The other way is to use a C name specification to give different > >> > Cython and C names to the C function. Suppose, for example, that > >> > you want to wrap an external function called eject_tomato(). If > >> > you declare it as: > >> > > >> > cdef extern void c_eject_tomato "eject_tomato" (float speed) > >> > > >> > then its name inside the Cython module will be c_eject_tomato, > >> > whereas its name in C will be eject_tomato. > >> > > >> > In this case I was eventually going to use > >> > > >> > c_source.name = eject_tomato > >> > c_source.namespace = ... > >> > c_binding.name = c_eject_tomato > >> > c_binding.namespace = ... > >> > python_binding.name = eject_tomato > >> > > >> > I'm not sure how Cython handles name/cname with this case at the > >> > moment, but it seems like there are two cnames to keep track of. > >> > >> In this case, cname is "eject_tomato" (which actually gets emitted in > >> the C source file to use it) and name (in both Python and Cython > >> namespace) is "c_eject_tomato." > > > > What is the "Cython namespace"? Is that what you get when you cimport > > something (vs. the Python namespace being what you get when you import > > something). > > Yes, that would be a good way to understand it.
Okay, I'm back to a flat attribute namespace in my branch, and I'm moving through Nodes removing the places where I currently collapse back to an overloaded visibility. -- This email may be signed or encrypted with GPG (http://www.gnupg.org). The GPG signature (if present) will be attached as 'signature.asc'. For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy My public key is at http://www.physics.drexel.edu/~wking/pubkey.txt
pgpsvqE3jNR30.pgp
Description: PGP signature
_______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel