Re: [Cython] error when cythonizing unicode

2008-02-09 Thread Robert Bradshaw
I have a bunch of stuff, and several patches--hoping to release Cython 0.9.6.12 soon. - Robert On Feb 9, 2008, at 1:38 AM, Ondrej Certik wrote: On Feb 8, 2008 9:53 PM, Stefan Behnel [EMAIL PROTECTED] wrote: Hi, Ondrej Certik wrote: another bug was discovered in the Cython 0.9.6.11 in

Re: [Cython] Cython problem

2008-02-12 Thread Robert Bradshaw
This has been fixed for the next release of Cython. On Feb 5, 2008, at 1:32 PM, Robert Bradshaw wrote: This is a really strange bug...the following works: def f(**argsByName): tmp = [argsByname.get(argName,None) for argName in [a,b]] (aVal, bVal) = tmp Of course it's faster

[Cython] Cython 0.9.6.12 released

2008-02-13 Thread Robert Bradshaw
expanded testing framework. For more details, see the end of http://wiki.cython.org/ DifferencesFromPyrex and the changelog at http://hg.cython.org/ The main contributers in this release were Stefan Behnel and Robert Bradshaw, with much discussion and ideas from Kay Hayen and bug reports

Re: [Cython] minor bug -- cimport inside function

2008-02-25 Thread Robert Bradshaw
Thanks, I'll look into this. Note: it still isn't valid cython (as it doesn't make sense to cimport things locally, as cimports are resolved at compile time, not runtime. - Robert On Feb 24, 2008, at 8:11 PM, David Harvey wrote: If I run cython on the following file:

Re: [Cython] XSLT based optimisation

2008-03-10 Thread Robert Bradshaw
On Mar 9, 2008, at 5:40 AM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: Speaking specifically of XSLT, in your framework it would be possible to write a Transform that dumps out the tree as XML (like your printer, but fancier), runs some XSLT on it, then reads it back in. Most of my

Re: [Cython] Prototype for parametrized types

2008-03-10 Thread Robert Bradshaw
On Mar 10, 2008, at 12:10 AM, Stefan Behnel wrote: Hi, Dag Sverre Seljebotn wrote: The original proposal did not say anything about how to declare a variable. It does a) say something about how to declare/use a type, anywhere a type might be needed, b) use the current syntax for the

Re: [Cython] Another type idea

2008-03-10 Thread Robert Bradshaw
On Mar 10, 2008, at 3:26 PM, Dag Sverre Seljebotn wrote: Getting ideas after posting... One could also declare known return type of existing ptyhon lib functions like this: assumetype(cython.types.int, sum) def foo(arr): s = sum(arr) # s is now native C int leading to

Re: [Cython] [Pyrex] exposing extension class attributes

2008-03-18 Thread Robert Bradshaw
On Mar 18, 2008, at 5:04 PM, Greg Ewing wrote: Simon Burton wrote: Ie. the c attribute has an underscore in front of it, and from python the attribute is without underscore. As this is likely to drive me moderately crazy (keeping track of underscores) I am wondering how other people handle

Re: [Cython] Fast matrices over GF(p)

2008-03-22 Thread Robert Bradshaw
On Mar 21, 2008, at 3:40 PM, Simon King wrote: Dear Simon, dear Robert, Use these functions instead: cdef extern from Python.h: object PyString_FromStringAndSize(char *s, Py_ssize_t len) char* PyString_AsString(object string) Again, thank you for your valuable help! As part of

Re: [Cython] Syntax for writing C macros in a Cython .pxd

2008-03-24 Thread Robert Bradshaw
On Mar 23, 2008, at 10:12 AM, Stefan Behnel wrote: Hi, Neal Becker wrote: Stefan Behnel wrote: Martin C. Martin wrote: Stefan Behnel wrote: Well, in most cases macros are rather short code snippets, not function replacing code blocks. So I don't care about their symbols. That's

Re: [Cython] Syntax for writing C macros in a Cython .pxd

2008-03-24 Thread Robert Bradshaw
[somehow this got detached from the original thread...] On Mar 23, 2008, at 2:06 AM, Dag Sverre Seljebotn wrote: How do you do pointer arithmetic on Python objects? Remember the If you have Python objects stored in an array? Your macro casts the parameter to a pointer types, hence, you can

Re: [Cython] Summer Of Code

2008-03-26 Thread Robert Bradshaw
On Mar 26, 2008, at 1:04 PM, Fabrizio Milo aka misto wrote: Hi to everyone, I am interested in working on cython during the summer of Code. The objective would be to improve the support of Cython for Python 2.5 and 3000. I have some ideas on how to do that but not a detailed plan. That

Re: [Cython] ref-count overhead of function parameters

2008-03-27 Thread Robert Bradshaw
On Mar 27, 2008, at 6:31 AM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: There currently is a ref-count overhead. When that is removed, I wouldn't mind seeing inline functions as a macro replacement in many cases. But I'm pretty sure even then I see a couple of cases where I'd use

