Re: [Cython] [cython-users] Re: Cython Typed Memoryviews versus Cython+Numpy Speed ups

2013-04-19 Thread Stefan Behnel
Robert Bradshaw, 17.04.2013 06:02:
> On Tue, Apr 16, 2013 at 6:46 PM, pythonOmetrist
>> Attached HTML seems mostly white, and not clear where to go from here. Nogil
>> seems to be one option.
> 
> Just a brief glance at the code, you have a lot of n_k_w[x][y] which
> is vastly more expensive than n_k_w[x, y].

Is that always equivalent? If so, we might want to transform it internally.

Stefan

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] Cython 0.19 released

2013-04-19 Thread Stefan Behnel
Hi all,

Cython 0.19 has cleared the dockyard. This is a feature release that adds
some major usability features especially for code that needs to run in both
Py2 and Py3, as well as better Python compatibility and optimisations.

You can get it from here:

http://cython.org/release/Cython-0.19.tar.gz

http://cython.org/release/Cython-0.19.zip

Release notes:
https://github.com/cython/cython/blob/29bf3493fdc80cb3261a9dfb9f73e3ccd46fec66/CHANGES.rst

Documentation: http://docs.cython.org/


The major new features include:

* New directives ``c_string_type`` and ``c_string_encoding`` to
  automatically convert between C strings and the different Python
  string types.

* Keyword arguments are supported for cdef functions, including external
  C/C++ functions.

* New freelist decorator for extension types.

* Fast extension type instantiation using the ``Type.__new__(Type)`` idiom
  has gained support for passing arguments.

* Slicing was optimised for several builtin types and otherwise conforms
  better with Python semantics for user defined types.

* The mapping of dict view/item methods in Python 3 was improved.


Have fun,

Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [cython] Autodoc improvements (#216)

2013-04-19 Thread Stefan Behnel
Nikita Nemkin, 18.04.2013 07:07:
> Three improvements are included in this patch that I have found helpful when 
> using Sphinx autodoc to document my project:
> 
> 1) Default values preserve and display binary expressions and attribute 
> access. For example, the following function will have its signature displayed 
> as is:
>  
> cpdef func(int flags=MyModule.FLAG1 | MyModule.FLAG2)
> 
> This only affects expressions not reducible at compilation time, i.e. `2+2` 
> will appear as `4`.
> 
> 2) Public/readonly cdef attributes can have docstrings attached, using the 
> [PEP 258 attribute docstring 
> syntax](http://www.python.org/dev/peps/pep-0258/#attribute-docstrings). 
> Example:
> 
> cdef class X:
> cdef public attr
> """attr docstring"""
> 
> When ``embedsignature=True`` Cython already adds a signature docstring to the 
> generated property (assuming the example above). This patch allows to add an 
> actual docstring too.
> 
> Dosctrings on private cdef attributes will give a warning ("docstring 
> ignored").
> Other forms and uses of attribute docstrings, as described in the PEP 258, 
> are not supported at all (SyntaxError), because there is no standard 
> introspection mechanism designed for them. ([PEP 
> 224](http://www.python.org/dev/peps/pep-0224/) describing such mechanism had 
> been rejected.)
> 
> 3) `bint` appears as `bool` (instead of `int`) in autogenerated signatures, 
> as I suggested on the mailing list.
> 
> Each change is contained in its own commit in case you want to review them 
> separately.
>
> https://github.com/cython/cython/pull/216

I like 1) and 3), but I'm not sure about 2).

Worth noting that PEP 258 was rejected, although definitely for other
reasons than this feature. I remember discussing this topic before on the
mailing list, but don't remember if we reached a conclusion. I faintly
recall that we preferred making the property explicit as soon as there's
more to it than a plain 1:1 mapping to the cdef attribute.

The above syntax is not wrong, but it also doesn't feel right to me. For
example, it's impossible to draw a distinction between the above and
something like

 cdef class X:
 cdef public attr

 """
 quotes used for commenting out code here.
 """

And users are unlikely to notice that they just dropped some internals into
the docstring of a property they didn't even know they were implementing.

IMHO, the user intention is way too unclear in this syntactic construct.

Stefan

___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] gsoc-kurt-regraft branch and ticket #469

2013-04-19 Thread Stefan Behnel
Hi,

since the current code base can explicitly express dependencies between
utility code sections, do we still need this branch? Or can we close it
together with the ticket?

ISTM that explicit dependencies are a more general feature than just
honouring type hierarchies.

Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel