Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new features from latest Cython #250

Open
cztomczak opened this issue Sep 17, 2016 · 1 comment
Open

Use new features from latest Cython #250

cztomczak opened this issue Sep 17, 2016 · 1 comment

Comments

@cztomczak
Copy link
Owner

cztomczak commented Sep 17, 2016

See Cython's changelog:
https://github.com/cython/cython/blob/master/CHANGES.rst

Interesting changes in 0.28:

Interesting changes in 0.27:

Interesting changes in 0.26:

  • Faster GIL re-entry with the directive fast_gil=True. It tries to remember the current GIL lock state in the fast thread local storage and avoids costly calls into the thread and GIL handling APIs if possible, even when calling across multiple Cython modules.

Interesting changes in 0.25:

  • Dynamic Python attributes are allowed on cdef classes if an attribute cdef dict dict is declared in the class.
  • Cython implemented C++ classes can make direct calls to base class methods.
  • C++ classes can now have typedef members.
  • for-loop iteration over "std::string".

Interesting changes <= 0.24.1:

  • C++ classes can now be declared with default template parameters.
  • PEP 498: Literal String Formatting (f-strings). Original patch by Jelle Zijlstra. https://www.python.org/dev/peps/pep-0498/
  • Const iterators were added to the provided C++ STL declarations.
  • External C++ classes that overload the assignment operator can be used.
  • Support operator bool() for C++ classes so they can be used in if statements.
  • Cpdef enums are now first-class iterable, callable types in Python.
  • Enums can now be declared as cpdef to export their values to the module's Python namespace. Cpdef enums in pxd files export their values to their own module, iff it exists.
  • C++ class static methods can now be imported using @staticmethod. Allow @staticmethod decorator to declare static cdef methods. This is especially useful for declaring "constructors" for cdef classes that can take non-Python arguments.
  • C functions can coerce to Python functions, which allows passing them around as callable objects.
  • Extern C functions can now be declared as cpdef to export them to the module's Python namespace. Extern C functions in pxd files export their values to their own module, iff it exists.
  • Support for calling C++ template functions. We already use some C++ template functions, but now it can be done in a more convenient way, the same way importing of C++ template classes work.
  • Using cdef basestring stringvar and function arguments typed as basestring is now meaningful and allows assigning exactly str and unicode objects, but no subtypes of these types
  • Added a build_dir option to cythonize() which allows one to place the generated .c files outside the source tree.
  • External C++ classes can be declared nogil.
  • C++ STL container classes automatically coerce from and to the equivalent Python container types on typed assignments and casts. Note that the data in the containers is copied during this conversion.
  • C++ iterators can now be iterated over using "for x in cpp_container" whenever cpp_container has begin() and end() methods returning objects satisfying the iterator pattern (that is, it can be incremented, dereferenced, and compared (for non-equality)).
  • cdef classes can now have C++ class members (provided a zero-argument constructor exists)
@cztomczak cztomczak changed the title Use new features from latest Cython Use new features from the latest Cython Sep 26, 2016
@cztomczak cztomczak changed the title Use new features from the latest Cython Use new features from latest Cython Sep 26, 2016
@cztomczak
Copy link
Owner Author

Cython 0.28.4 is now supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant