V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
a33486
V2EX  ›  Python

小白求教大神引入模块哪种性能更高

  •  
  •   a33486 · Apr 12, 2018 · 2434 views
    This topic created in 2936 days ago, the information mentioned may be changed or developed.
    __important__(‘ random ’).randint 导入模块函数只能用一次,from random important randint 是导入对应模块中的函数,两种写法那种性能更高?求大神指点?
    bookding0
        1
    bookding0  
       Apr 12, 2018   ❤️ 1
    1. important -> import
    2. from random import randint 等价于 randint = __import__('random').randint
    3.你可以理解为性能没区别
    4.Python 比较 CPU 性能没什么太大意义,高并发下 io 性能才是需要考虑的。
    julyclyde
        2
    julyclyde  
       Apr 13, 2018
    important ……
    楼主建议还是先学一下英语,别在性能高低这种有的没的问题上浪费时间
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5899 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 03:35 · PVG 11:35 · LAX 20:35 · JFK 23:35
    ♥ Do have faith in what you're doing.