Re: [Cython] My SoC plan

2008-03-28 Thread Robert Bradshaw
On Mar 22, 2008, at 3:40 AM, Dag Sverre Seljebotn wrote: I've written over the last few weeks on my project proposal for a Google Summer of Code (SoC) project. Note that I do not yet have a SoC for this, I'm going to apply in the coming week. Still I post this to the mailing list because

Re: [Cython] [Bug 208262] [NEW] Invalid typedefs on Windows

2008-03-29 Thread Robert Bradshaw
I have got no idea on this one. Anyone using Cython/Pyrex on windows run into anything like this before? On Mar 28, 2008, at 7:21 AM, Chris Perkins wrote: Public bug reported: If I compile this one-liner pyx file on Windows: ctypedef int Int32 I can get this in my generated c file,

Re: [Cython] Small patch for __stdcall

2008-03-30 Thread Robert Bradshaw
Yes, it is in. Thanks. On Mar 17, 2008, at 5:08 PM, Jim Kleckner wrote: The following small patch gets rid of some warnings on the cygwin platform (it it not WIN32 but does have definitions of __stdcall resulting in warnings). Please let me know if it will or won't get into the upstream

Re: [Cython] Bug in DictNode

2008-03-31 Thread Robert Bradshaw
On Mar 31, 2008, at 1:36 AM, Dag Sverre Seljebotn wrote: Martin C. Martin wrote: Hi, Calling get_child_accessors() on a DictNode throws an exception, because, because it doesn't define a child_attrs field (and thus inherits the value None from class Node), so get_child_attrs() checks

Re: [Cython] cimport inside a package

2008-04-02 Thread Robert Bradshaw
cython -I. bar.pyx foo.so: foo.o gcc $(CFLAGS) -shared foo.o -o foo.so foo.o: foo.c gcc $(CFLAGS) -c foo.c -I/usr/include/python2.5 foo.c: foo.pyx cython -I. foo.pyx On Thu, 27 Mar 2008 13:25:45 -0700 Robert Bradshaw [EMAIL PROTECTED] wrote: What does your

Re: [Cython] Cython 0.9.6.13 Released

2008-04-05 Thread Robert Bradshaw
On Apr 4, 2008, at 9:27 PM, Michael.Abshoff wrote: Robert Bradshaw wrote: Hi All. Cython 0.9.6.13 is available for download at http://cython.org or http://pypi.python.org/pypi/Cython/0.9.6.13. The main improvements to this release are - C++ exception handling (Felix Wu) - (optional) C

Re: [Cython] Results of XPathTransform / W3CDOM experiments

2008-04-07 Thread Robert Bradshaw
On Apr 6, 2008, at 4:43 AM, Dag Sverre Seljebotn wrote: I'm still fooling around with some experiments. The following is now working (in my local repo) as a way of transforming for-froms: class ForInToForFrom(XPathTransform):

Re: [Cython] New project : Spyke python-to-C compiler

2008-04-08 Thread Robert Bradshaw
On Apr 7, 2008, at 5:48 PM, Rahul Garg wrote: Quoting Robert Bradshaw [EMAIL PROTECTED]: Thanks for answering. Do you mind if I forward this response to the cython mailing list? - Robert 1. Please forward if appropriate. Also include this reply please :) 2. I forgot to ask : Do you use

Re: [Cython] New project : Spyke python-to-C compiler

2008-04-08 Thread Robert Bradshaw
Forwarding some correspondence with an author of another Python-to-C compiler: On Apr 7, 2008, at 4:56 PM, Rahul Garg wrote: Quoting Robert Bradshaw [EMAIL PROTECTED]: Have you heard of Cython before? Do you have any thoughts on how it compares/overlaps/relates to Spyke? - Robert Hi. 1

Re: [Cython] python callback

2008-04-08 Thread Robert Bradshaw
Thanks. I just added it. On Apr 7, 2008, at 2:10 PM, Gabriel Gellner wrote: On Mon, Apr 07, 2008 at 07:35:27PM +0200, Stefan Behnel wrote: Gabriel Gellner wrote: Looking through the scipy odeint C wrapper, I realized the simple pattern to solve this (just having the callback call a global

Re: [Cython] Cython 0.9.6.13 Released

2008-04-08 Thread Robert Bradshaw
On Apr 7, 2008, at 2:25 AM, Stefan Behnel wrote: Hi Robert, thanks for this release. A few comments: The file MANIFEST shouldn't be in the repository as it's autogenerated from the file MANIFEST.in by distutils. Yep. Realized that after the fact. It's not in the directory any more.

Re: [Cython] Lisp inspired transforms

2008-04-08 Thread Robert Bradshaw
On Apr 8, 2008, at 9:47 AM, Dag Sverre Seljebotn wrote: +1 for polishing it and provide option c) as a plugin for now and see how it goes, and discuss inclusion in main Cython after it has proven itself. I'll have to take a closer look at your proposal and compare it a bit more to the

