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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
58c928c1
Commit
58c928c1
authored
Nov 27, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply some more clarifications to the static typing docs.
parent
62f6837f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
docs/src/reference/language_basics.rst
docs/src/reference/language_basics.rst
+11
-11
No files found.
docs/src/reference/language_basics.rst
View file @
58c928c1
...
...
@@ -250,11 +250,12 @@ Parameters
cdef int eggs(unsigned long l, float f):
...
* As these parameters are passed into a Python declared function, they are magically **converted** to the specified C type value.
* As these parameters are passed into a Python declared function,
they are automatically **converted** to the specified C type value,
if a conversion is possible and safe. This applies to numeric and
string types, as well as some C++ container types.
* This holds true for only numeric and string types
* If no type is specified for a parameter or a return value, it is assumed to be a Python object
* If no type is specified for a parameter or a return value, it is assumed to be a Python object.
* The following takes two Python objects as parameters and returns a Python object::
...
...
@@ -263,8 +264,7 @@ Parameters
.. note::
This is different from the C language behavior, where it is an ``int`` by default.
This is different from the C language behavior, where missing types are assumed as ``int`` by default.
* Python object types have reference counting performed according to the standard Python/C-API rules:
...
...
@@ -274,7 +274,7 @@ Parameters
.. warning::
This only applies to Cython code. Other Python packages which
This only applies to Cython code.
Other Python packages which
are implemented in C like NumPy may not follow these conventions.
* The name ``object`` can be used to explicitly declare something as a Python Object.
...
...
@@ -373,10 +373,10 @@ Checked Type Casts
``MyExtensionType`` without any checking at all.
* To have a cast checked, use the syntax like: ``<MyExtensionType?>x``.
In this case, Cython will
throw an error if ``x`` is not an instance
of ``MyExtensionType``.
As explained in :ref:`typing_types`, this
requires
the exact class
for builtin
classes, but a subclas
s for extension types.
In this case, Cython will
apply a runtime check that raises a ``TypeError``
if ``x`` is not an instance
of ``MyExtensionType``.
As explained in :ref:`typing_types`, this
tests for
the exact class
for builtin
types, but allows subclasse
s for extension types.
==========================
...
...
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