Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
99279f71
Commit
99279f71
authored
Jun 03, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: switched lexer for python console snippets to 'pycon'
parent
7c99ff2a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
docs/advanced.rst
+6
-6
docs/basics.rst
+4
-4
docs/classes.rst
+7
-7
No files found.
docs/advanced.rst
View file @
99279f71
...
@@ -157,7 +157,7 @@ trivial to generate binding code for both of these functions.
...
@@ -157,7 +157,7 @@ trivial to generate binding code for both of these functions.
The following interactive session shows how to call them from Python.
The following interactive session shows how to call them from Python.
.. code-block:: py
th
on
.. code-block:: py
c
on
$ python
$ python
>>> import example
>>> import example
...
@@ -304,7 +304,7 @@ by pybind11. Following this, we are able to define a constructor as usual.
...
@@ -304,7 +304,7 @@ by pybind11. Following this, we are able to define a constructor as usual.
The Python session below shows how to override ``Animal::go`` and invoke it via
The Python session below shows how to override ``Animal::go`` and invoke it via
a virtual method call.
a virtual method call.
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> from example import *
>>> from example import *
>>> d = Dog()
>>> d = Dog()
...
@@ -834,7 +834,7 @@ Suppose we bind the following function
...
@@ -834,7 +834,7 @@ Suppose we bind the following function
and call it from Python, the following happens:
and call it from Python, the following happens:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> v = [5, 6]
>>> v = [5, 6]
>>> append_1(v)
>>> append_1(v)
...
@@ -863,7 +863,7 @@ functions:
...
@@ -863,7 +863,7 @@ functions:
In this case, properties can be read and written in their entirety. However, an
In this case, properties can be read and written in their entirety. However, an
``append`` operaton involving such a list type has no effect:
``append`` operaton involving such a list type has no effect:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> m = MyClass()
>>> m = MyClass()
>>> m.contents = [5, 6]
>>> m.contents = [5, 6]
...
@@ -1144,7 +1144,7 @@ entirely on the C++ side and can be crunched down into a tight, optimized loop
...
@@ -1144,7 +1144,7 @@ entirely on the C++ side and can be crunched down into a tight, optimized loop
by the compiler. The result is returned as a NumPy array of type
by the compiler. The result is returned as a NumPy array of type
``numpy.dtype.float64``.
``numpy.dtype.float64``.
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> x = np.array([[1, 3],[5, 7]])
>>> x = np.array([[1, 3],[5, 7]])
>>> y = np.array([[2, 4],[6, 8]])
>>> y = np.array([[2, 4],[6, 8]])
...
@@ -1316,7 +1316,7 @@ Another aspect worth highlighting is that the "preview" of the default argument
...
@@ -1316,7 +1316,7 @@ Another aspect worth highlighting is that the "preview" of the default argument
in the function signature is generated using the object's ``__repr__`` method.
in the function signature is generated using the object's ``__repr__`` method.
If not available, the signature may not be very helpful, e.g.:
If not available, the signature may not be very helpful, e.g.:
.. code-block:: py
th
on
.. code-block:: py
c
on
FUNCTIONS
FUNCTIONS
...
...
...
...
docs/basics.rst
View file @
99279f71
...
@@ -128,7 +128,7 @@ Assuming that the created file :file:`example.so` (:file:`example.pyd` on Window
...
@@ -128,7 +128,7 @@ Assuming that the created file :file:`example.so` (:file:`example.pyd` on Window
is located in the current directory, the following interactive Python session
is located in the current directory, the following interactive Python session
shows how to load and execute the example.
shows how to load and execute the example.
.. code-block:: py
th
on
.. code-block:: py
c
on
$ python
$ python
Python 2.7.10 (default, Aug 22 2015, 20:33:39)
Python 2.7.10 (default, Aug 22 2015, 20:33:39)
...
@@ -157,7 +157,7 @@ metadata into :func:`module::def`. With this modified binding code, we can now
...
@@ -157,7 +157,7 @@ metadata into :func:`module::def`. With this modified binding code, we can now
call the function using keyword arguments, which is a more readable alternative
call the function using keyword arguments, which is a more readable alternative
particularly for functions taking many parameters:
particularly for functions taking many parameters:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> import example
>>> import example
>>> example.add(i=1, j=2)
>>> example.add(i=1, j=2)
...
@@ -165,7 +165,7 @@ particularly for functions taking many parameters:
...
@@ -165,7 +165,7 @@ particularly for functions taking many parameters:
The keyword names also appear in the function signatures within the documentation.
The keyword names also appear in the function signatures within the documentation.
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> help(example)
>>> help(example)
...
@@ -201,7 +201,7 @@ using an extension of :class:`arg`:
...
@@ -201,7 +201,7 @@ using an extension of :class:`arg`:
The default values also appear within the documentation.
The default values also appear within the documentation.
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> help(example)
>>> help(example)
...
...
docs/classes.rst
View file @
99279f71
...
@@ -44,7 +44,7 @@ constructor's parameters as template arguments and wraps the corresponding
...
@@ -44,7 +44,7 @@ constructor's parameters as template arguments and wraps the corresponding
constructor (see the :ref:`custom_constructors` section for details). An
constructor (see the :ref:`custom_constructors` section for details). An
interactive Python session demonstrating this example is shown below:
interactive Python session demonstrating this example is shown below:
.. code-block:: py
th
on
.. code-block:: py
c
on
% python
% python
>>> import example
>>> import example
...
@@ -73,7 +73,7 @@ Binding lambda functions
...
@@ -73,7 +73,7 @@ Binding lambda functions
Note how ``print(p)`` produced a rather useless summary of our data structure in the example above:
Note how ``print(p)`` produced a rather useless summary of our data structure in the example above:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> print(p)
>>> print(p)
<example.Pet object at 0x10cd98060>
<example.Pet object at 0x10cd98060>
...
@@ -99,7 +99,7 @@ Lambda function instead:
...
@@ -99,7 +99,7 @@ Lambda function instead:
Both stateless [#f1]_ and stateful lambda closures are supported by pybind11.
Both stateless [#f1]_ and stateful lambda closures are supported by pybind11.
With the above change, the same Python code now produces the following output:
With the above change, the same Python code now produces the following output:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> print(p)
>>> print(p)
<example.Pet named 'Molly'>
<example.Pet named 'Molly'>
...
@@ -120,7 +120,7 @@ method also exists for ``const`` fields.
...
@@ -120,7 +120,7 @@ method also exists for ``const`` fields.
This makes it possible to write
This makes it possible to write
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> p = example.Pet('Molly')
>>> p = example.Pet('Molly')
>>> p.name
>>> p.name
...
@@ -212,7 +212,7 @@ Alternatively, we can also assign a name to the previously bound ``Pet``
...
@@ -212,7 +212,7 @@ Alternatively, we can also assign a name to the previously bound ``Pet``
Functionality-wise, both approaches are completely equivalent. Afterwards,
Functionality-wise, both approaches are completely equivalent. Afterwards,
instances will expose fields and methods of both types:
instances will expose fields and methods of both types:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> p = example.Dog('Molly')
>>> p = example.Dog('Molly')
>>> p.name
>>> p.name
...
@@ -253,7 +253,7 @@ sequence.
...
@@ -253,7 +253,7 @@ sequence.
The overload signatures are also visible in the method's docstring:
The overload signatures are also visible in the method's docstring:
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> help(example.Pet)
>>> help(example.Pet)
...
@@ -319,7 +319,7 @@ constructor. The :func:`enum_::export_values` function exports the enum entries
...
@@ -319,7 +319,7 @@ constructor. The :func:`enum_::export_values` function exports the enum entries
into the parent scope, which should be skipped for newer C++11-style strongly
into the parent scope, which should be skipped for newer C++11-style strongly
typed enums.
typed enums.
.. code-block:: py
th
on
.. code-block:: py
c
on
>>> p = Pet('Lucy', Pet.Cat)
>>> p = Pet('Lucy', Pet.Cat)
>>> p.type
>>> p.type
...
...
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