Re: [Cython] Lisp inspired transforms

2008-04-08 Thread Robert Bradshaw
On Apr 8, 2008, at 9:09 AM, Stefan Behnel wrote: Martin C. Martin wrote: Compile time metaprogramming doesn't exist in Python, so adding it to Cython means extending Cython beyond what Python has. Cython has a couple of additional features that make sense because it is a compiled

Re: [Cython] Another potential optimization possible with transforms

2008-04-09 Thread Robert Bradshaw
On Apr 9, 2008, at 8:25 AM, Martin C. Martin wrote: Hi, There's a potential optimization I mentioned on the Lisp inspired transforms page, where you could reorder bitfields in order to pack them most efficiently. Eerily, someone at my job just committed something that did just that. We

Re: [Cython] [sage-devel] Locally scoped dynamic memory (in SAGE and elsewhere)

2008-04-10 Thread Robert Bradshaw
On Apr 10, 2008, at 9:51 AM, Brian Granger wrote: Hi, (dual posted to sage and cython) A few of us (ipython and mpi4py devs) are wondering what the best/safest way of allocating dynamic memory in a local scope (method/function) is when using cython. An example would be if you need an

Re: [Cython] Proposal: idea for automatic management of dynamic memory

2008-04-11 Thread Robert Bradshaw
On Apr 11, 2008, at 2:56 AM, Dag Sverre Seljebotn wrote: (Hmm. I'm really not that against the approach. But I'll make sure the arguments against it are at least heard.) Yes, your input is valued! I see two kinds of uses for arrays in Cython: 1) Users that simply wants to allocate an array

Re: [Cython] void foo(void) illegal?

2008-04-11 Thread Robert Bradshaw
On Apr 11, 2008, at 3:53 PM, Lisandro Dalcin wrote: Whats the rationale of the following being illegal in Cython? cdef extern from bar.h: void foo(void) This is only because foo() is the way to specify a function with no arguments in Python. it is more useful to think of Cython as

Re: [Cython] a = b = (cdef) cval

2008-04-11 Thread Robert Bradshaw
On Apr 11, 2008, at 4:58 PM, Lisandro Dalcin wrote: It seems the code generated by cdef MyClass cval = MyClass() a = b = cval is not equivalent in semantics to Python, 'a is b' should be true. Actually it follows Python semantics exactly. It does not follow C semantics (which treats b =

Re: [Cython] introduce myself, and unimportant gcc warning...

2008-04-11 Thread Robert Bradshaw
On Apr 11, 2008, at 1:29 PM, Lisandro Dalcin wrote: Hi all, perhaps you remember my name from some previous posts (By Brian Granger) about automatic mem management. Hi. I have to say I thought your idea of using Strings as refocounted buffers was particularly clever :). I started to

Re: [Cython] Getting hands dirty -- phase refactoring

2008-04-12 Thread Robert Bradshaw
I think the way to go about this is to make inner functions into classes, with the bound variables being class members (c or Python types). This will also allow us to use the framework to do yield statements as well. - Robert On Apr 12, 2008, at 11:36 AM, Dag Sverre Seljebotn wrote: I

Re: [Cython] The newbie's question about wrapping c++ class with pyrex

2008-04-18 Thread Robert Bradshaw
On Apr 17, 2008, at 10:41 PM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: I'd like to add this example to the automated testing infrastructure, but it seems unclear how to do so with the current runtests.py. Hmm, sure it's a C++ example, so Cython/distutils will have to know

Re: [Cython] CEP 507/513

