Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
fa7f2832
Commit
fa7f2832
authored
Feb 01, 2013
by
Yury V. Zaytsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove extra commas before colons (,:: -> ::)
parent
3f788f04
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
+18
-18
docs/src/userguide/extension_types.rst
docs/src/userguide/extension_types.rst
+8
-8
docs/src/userguide/external_C_code.rst
docs/src/userguide/external_C_code.rst
+5
-5
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+4
-4
docs/src/userguide/sharing_declarations.rst
docs/src/userguide/sharing_declarations.rst
+1
-1
No files found.
docs/src/userguide/extension_types.rst
View file @
fa7f2832
...
@@ -56,7 +56,7 @@ first method, but Cython code can use either method.
...
@@ -56,7 +56,7 @@ first method, but Cython code can use either method.
By default, extension type attributes are only accessible by direct access,
By default, extension type attributes are only accessible by direct access,
not Python access, which means that they are not accessible from Python code.
not Python access, which means that they are not accessible from Python code.
To make them accessible from Python code, you need to declare them as
To make them accessible from Python code, you need to declare them as
:keyword:`public` or :keyword:`readonly`. For example
,
::
:keyword:`public` or :keyword:`readonly`. For example::
cdef class Shrubbery:
cdef class Shrubbery:
cdef public int width, height
cdef public int width, height
...
@@ -85,7 +85,7 @@ generic Python object. It knows this already in the case of the ``self``
...
@@ -85,7 +85,7 @@ generic Python object. It knows this already in the case of the ``self``
parameter of the methods of that type, but in other cases you will have to use
parameter of the methods of that type, but in other cases you will have to use
a type declaration.
a type declaration.
For example, in the following function
,
::
For example, in the following function::
cdef widen_shrubbery(sh, extra_width): # BAD
cdef widen_shrubbery(sh, extra_width): # BAD
sh.width = sh.width + extra_width
sh.width = sh.width + extra_width
...
@@ -104,7 +104,7 @@ follows::
...
@@ -104,7 +104,7 @@ follows::
Now the Cython compiler knows that ``sh`` has a C attribute called
Now the Cython compiler knows that ``sh`` has a C attribute called
:attr:`width` and will generate code to access it directly and efficiently.
:attr:`width` and will generate code to access it directly and efficiently.
The same consideration applies to local variables, for example
,
::
The same consideration applies to local variables, for example::
cdef Shrubbery another_shrubbery(Shrubbery sh1):
cdef Shrubbery another_shrubbery(Shrubbery sh1):
cdef Shrubbery sh2
cdef Shrubbery sh2
...
@@ -396,7 +396,7 @@ that need to refer to each other, e.g.::
...
@@ -396,7 +396,7 @@ that need to refer to each other, e.g.::
If you are forward-declaring an extension type that has a base class, you must
If you are forward-declaring an extension type that has a base class, you must
specify the base class in both the forward declaration and its subsequent
specify the base class in both the forward declaration and its subsequent
definition, for example
,
::
definition, for example::
cdef class A(B)
cdef class A(B)
...
@@ -410,7 +410,7 @@ Making extension types weak-referenceable
...
@@ -410,7 +410,7 @@ Making extension types weak-referenceable
By default, extension types do not support having weak references made to
By default, extension types do not support having weak references made to
them. You can enable weak referencing by declaring a C attribute of type
them. You can enable weak referencing by declaring a C attribute of type
object called :attr:`__weakref__`. For example
,
::
object called :attr:`__weakref__`. For example::
cdef class ExplodingAnimal:
cdef class ExplodingAnimal:
"""This animal will self-destruct when it is
"""This animal will self-destruct when it is
...
@@ -507,7 +507,7 @@ Implicit importing
...
@@ -507,7 +507,7 @@ Implicit importing
------------------
------------------
Cython requires you to include a module name in an extern extension class
Cython requires you to include a module name in an extern extension class
declaration, for example
,
::
declaration, for example::
cdef extern class MyModule.Spam:
cdef extern class MyModule.Spam:
...
...
...
@@ -521,13 +521,13 @@ example an implicit::
...
@@ -521,13 +521,13 @@ example an implicit::
statement will be executed at module load time.
statement will be executed at module load time.
The module name can be a dotted name to refer to a module inside a package
The module name can be a dotted name to refer to a module inside a package
hierarchy, for example
,
::
hierarchy, for example::
cdef extern class My.Nested.Package.Spam:
cdef extern class My.Nested.Package.Spam:
...
...
You can also specify an alternative name under which to import the type using
You can also specify an alternative name under which to import the type using
an as clause, for example
,
::
an as clause, for example::
cdef extern class My.Nested.Package.Spam as Yummy:
cdef extern class My.Nested.Package.Spam as Yummy:
...
...
...
...
docs/src/userguide/external_C_code.rst
View file @
fa7f2832
...
@@ -87,7 +87,7 @@ match the C ones, and in some cases they shouldn't or can't. In particular:
...
@@ -87,7 +87,7 @@ match the C ones, and in some cases they shouldn't or can't. In particular:
to platform-dependent flavours of numeric types, you will need a
to platform-dependent flavours of numeric types, you will need a
corresponding :keyword:`ctypedef` statement, but you don't need to match
corresponding :keyword:`ctypedef` statement, but you don't need to match
the type exactly, just use something of the right general kind (int, float,
the type exactly, just use something of the right general kind (int, float,
etc). For example
,
::
etc). For example::
ctypedef int word
ctypedef int word
...
@@ -185,7 +185,7 @@ Accessing Python/C API routines
...
@@ -185,7 +185,7 @@ Accessing Python/C API routines
---------------------------------
---------------------------------
One particular use of the ``cdef extern from`` statement is for gaining access to
One particular use of the ``cdef extern from`` statement is for gaining access to
routines in the Python/C API. For example
,
::
routines in the Python/C API. For example::
cdef extern from "Python.h":
cdef extern from "Python.h":
...
@@ -204,7 +204,7 @@ Windows Calling Conventions
...
@@ -204,7 +204,7 @@ Windows Calling Conventions
----------------------------
----------------------------
The ``__stdcall`` and ``__cdecl`` calling convention specifiers can be used in
The ``__stdcall`` and ``__cdecl`` calling convention specifiers can be used in
Cython, with the same syntax as used by C compilers on Windows, for example
,
::
Cython, with the same syntax as used by C compilers on Windows, for example::
cdef extern int __stdcall FrobnicateWindow(long handle)
cdef extern int __stdcall FrobnicateWindow(long handle)
...
@@ -245,7 +245,7 @@ Cython keywords. For example, if you want to call an external function called
...
@@ -245,7 +245,7 @@ Cython keywords. For example, if you want to call an external function called
print, you can rename it to something else in your Cython module.
print, you can rename it to something else in your Cython module.
As well as functions, C names can be specified for variables, structs, unions,
As well as functions, C names can be specified for variables, structs, unions,
enums, struct and union members, and enum values. For example
,
::
enums, struct and union members, and enum values. For example::
cdef extern int one "ein", two "zwei"
cdef extern int one "ein", two "zwei"
cdef extern float three "drei"
cdef extern float three "drei"
...
@@ -388,7 +388,7 @@ Multiple public and API declarations
...
@@ -388,7 +388,7 @@ Multiple public and API declarations
You can declare a whole group of items as :keyword:`public` and/or
You can declare a whole group of items as :keyword:`public` and/or
:keyword:`api` all at once by enclosing them in a :keyword:`cdef` block, for
:keyword:`api` all at once by enclosing them in a :keyword:`cdef` block, for
example
,
::
example::
cdef public api:
cdef public api:
void order_spam(int tons)
void order_spam(int tons)
...
...
docs/src/userguide/language_basics.rst
View file @
fa7f2832
...
@@ -42,7 +42,7 @@ and C :keyword:`struct`, :keyword:`union` or :keyword:`enum` types::
...
@@ -42,7 +42,7 @@ and C :keyword:`struct`, :keyword:`union` or :keyword:`enum` types::
See also :ref:`struct-union-enum-styles`
See also :ref:`struct-union-enum-styles`
There is currently no special syntax for defining a constant, but you can use
There is currently no special syntax for defining a constant, but you can use
an anonymous :keyword:`enum` declaration for this purpose, for example
,
::
an anonymous :keyword:`enum` declaration for this purpose, for example::
cdef enum:
cdef enum:
tons_of_spam = 3
tons_of_spam = 3
...
@@ -103,7 +103,7 @@ can be called from anywhere, but uses the faster C calling conventions
...
@@ -103,7 +103,7 @@ can be called from anywhere, but uses the faster C calling conventions
when being called from other Cython code.
when being called from other Cython code.
Parameters of either type of function can be declared to have C data types,
Parameters of either type of function can be declared to have C data types,
using normal C declaration syntax. For example
,
::
using normal C declaration syntax. For example::
def spam(int i, char *s):
def spam(int i, char *s):
...
...
...
@@ -144,7 +144,7 @@ parameters and a new reference is returned).
...
@@ -144,7 +144,7 @@ parameters and a new reference is returned).
The name object can also be used to explicitly declare something as a Python
The name object can also be used to explicitly declare something as a Python
object. This can be useful if the name being declared would otherwise be taken
object. This can be useful if the name being declared would otherwise be taken
as the name of a type, for example
,
::
as the name of a type, for example::
cdef ftang(object int):
cdef ftang(object int):
...
...
...
@@ -241,7 +241,7 @@ returns ``NULL``. The except clause doesn't work that way; its only purpose is
...
@@ -241,7 +241,7 @@ returns ``NULL``. The except clause doesn't work that way; its only purpose is
for propagating Python exceptions that have already been raised, either by a Cython
for propagating Python exceptions that have already been raised, either by a Cython
function or a C function that calls Python/C API routines. To get an exception
function or a C function that calls Python/C API routines. To get an exception
from a non-Python-aware function such as :func:`fopen`, you will have to check the
from a non-Python-aware function such as :func:`fopen`, you will have to check the
return value and raise it yourself, for example
,
::
return value and raise it yourself, for example::
cdef FILE *p
cdef FILE *p
p = fopen("spam.txt", "r")
p = fopen("spam.txt", "r")
...
...
docs/src/userguide/sharing_declarations.rst
View file @
fa7f2832
...
@@ -160,7 +160,7 @@ Sharing C Functions
...
@@ -160,7 +160,7 @@ Sharing C Functions
C functions defined at the top level of a module can be made available via
C functions defined at the top level of a module can be made available via
:keyword:`cimport` by putting headers for them in the ``.pxd`` file, for
:keyword:`cimport` by putting headers for them in the ``.pxd`` file, for
example
,
:
example
:
:
:file:`volume.pxd`::
:file:`volume.pxd`::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment