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
Gwenaël Samain
cython
Commits
9455f388
Commit
9455f388
authored
Jun 27, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up doc section on bint
parent
7434e1b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
docs/src/userguide/pyrex_differences.rst
docs/src/userguide/pyrex_differences.rst
+7
-7
No files found.
docs/src/userguide/pyrex_differences.rst
View file @
9455f388
...
...
@@ -134,19 +134,19 @@ Boolean int type (e.g. it acts like a c int, but coerces to/from python as a boo
======================================================================================
In C, ints are used for truth values. In python, any object can be used as a
truth value (using the :meth:`__nonzero__` method, but the canonical choices
are the two boolean objects ``True`` and ``False``. The :
keyword:`bint` of
"boolean int"
object is compiled to a C int, but get coerced
to and from
C
ython as booleans. The return type of comparisons and several builtins is a
:c
type:`bint` as well. This allows one to avoid having to wrap
things in
truth value (using the :meth:`__nonzero__` method
)
, but the canonical choices
are the two boolean objects ``True`` and ``False``. The :
c:type:`bint` (for
"boolean int"
) type is compiled to a C int, but coerces
to and from
P
ython as booleans. The return type of comparisons and several builtins is a
:c
:type:`bint` as well. This reduces the need for wrapping
things in
:func:`bool()`. For example, one can write::
def is_equal(x):
return x == y
which would return ``1`` or ``0`` in Pyrex, but returns ``True`` or ``False`` in
p
ython. One can declare variables and return values for functions to be of the
:ctype:`bint` type. For example::
C
ython. One can declare variables and return values for functions to be of the
:c
:
type:`bint` type. For example::
cdef int i = x
cdef bint b = x
...
...
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