2008-04-18 Thread Robert Bradshaw
On Apr 18, 2008, at 12:53 AM, Dag Sverre Seljebotn wrote: Yes, I realize that CEP 513 must be cleaned up quite a bit at this stage (these things happen -- concepts aren't clear in my mind until a week has passed and I can write it for the third time. I suppose branding it a CEP right

Re: [Cython] Question about providing functions to existing C code

2008-04-18 Thread Robert Bradshaw
On Apr 15, 2008, at 10:05 AM, Johannes Wienke wrote: Hi, I hope this is the right way to ask questions about cython. I am currently wrappin an existing C plugin API into a Python project. The way from my plugin loader into the plugins is not the problem, but the original software provides a

Re: [Cython] reply-to header

2008-04-18 Thread Robert Bradshaw
On Apr 18, 2008, at 2:25 AM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: BTW, any specific reason you took these discussions off-list (as I think they would be general interest?) Ups! just because I simply pick 'reply' in Gmail, and you continued the thread writting to me and CC'ing

Re: [Cython] compilation doubts

2008-04-24 Thread Robert Bradshaw
On Apr 24, 2008, at 12:00 PM, Marco Zanger wrote: I made it work. The problem was somewhere else, but when I ran it i get the undefined symbol error that is described here. http://article.gmane.org/gmane.comp.python.cython.devel/1154/ match=undefined+symbol But i'm not sure what he

Re: [Cython] pxi or pxd for numpy?

2008-04-25 Thread Robert Bradshaw
On Apr 25, 2008, at 10:06 AM, Brian Granger wrote: Yes, it makes much more sense to call these .pxd files. Most people shouldn't need to deal with pxi files at all, but we can still keep them. Done. So, the official recommendation has changed - use .pxd unless you really just want simple

Re: [Cython] Cython's license

2008-04-25 Thread Robert Bradshaw
On Apr 25, 2008, at 10:00 AM, Stefan Behnel wrote: Hi, I must admit I've never read the PSF license until today. However, Cython is officially licensed under the PSF license. That doesn't really make sense, as this license is specific to Python itself. It is a license between the PSF and

Re: [Cython] Cython's license

2008-04-25 Thread Robert Bradshaw
On Apr 25, 2008, at 11:19 AM, William Stein wrote: On Fri, Apr 25, 2008 at 11:06 AM, Brian Granger [EMAIL PROTECTED] wrote: On Fri, Apr 25, 2008 at 11:16 AM, Robert Bradshaw [EMAIL PROTECTED] wrote: On Apr 25, 2008, at 10:00 AM, Stefan Behnel wrote: Hi, I must admit I've never read

[Cython] Code contribution from multiple authors

2008-04-25 Thread Robert Bradshaw
process. I would especially want to avoid having to hunt down every single contributer at this future date to make the change, despite the fact that the copyright remains with the authors. Thank you for your advice, Robert Bradshaw PGP.sig Description: This is a digitally signed message part

Re: [Cython] [Pyrex] C++ issue

2008-04-28 Thread Robert Bradshaw
In this case you might want to declare your variable to be *pointers* to the given classes, rather than the classes themselves. This will prevent c++ from trying to create them directly where the are declared (though you will then have to manually delete them when you're done with them).

Re: [Cython] replacing methods

2008-04-28 Thread Robert Bradshaw
On Apr 28, 2008, at 1:34 PM, Brian Blais wrote: On Apr 28, 2008, at Apr 28:3:13 PM, Robert Bradshaw wrote: You need to write mything.doit = classmethod(testit.doit) - Robert thanks, but now I get a different error. :) It feels like I am missing some bit of python magic

Re: [Cython] now a malloc/free-based way for tmp memory

2008-04-30 Thread Robert Bradshaw
On Apr 30, 2008, at 8:38 AM, Lisandro Dalcin wrote: Dear all, After the trick of using a string buffer for obtaining tmp memory and let python manage the automatic deallocation, now a pure malloc/free based way that does not need even to declare a custom class. It just used PyCObject objects

Re: [Cython] __getattribute__

2008-04-30 Thread Robert Bradshaw
On Apr 29, 2008, at 5:42 PM, Peter Todd wrote: Is there a __getattribute__ work-alike in Cython? Essentially I need direct control over an objects tp_getattro and tp_setattro slots to implement a wrapper class. Specificly wrapped.__class__ should go to the wrapped objects class attribute,

Re: [Cython] [Pyrex] Python 3

2008-05-01 Thread Robert Bradshaw
On Apr 29, 2008, at 4:16 PM, Christian Heimes wrote: Greg Ewing schrieb: Thanks, I didn't know that. So it seems that we could, if it were considered desirable, have an automatic cast from unicode to char *. But the encoding would *have* to be utf8 -- anything else would require memory

[Cython] Cython 0.9.6.14 released

2008-05-02 Thread Robert Bradshaw
Cython (Gary Furnish) - L.append(x) now optimized if L a (runtime) list (Robert Bradshaw) - Cdef variables may be declared python builtin types (CEP 507), though there is much more potential for optimization (Robert Bradshaw) - Enums declared public will get exported to the (python- accessible

Re: [Cython] Cython 0.9.6.14 release candidate

2008-05-02 Thread Robert Bradshaw
On May 2, 2008, at 12:46 AM, Kirill Smelkov wrote: Hi Stefan, On Fri, May 02, 2008 at 09:13:10AM +0200, Stefan Behnel wrote: Hi, Kirill Smelkov wrote: I still have 3 failures with latest cython-devel (b869698d6f22) Attached is a log of 'python runtests.py' run on Debian testing. Thanks.

Re: [Cython] code review

2008-05-05 Thread Robert Bradshaw
Guys, please don't get me wrong. I'm not saying let's use roundup, period. For amount of patches I observe I think plain cython-patches would do, and then, if needed, we could use any tool which would do the job. Only myself I observed that doing things in text editor is handy,

Re: [Cython] [Pyrex] newbie list processing question

2008-05-05 Thread Robert Bradshaw
On May 5, 2008, at 11:07 AM, Daniel Ashbrook wrote: So I've done a lot of Google searching and haven't found an answer to this question, or at least one that I understand. I'm trying to write some fairly simple list-processing code using pyrex. As a simple example, let's say I wanted to

Re: [Cython] [Pyrex] newbie list processing question

2008-05-05 Thread Robert Bradshaw
On May 5, 2008, at 11:46 AM, Daniel Ashbrook wrote: Robert Bradshaw wrote: def addOne(l): return [i+1 for i in l] ... This last implementation of addOne should work as is in Cython, and will be nearly optimal (assuming your CPU has reasonable branch prediction). However, if you

Re: [Cython] __getattribute__

2008-05-05 Thread Robert Bradshaw
On May 5, 2008, at 6:51 PM, Greg Ewing wrote: Peter Todd wrote: __getattr(ibute)__ support is now working with subclasses. Attached is an hg bundle of the two commits. Can someone send me these as plain text? I may want to incorporate them into Pyrex as well. Sure. Here you go. There are

Re: [Cython] non cdef'd class in a pyx file

2008-05-06 Thread Robert Bradshaw
This should work just fine. On May 6, 2008, at 10:19 AM, Brian Granger wrote: Hi, I am wondering if there are any issues with declaring a regular python class in a pyx file. Specifically, we need to define an exception like this: class FooError(Exception): ... I have done this

Re: [Cython] Visitor patterns and Python 2.4

2008-05-06 Thread Robert Bradshaw
On May 2, 2008, at 10:56 PM, Stefan Behnel wrote: Hi, Dag Sverre Seljebotn wrote: Are there any real reasons for leaving the Cython compiler (not talking about generated or supported code of course) at Python 2.3, rather than a small bump to 2.4? Reason: I'd like decorators. The

Re: [Cython] Some small phase refactorings

2008-05-06 Thread Robert Bradshaw
On May 3, 2008, at 1:27 AM, Dag Sverre Seljebotn wrote: +import Cython.Compiler.Transforms.Analysis as Analysis +Analysis.CreateFunctionScope()(self, env=env) +Analysis.AnalyseControlFlow()(self, env=env) +Analysis.AnalyseFunctionBodyDeclarations()(self,

Re: [Cython] PyPy parser

2008-05-07 Thread Robert Bradshaw
On May 7, 2008, at 8:08 AM, Fabrizio Milo aka misto wrote: Doesn't if it ain't broken, don't fix it apply here? The fact is that it actually breaks with Python 3.0 :) Yes, this is true. Actually modifying the parser to accept, for example, decorators will be easy. With statements are already

Re: [Cython] Debugging with valgrind

2008-05-08 Thread Robert Bradshaw
On May 8, 2008, at 8:30 AM, Michael Abshoff wrote: Robert Bradshaw wrote: On May 7, 2008, at 10:46 PM, Stefan Behnel wrote: Hi, Yes, that's where we took the suppression file from that we use for lxml. http://codespeak.net/svn/lxml/trunk/valgrind-python.supp I am actually pretty

Re: [Cython] __getattribute__

2008-05-08 Thread Robert Bradshaw
Thanks! It works great for me. On May 4, 2008, at 8:37 PM, Peter Todd wrote: On Sun, May 04, 2008 at 01:15:32AM -0400, Peter Todd wrote: Here's my first patch. This correctly implements __getattribute__ and __getattr__ in the single class case. FWIW I also have a mercurial tree if it'd be

Re: [Cython] Abandon support for Python 2.3?

2008-05-08 Thread Robert Bradshaw
On May 8, 2008, at 10:30 AM, Robert Kern wrote: On Thu, May 8, 2008 at 12:27 PM, Stefan Behnel [EMAIL PROTECTED] wrote: Hi, Robert Kern wrote: On Thu, May 8, 2008 at 11:08 AM, Robert Bradshaw [EMAIL PROTECTED] wrote: As mentioned in another thread, we are considering requiring Python

Re: [Cython] Fwd: working patch for generating code targeting Py 2.6 and Py 3.0

2008-05-08 Thread Robert Bradshaw
On May 8, 2008, at 11:12 AM, Lisandro Dalcin wrote: On 5/8/08, Robert Bradshaw [EMAIL PROTECTED] wrote: Thanks. I briefly glanced at it and it looks good. What you probably want to do is commit and then export the patch (that way it will have some history attached, and you'll get credit

Re: [Cython] Python type optimizations (NumPy GSoC-related)

2008-05-09 Thread Robert Bradshaw
On May 9, 2008, at 3:13 AM, Dag Sverre Seljebotn wrote: I think there's a fundamental flaw to my NumPy proposal, which need correction. I've thought about it as polishing the access to the extension type, so that after cdef object x = numpy.zeros([3,3]) cdef numpy.ndarray y = x y will

Re: [Cython] ANN: Pyrex 0.9.7

2008-05-11 Thread Robert Bradshaw
On May 10, 2008, at 5:04 PM, Greg Ewing wrote: Stefan Behnel wrote: Wouldn't special casing a type test for builtins and extension classes be better here than adding new functions? I'm not sure what you mean by that. There's no run-time distinction between a builtin class, an extension

Re: [Cython] Language stability

2008-05-11 Thread Robert Bradshaw
On May 11, 2008, at 1:14 AM, Dag Sverre Seljebotn wrote: Given recent developments (Pyrex release with new syntax and Arc's new project) I think Cython should make some public website statements on language policy and stability. I think these are already present in the community spirit, but

Re: [Cython] Python type optimizations (NumPy GSoC-related)

2008-05-11 Thread Robert Bradshaw
On May 11, 2008, at 2:50 AM, Greg Ewing wrote: Another thing to consider is how this would interact with subclassing. Will it be legal to do something like cdef class B(A(len=10)): ... and if so, how does the initialisation of B ensure that the length constraint is satisfied? No,

Re: [Cython] Python type optimizations (NumPy GSoC-related)

2008-05-12 Thread Robert Bradshaw
On May 11, 2008, at 2:00 PM, Dag Sverre Seljebotn wrote: Ok, been thinking some more. To sum up, what we're after is some way of having the following work (A is a class with a value field, printme is a method somehow selected for inlining and optimization for Cython): cdef A a =

Re: [Cython] Language stability

2008-05-12 Thread Robert Bradshaw
On May 12, 2008, at 2:18 AM, Stefan Behnel wrote: Hi, Dag Sverre Seljebotn wrote: I think from __future__ import division is an excellent example of supporting multiple language levels in a nice way, it is not that horrible to do. BTW, I actually think we need to support that anyway if we

Re: [Cython] assigning to struct member

2008-05-12 Thread Robert Bradshaw
On May 12, 2008, at 10:33 AM, Johannes Wienke wrote: Am 05/12/2008 04:12 PM schrieb Lisandro Dalcin: Do you also have a 'cdef class plugData' defined somewhere ? No, do I need that? No, you don't. On 5/12/08, Johannes Wienke [EMAIL PROTECTED] wrote: Hi again, maybe I'm blind or I

Re: [Cython] cython add vs __add__

2008-05-13 Thread Robert Bradshaw
On May 12, 2008, at 5:32 PM, Greg Ewing wrote: Dag Sverre Seljebotn wrote: Wouldn't it be an idea (well, I suppose it's too late now, just wondering what you think) to call it __cadd__ instead then? If I were designing Pyrex over again, I might do something like that. But then people would

Re: [Cython] defining module constants

2008-05-13 Thread Robert Bradshaw
On May 12, 2008, at 10:55 PM, Anatoly A. Kazantsev wrote: On Mon, 12 May 2008 10:05:20 -0700 Robert Bradshaw [EMAIL PROTECTED] wrote: Could you clarify? I did add something that lets you do cdef public enum foo: a b c = 10 ... and theses will be exported into the public

Re: [Cython] assigning to struct member

2008-05-13 Thread Robert Bradshaw
On May 12, 2008, at 8:49 PM, Greg Ewing wrote: Lisandro Dalcin wrote: That's what Robert warned you about!! Indeed, you have two definitions of plugData: Although there appears to be a compiler bug there somewhere, as it *should* have complained about a redefinition of plugData. IIRC,

Re: [Cython] Python type optimizations (NumPy GSoC-related)

2008-05-13 Thread Robert Bradshaw
On May 12, 2008, at 11:10 AM, Dag Sverre Seljebotn wrote: (Rearranged email to order of urgency.) type of the object. Another problem is that is specifically requires one to declare ahead of time what compile-time assumptions can be made, rather than letting the user of the .pxd file specify

Re: [Cython] [Pyrex] Language stability

2008-05-13 Thread Robert Bradshaw
On May 13, 2008, at 5:15 AM, Stefan Behnel wrote: Hi Greg, Greg Ewing wrote: where the (IMHO much more obvious) cdef + range() syntax is optimised Even in the presence of this optimisation, I don't consider that the integer for-loop syntax is entirely redundant. Not redundant, no. But

Re: [Cython] status update on Py3 support

2008-05-13 Thread Robert Bradshaw
On May 13, 2008, at 5:20 PM, Greg Ewing wrote: Stefan Behnel wrote: A good idea might be to actually remove the string interning Option and *always* intern identifiers That option will probably disappear from Pyrex at some point anyway. It's only there because I wasn't sure if string

Re: [Cython] [Pyrex] Language stability

2008-05-14 Thread Robert Bradshaw
On May 13, 2008, at 12:07 PM, Stefan Behnel wrote: I do think optimizing enumerate/zip/etc is feasible and probably worthwhile. I'm just concerned about too many special cases in the optimiser. If we start optimising these (and I would prefer giving range(), zip () friends their Py3

Re: [Cython] [Pyrex] Language stability

2008-05-14 Thread Robert Bradshaw
On May 14, 2008, at 6:27 AM, Stefan Behnel wrote: Robert Bradshaw wrote: I'm not sure how much this would help (it would some for sure), as I believe many of these iterators are already written in C and it's a series of C calls. I think the biggest savings is that cdef int i

Re: [Cython] [PATCH] RFC: constify Cython output all over the place ( newbie approach )

2008-05-14 Thread Robert Bradshaw
On May 14, 2008, at 9:50 AM, Kirill Smelkov wrote: В сообщении от Среда 14 мая 2008 Kirill Smelkov написал(a): # HG changeset patch # User Kirill Smelkov [EMAIL PROTECTED] # Date 1210783363 -14400 # Node ID 9107d71e527446535929608e5003744caceb6238 # Parent

Re: [Cython] [PATCH] RFC: constify Cython output all over the place ( newbie approach )

2008-05-14 Thread Robert Bradshaw
On May 14, 2008, at 10:21 AM, Kirill Smelkov wrote: В сообщении от Среда 14 мая 2008 Robert Bradshaw написал(a): On May 14, 2008, at 9:50 AM, Kirill Smelkov wrote: Also, please forgive me, if I'm doing something wrong -- I just don't know what the full workflow cycle is with http

Re: [Cython] Fix for raising exceptions from iterator bug

2008-05-14 Thread Robert Bradshaw
Pinging the list is probably a good idea until I get the other mailing list set up--which won't happen until next week at the earliest. BTW, thanks for the fix. On May 14, 2008, at 1:13 PM, Dag Sverre Seljebotn wrote: Stupid question perhaps: Should stuff like this to the mailing list until

Re: [Cython] defining module constants

2008-05-14 Thread Robert Bradshaw
On May 13, 2008, at 9:28 AM, Anatoly A. Kazantsev wrote: On Tue, 13 May 2008 14:49:11 +0700 Anatoly A. Kazantsev [EMAIL PROTECTED] wrote: I have next code and it's not working properly. In foo.h somebody wrote: #define BAR 1 than I want to define module constant with same name and value:

Re: [Cython] about numpy, c/python namespaces and name clashes, and some tricks ; -)

2008-05-14 Thread Robert Bradshaw
On May 13, 2008, at 8:28 AM, Lisandro Dalcin wrote: On 5/13/08, Robert Bradshaw [EMAIL PROTECTED] I am having trouble understanding exactly what you're trying to accomplish here--what is the correspondence between strides and cstrides, and how will they be kept in sync? I'm just

Re: [Cython] about numpy, c/python namespaces and name clashes, and some tricks ; -)

2008-05-15 Thread Robert Bradshaw
On May 15, 2008, at 12:33 AM, Dag Sverre Seljebotn wrote: My proposal is that for someone coming from using NumPy from Python, they only need declare their object (say x) as being a numpy array, and then all access to x.shape is suddenly faster rather than having to remember a new way to

Re: [Cython] about numpy, c/python namespaces and name clashes, and some tricks ; -)

2008-05-15 Thread Robert Bradshaw
On May 15, 2008, at 2:20 AM, Dag Sverre Seljebotn wrote: cdef FsAsObj d = FsAsObj() d = d.usr.include call_native_c_function(d.fshandle) Then I do $ sudo mkdir /fshandle No, actually you're right. With the addition of your type behaviour suggestions one could do cdef FsAsObj mydir =

Re: [Cython] about numpy, c/python namespaces and name clashes, and some tricks ; -)

