<s>
Cython	B-Application
(	O
)	O
is	O
a	O
programming	O
language	O
,	O
a	O
(	O
non-strict	O
,	O
at	O
least	O
for	O
Python	B-Language
3	O
)	O
superset	O
of	O
the	O
Python	B-Language
programming	I-Language
language	I-Language
(	O
with	O
slightly	O
different	O
semantics	O
)	O
,	O
designed	O
to	O
give	O
C-like	O
performance	O
with	O
code	O
that	O
is	O
written	O
mostly	O
in	O
Python	B-Language
with	O
optional	O
additional	O
C-inspired	O
syntax	O
.	O
</s>
<s>
Cython	B-Application
is	O
a	O
compiled	B-Language
language	I-Language
that	O
is	O
typically	O
used	O
to	O
generate	O
CPython	B-Language
extension	O
modules	O
.	O
</s>
<s>
Annotated	O
Python-like	O
code	O
is	O
compiled	O
to	O
C	B-Language
(	O
also	O
usable	O
from	O
e.g.	O
</s>
<s>
C++	B-Language
)	O
then	O
automatically	O
wrapped	B-Library
in	I-Library
interface	I-Library
code	I-Library
,	O
producing	O
extension	O
modules	O
that	O
can	O
be	O
loaded	O
and	O
used	O
by	O
regular	O
Python	B-Language
code	I-Language
using	O
the	O
import	O
statement	O
,	O
but	O
with	O
significantly	O
less	O
computational	O
overhead	O
at	O
run	B-Library
time	I-Library
.	O
</s>
<s>
Cython	B-Application
also	O
facilitates	O
wrapping	O
independent	O
C	B-Language
or	O
C++	B-Language
code	I-Language
into	O
python-importable	O
modules	O
.	O
</s>
<s>
Cython	B-Application
is	O
written	O
in	O
Python	B-Language
and	O
C	B-Language
and	O
works	O
on	O
Windows	B-Application
,	O
macOS	B-Application
,	O
and	O
Linux	B-Application
,	O
producing	O
C	B-Language
source	O
files	O
compatible	O
with	O
CPython	B-Language
2.6	O
,	O
2.7	O
,	O
and	O
3.3	O
and	O
later	O
versions	O
.	O
</s>
<s>
The	O
Cython	B-Application
source	O
code	O
that	O
Cython	B-Application
compiles	O
(	O
to	O
C	B-Language
)	O
can	O
use	O
both	O
Python	B-Language
2	O
and	O
Python	B-Language
3	O
syntax	O
,	O
defaulting	O
to	O
Python	B-Language
2	O
syntax	O
in	O
Cython	B-Application
0.x	O
(	O
and	O
Python	B-Language
3	O
syntax	O
in	O
Cython	B-Application
3.x	O
,	O
which	O
is	O
currently	O
alpha	O
software	O
)	O
.	O
</s>
<s>
in	O
source	O
code	O
comment	O
)	O
to	O
Python	B-Language
3	O
(	O
or	O
2	O
)	O
syntax	O
.	O
</s>
<s>
Since	O
Python	B-Language
3	O
syntax	O
has	O
changed	O
in	O
recent	O
versions	O
,	O
Cython	B-Application
may	O
not	O
be	O
up	O
to	O
date	O
with	O
latest	O
addition	O
.	O
</s>
<s>
Cython	B-Application
has	O
"	O
naive	O
support	O
for	O
most	O
of	O
the	O
C++	B-Language
language	I-Language
"	O
and	O
"	O
compiles	O
almost	O
all	O
existing	O
Python	B-Language
code	I-Language
"	O
.	O
</s>
<s>
Cython	B-Application
3.0.0	O
is	O
in	O
development	O
.	O
</s>
<s>
Cython	B-Application
works	O
by	O
producing	O
a	O
standard	O
Python	B-Language
module	O
.	O
</s>
<s>
However	O
,	O
the	O
behavior	O
differs	O
from	O
standard	O
Python	B-Language
in	O
that	O
the	O
module	O
code	O
,	O
originally	O
written	O
in	O
Python	B-Language
,	O
is	O
translated	O
into	O
C	B-Language
.	O
While	O
the	O
resulting	O
code	O
is	O
fast	O
,	O
it	O
makes	O
many	O
calls	O
into	O
the	O
CPython	B-Language
interpreter	O
and	O
CPython	B-Language
standard	O
libraries	O
to	O
perform	O
actual	O
work	O
.	O
</s>
<s>
Choosing	O
this	O
arrangement	O
saved	O
considerably	O
on	O
Cython	B-Application
's	O
development	O
time	O
,	O
but	O
modules	O
have	O
a	O
dependency	O
on	O
the	O
Python	B-Language
interpreter	O
and	O
standard	O
library	O
.	O
</s>
<s>
Although	O
most	O
of	O
the	O
code	O
is	O
C-based	O
,	O
a	O
small	O
stub	O
loader	O
written	O
in	O
interpreted	O
Python	B-Language
is	O
usually	O
required	O
(	O
unless	O
the	O
goal	O
is	O
to	O
create	O
a	O
loader	O
written	O
entirely	O
in	O
C	B-Language
,	O
which	O
may	O
involve	O
work	O
with	O
the	O
undocumented	O
internals	O
of	O
CPython	B-Language
)	O
.	O
</s>
<s>
However	O
,	O
this	O
is	O
not	O
a	O
major	O
problem	O
due	O
to	O
the	O
presence	O
of	O
the	O
Python	B-Language
interpreter	O
.	O
</s>
<s>
Cython	B-Application
has	O
a	O
foreign	B-Application
function	I-Application
interface	I-Application
for	O
invoking	O
C/C	O
++	O
routines	O
and	O
the	O
ability	O
to	O
declare	O
the	O
static	O
type	O
of	O
subroutine	O
parameters	O
and	O
results	O
,	O
local	O
variables	O
,	O
and	O
class	O
attributes	O
.	O
</s>
<s>
A	O
Cython	B-Application
program	O
that	O
implements	O
the	O
same	O
algorithm	O
as	O
a	O
corresponding	O
Python	B-Language
program	I-Language
may	O
consume	O
fewer	O
computing	O
resources	O
such	O
as	O
core	O
memory	O
and	O
processing	O
cycles	O
due	O
to	O
differences	O
between	O
the	O
CPython	B-Language
and	O
Cython	B-Application
execution	O
models	O
.	O
</s>
<s>
A	O
basic	O
Python	B-Language
program	I-Language
is	O
loaded	O
and	O
executed	O
by	O
the	O
CPython	B-Language
virtual	B-Architecture
machine	I-Architecture
,	O
so	O
both	O
the	O
runtime	B-Library
and	O
the	O
program	O
itself	O
consume	O
computing	O
resources	O
.	O
</s>
<s>
A	O
Cython	B-Application
program	O
is	O
compiled	O
to	O
C	B-Language
code	O
,	O
which	O
is	O
further	O
compiled	O
to	O
machine	O
code	O
,	O
so	O
the	O
virtual	B-Architecture
machine	I-Architecture
is	O
used	O
only	O
briefly	O
when	O
the	O
program	O
is	O
loaded	O
.	O
</s>
<s>
Cython	B-Application
employs	O
:	O
</s>
<s>
Performance	O
depends	O
both	O
on	O
what	O
C	B-Language
code	O
is	O
generated	O
by	O
Cython	B-Application
and	O
how	O
that	O
code	O
is	O
compiled	O
by	O
the	O
C	B-Language
compiler	O
.	O
</s>
<s>
Cython	B-Application
is	O
a	O
derivative	O
of	O
the	O
Pyrex	B-Application
language	I-Application
,	O
and	O
supports	O
more	O
features	O
and	O
optimizations	O
than	O
Pyrex	B-Application
.	O
</s>
<s>
Cython	B-Application
was	O
forked	B-Application
from	O
Pyrex	B-Application
in	O
2007	O
by	O
developers	O
of	O
the	O
Sage	B-Application
computer	O
algebra	O
package	O
,	O
because	O
they	O
were	O
unhappy	O
with	O
Pyrex	B-Application
's	O
limitations	O
and	O
could	O
not	O
get	O
patches	O
accepted	O
by	O
Pyrex	B-Application
's	O
maintainer	O
Greg	O
Ewing	O
,	O
who	O
envisioned	O
a	O
much	O
smaller	O
scope	O
for	O
his	O
tool	O
than	O
the	O
Sage	B-Application
developers	O
had	O
in	O
mind	O
.	O
</s>
<s>
They	O
then	O
forked	B-Application
Pyrex	B-Application
as	O
SageX	O
.	O
</s>
<s>
When	O
they	O
found	O
people	O
were	O
downloading	O
Sage	B-Application
just	O
to	O
get	O
SageX	O
,	O
and	O
developers	O
of	O
other	O
packages	O
(	O
including	O
Stefan	O
Behnel	O
,	O
who	O
maintains	O
the	O
XML	B-Protocol
library	O
LXML	O
)	O
were	O
also	O
maintaining	O
forks	B-Application
of	O
Pyrex	B-Application
,	O
SageX	O
was	O
split	O
off	O
the	O
Sage	B-Application
project	O
and	O
merged	O
with	O
cython-lxml	O
to	O
become	O
Cython	B-Application
.	O
</s>
<s>
Cython	B-Application
files	O
have	O
a	O
.pyx	O
extension	O
.	O
</s>
<s>
At	O
its	O
most	O
basic	O
,	O
Cython	B-Application
code	O
looks	O
exactly	O
like	O
Python	B-Language
code	I-Language
.	O
</s>
<s>
However	O
,	O
whereas	O
standard	O
Python	B-Language
is	O
dynamically	O
typed	O
,	O
in	O
Cython	B-Application
,	O
types	O
can	O
optionally	O
be	O
provided	O
,	O
allowing	O
for	O
improved	O
performance	O
,	O
allowing	O
loops	O
to	O
be	O
converted	O
into	O
C	B-Language
loops	O
where	O
possible	O
.	O
</s>
<s>
A	O
sample	O
hello	O
world	O
program	O
for	O
Cython	B-Application
is	O
more	O
complex	O
than	O
in	O
most	O
languages	O
because	O
it	O
interfaces	O
with	O
the	O
Python	B-Language
C	B-Language
API	O
and	O
setuptools	O
or	O
other	O
PEP517-compliant	O
extension	O
building	O
facilities	O
.	O
</s>
<s>
A	O
more	O
straightforward	O
way	O
to	O
start	O
with	O
Cython	B-Application
is	O
through	O
command-line	O
IPython	B-Application
(	O
or	O
through	O
in-browser	O
python	B-Language
console	O
called	O
Jupyter	O
notebook	B-Application
)	O
:	O
</s>
<s>
which	O
gives	O
a	O
95	O
times	O
improvement	O
over	O
the	O
pure-python	O
version	O
.	O
</s>
<s>
Cython	B-Application
is	O
particularly	O
popular	O
among	O
scientific	O
users	O
of	O
Python	B-Language
,	O
where	O
it	O
has	O
"	O
the	O
perfect	O
audience	O
"	O
according	O
to	O
Python	B-Language
creator	O
Guido	O
van	O
Rossum	O
.	O
</s>
<s>
The	O
free	B-Application
software	I-Application
SageMath	B-Application
computer	O
algebra	O
system	O
depends	O
on	O
Cython	B-Application
,	O
both	O
for	O
performance	O
and	O
to	O
interface	O
with	O
other	O
libraries	O
.	O
</s>
<s>
Significant	O
parts	O
of	O
the	O
scientific	O
computing	O
libraries	O
SciPy	B-Application
,	O
pandas	B-Application
and	O
scikit-learn	B-Application
are	O
written	O
in	O
Cython	B-Application
.	O
</s>
<s>
Some	O
high-traffic	O
websites	O
such	O
as	O
Quora	O
use	O
Cython	B-Application
.	O
</s>
<s>
Cython	B-Application
's	O
domain	O
is	O
not	O
limited	O
to	O
just	O
numerical	O
computing	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
lxml	O
XML	B-Protocol
toolkit	O
is	O
written	O
mostly	O
in	O
Cython	B-Application
,	O
and	O
like	O
its	O
predecessor	O
Pyrex	B-Application
,	O
Cython	B-Application
is	O
used	O
to	O
provide	O
Python	B-Language
bindings	O
for	O
many	O
C	B-Language
and	O
C++	B-Language
libraries	O
such	O
as	O
the	O
messaging	O
library	O
ZeroMQ	B-Operating_System
.	O
</s>
<s>
Cython	B-Application
can	O
also	O
be	O
used	O
to	O
develop	O
parallel	B-Operating_System
programs	I-Operating_System
for	O
multi-core	B-Architecture
processor	I-Architecture
machines	O
;	O
this	O
feature	O
makes	O
use	O
of	O
the	O
OpenMP	B-Application
library	O
.	O
</s>
