Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1ce7779

Browse files
committed
Hello world Cython style final code.
1 parent 8673af7 commit 1ce7779

File tree

6 files changed

+23
-1
lines changed

6 files changed

+23
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,4 @@ src/11-cython/.idea/11-cython.iml
138138
src/11-cython/.idea/misc.xml
139139
src/11-cython/.idea/modules.xml
140140
src/11-cython/.idea/workspace.xml
141+
greeter.c

src/11-cython/.idea/dictionaries/screencaster.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/11-cython/hello_world/greeter.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def greet(name: str):
2+
print("Hello {}".format(name))
3+
print(" ** Running from {} **".format(__file__))

src/11-cython/hello_world/program.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import greeter
2+
3+
14
def main():
2-
pass
5+
name = input("What is your name? ")
6+
greeter.greet(name)
37

48

59
if __name__ == '__main__':

src/11-cython/hello_world/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from distutils.core import setup
2+
from Cython.Build import cythonize
3+
4+
setup(
5+
ext_modules=cythonize("greeter.pyx")
6+
)

src/11-cython/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cython

0 commit comments

Comments
 (0)