2008-05-15 Thread Robert Bradshaw
On May 15, 2008, at 1:49 AM, Dag Sverre Seljebotn wrote: (cdef object s = arr.shape should work though, but I consider that GSoC-stuff, not something you can fake at this stage.) Doesn't that work now? Well, it works because the C-version is called dimensions. But cdef object s =

Re: [Cython] from __future__ import ...

2008-05-15 Thread Robert Bradshaw
On May 15, 2008, at 2:09 PM, Lisandro Dalcin wrote: On 5/15/08, Dag Sverre Seljebotn [EMAIL PROTECTED] wrote: Lisandro Dalcin wrote: On 5/15/08, Dag Sverre Seljebotn [EMAIL PROTECTED] wrote: I think: - The default Python language level for the pyx source when Cython is run should

Re: [Cython] Generators (closures) to be supported?

2008-05-15 Thread Robert Bradshaw
In the very near term, I am swamped with non-cython related stuff, but plan to do generator support (and closures in general) before or during dev days this June. - Robert On May 15, 2008, at 6:08 PM, Jason Evans wrote: I see conflicting information on whether there is any intention to

Re: [Cython] Generators (closures) to be supported?

2008-05-15 Thread Robert Bradshaw
On May 15, 2008, at 7:57 PM, Greg Ewing wrote: Robert Bradshaw wrote: In the very near term, I am swamped with non-cython related stuff, but plan to do generator support (and closures in general) before or during dev days this June. Do you have any ideas on how you intend to implement

