from hello import say_hello_to say_hello_to("world!!") # import timeit # cy = timeit.timeit('hello.say_hello_to("world!!")', setup="import hello", number=100) # print(str(cy) + " second!")
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015 Richard Wong # from functools import partial import timeit import hello import hi hello.say_hello_to('richard') print(hello.f1(13332)) print(hello.__dict__) print(hi.__dict__) print(hi.f3(13332)) print(timeit.Timer(partial(hello.f1, 133332)).repeat(3, 10000)) print(timeit.Timer(partial(hi.f3, 133332)).repeat(3, 10000)) # t.py ended here
# filename: hello_run.py from hello import say_hello_to say_hello_to('Ricci')
def test_say_hello_to(capsys): say_hello_to('me') out, err = capsys.readouterr() assert out == 'Hello me!\n'
# -*- coding: utf-8 -*- __author__ = "youhei" from hello import say_hello_to print("test") say_hello_to("you")
from hello import say_hello_to say_hello_to('martin')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 25 22:14:11 2019 @author: ubuntu """ import hello hello.say_hello_to("Leo")
import pyximport; pyximport.install() import hello if __name__ == "__main__": hello.say_hello_to("Reona")
def test_valid(capsys): name = "Todd" hello.say_hello_to(name) out, _ = capsys.readouterr() assert out == "Hello {}!\n".format(name)
import pyximport pyximport.install() import datetime import exert exert.fib(16) import hello hello.say_hello_to('aaa')
from hello import say_hello_to say_hello_to('Hi')
import hello hello.say_hello_to('张三')
from helloworld import say_hello from hello import say_hello_to for i in range(5): say_hello() say_hello_to('Mike')
# coding: utf-8 import hello hello.say_hello_to('someone')
# import pyximport; pyximport.install() import hello hello.say_hello_to("xiao")
from hello import say_hello_to from hello import StructTest say_hello_to("kkk") a= StructTest() print(a)
# -*- coding: utf-8 -*- """ This example displays how to use pyximport for on-the-fly compilation via Cython. For simple cases like this example, pyximport removes the need to write a setup.py distutils script, and we can treat hello.pyx as if it were a regular Python module. If a Cython source file is modified, pyximport automatically detects the modification and will recompile the source file the next time it is imported in a new Python interpreter session. Because Cython modules imported via pyximport depend on both the cython compiler and a properly set up C compiler, it tends not to be used in production environments where these dependencies are not under our control. """ import pyximport # .install() needs to be called before importing Cython extension modules pyximport.install() # This will compile hello.pyx to a *.so if it hasn't already been and load the .so extension module import hello hello.say_hello_to('Todd')
from hello import say_hello_to say_hello_to("Matthew")
from hello import say_hello_to say_hello_to()
def hello(self): say_hello_to("adfadf")
import hello hello.say_hello_to("hi,cython!!")
import nimporter # Required before importing any Nim extension modules import hello # The Nim module to import hello.say_hello_to(input('What is your name? '))
from hello import say_hello_to say_hello_to("asdf")
import hello hello.say_hello_to("Appveyor")
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Simple example which imports the extension module generated by Cython and uses it. """ from hello import say_hello_to say_hello_to('Todd')
from hello import say_hello_to from hello_py import say_hello_to as say_hello_to2 if __name__ == '__main__': say_hello_to('aa') say_hello_to2('bb')
''' from hello import say_hello_to, f, f2 import time def fpy(x): return x**2-x def testf(): t = time.time() for i in xrange(1000000): fpy(i) print time.time()-t t= time.time() for i in xrange(1000000): f(i) print time.time()-t t= time.time() for i in xrange(1000000): f2(i) print time.time()-t if __name__ == '__main__': say_hello_to("Chenhh") print f(10) testf()
from hello import say_hello_to print(say_hello_to("world"))
#!/usr/bin/env python """ Simple script showing how a module that was built using distutils and Cython.Build can be directly imported similar to any python module. """ __author__ = 'John Stein' __email__ = '*****@*****.**' from hello import say_hello_to say_hello_to('John')
# use import call hello.so or hello.pyd from hello import say_hello_to say_hello_to(" ff world ")
import hello hello.say_hello_to('Alex')
#coding:utf8 import hello if __name__=='__main__': print dir(hello) print hello.say_hello_to('jadesoul')
import pyximport; pyximport.install() import hello as hello hello.say_hello_to('jon')
def test_hello(self): self.assertEqual(say_hello_to('Marc'), 'Marc')
import hello import numpy as np if __name__ == '__main__': hello.say_hello_to('everyone') matrix = np.random.randn(100, 2) print(hello.convert_demo(matrix))
# -*- coding: utf-8 -*- import hello hello.say_hello_to('lily')
import hello if __name__ == "__main__": hello.say_hello_to("Ikki")
from hello import say_hello_to say_hello_to("David")