Re: [Cython] cython-devel-py3: __future__ in Future.py

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 1:47 AM, Dag Sverre Seljebotn wrote: Sorry, that was a bug. It should have been done the way you proposed (that's the moments when I'm happy to work on a branch and not on cython- devel). (This is not retorical, I want to ask and learn about how the repos should be

Re: [Cython] string literals in Py2 vs Py3

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 2:41 AM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: The behavior of the module should depend mostly on the Cython compilation environment/flags. However, for (unmarked) string literals I think we should decide based on the C compilation stage. This makes things

Re: [Cython] string literals in Py2 vs Py3

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 1:43 PM, Lisandro Dalcin wrote: On 5/16/08, Robert Bradshaw [EMAIL PROTECTED] wrote: I haven't played with Py3. I was actually (pleasantly) surprised it worked in Py2, but if it's being discontinued then it doesn't help my case. But it does mean that stuff like

Re: [Cython] Status update: Transform utilities

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 9:41 AM, Dag Sverre Seljebotn wrote: I'll create a ticket shortly containing my local branch so far. (The phase refactorings I've posted earlier is *not* included, this is all useful stuff :-) ). If anybody wants to start a process of applying it or discuss it then

Re: [Cython] from __future__ import ...

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 9:45 PM, Stefan Behnel wrote: Hi, Stefan Behnel wrote: Lisandro Dalcin wrote: in Python 2.6 abc and babc both return a byte string 'str' type, and 'bytes' type is an alias for 'str' type. As I said before, that's fine with me. Done. Cython can now parse abc

Re: [Cython] string literals in Py2 vs Py3

2008-05-16 Thread Robert Bradshaw
On May 16, 2008, at 10:29 PM, Stefan Behnel wrote: Hi, Robert Bradshaw wrote: --- a.pyx --- def foo(x): if x 0: return good else: return bad - import a print 3 is %s % a.foo(3) won't work in both Py2 and Py3, which I think it should

Re: [Cython] string literals in Py2 vs Py3

2008-05-18 Thread Robert Bradshaw
On May 17, 2008, at 2:45 PM, Dag Sverre Seljebotn wrote: Stefan Behnel wrote: Hi, Robert Bradshaw wrote: On May 17, 2008, at 12:28 PM, Stefan Behnel wrote: My point is that if they're not required to do anything to be ready for Py3, why force them to do so? If I want to use someone else's

Re: [Cython] Compile-time duck typing

2008-05-22 Thread Robert Bradshaw
On May 22, 2008, at 11:35 AM, Dag Sverre Seljebotn wrote: Stefan wrote: Hi, Dag Sverre Seljebotn wrote: http://wiki.cython.org/enhancements/compiledducktyping Isn't the overloading stuff what PEP 3124 is heading for? http://www.python.org/dev/peps/pep-3124/ I think parameter

Re: [Cython] Status update: Transform utilities

2008-05-23 Thread Robert Bradshaw
On May 17, 2008, at 12:36 PM, Dag Sverre Seljebotn wrote: If it helps with the funny feeling, the string is only parsed directly in the constructor for TreeFragment (and it accepts a more directly created node structure too). So the string disappears from the story after module load time;

Re: [Cython] Compile-time duck typing

2008-05-24 Thread Robert Bradshaw
On May 24, 2008, at 10:16 AM, Dag Sverre Seljebotn wrote: Robert wrote: Perhaps put an example of a __getitem__ method that uses this feature. It seems mostly this could be handled with plain old function overloading, but this would be a nice feature to have in and of itself. Yes, will do

Re: [Cython] Recursive vs. visitor pattern

2008-05-24 Thread Robert Bradshaw
On May 24, 2008, at 10:24 AM, Dag Sverre Seljebotn wrote: Robert wrote: On May 21, 2008, at 7:16 PM, Greg Ewing wrote: What sort of things were you intending to do in between type analysis and coercion? Could they still be done under these restrictions? The phase that I'd like to stick

Re: [Cython] use of __del__

2008-05-24 Thread Robert Bradshaw
No, use the __dealloc__ method instead. On May 24, 2008, at 10:59 AM, Johannes Wienke wrote: Hi, is it possible to use __del__ in cython? A first try didn't succeed: cpdef class Foo: def __del__(self): print Foo::__del__ from ship.test import Foo f = Foo() del f no output Any

Re: [Cython] Compile-time duck typing

2008-05-24 Thread Robert Bradshaw
with making unpacking not involve object coercions. Robert Bradshaw wrote: On May 24, 2008, at 1:03 PM, Dag Sverre Seljebotn wrote: Instantiation (1) of the function is symmetric to this, raising an exception if control reaches the place where the integer is returned. So the end result

  1   2   3   4   5   6   7   8   9   10   >