V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
CupTools
V2EX  ›  Python

"Python/PHP is the same shit"

  •  
  •   CupTools ·
    zllovesuki · 2011-01-03 07:37:14 +08:00 · 8849 次点击
    这是一个创建于 5106 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天跟别人聊天,我问他,Python是不是应该比PHP快,他说:

    "python/php is the same shit. it's still an interpreted language python or php work the same way: scan source, compile in bytecode, run bytecode. java works that way too, but can run some optimizations at compile time since compilation do not have to happen at each run. but python/perl/php are the same shit (ruby too) " MagicalTux (Google) @ 3:33

    然后他又说:

    "if you can run non-compiled files, it means it's slow. that's all. however this "slow" usually involves a few ms, while your own errors can cost way more. what's really important is not to choose a language because it is "fast" or not, but choose a language because you "master" it"

    大家有什么看法
    28 条回复    1970-01-01 08:00:00 +08:00
    keakon
        1
    keakon  
       2011-01-03 10:43:15 +08:00
    Actually, for most web apps, language is not the bottleneck.
    Rendering an page normally costs less than 10ms, while the database accessing and network latency are much more expansive than it (maybe hundreds or thousand ms).

    I don't think Java could do it better since it took more time for rendering a same dynamic JSP page and connecting to MySQL in my previous testing.
    Don't think dynamic languages are always slow than static languages, you'll find the answer when you need dynamic features.

    In my opinion, Java is almost the worst choice which makes everything much much more complex (normally 10x code lines), uses much much more memories (normally 3x memory usage), and also takes much much more money to buy suitable servers.

    I've been a Java coder for years, I couldn't find any interesting of it.
    The only superiority of Java coders I found was coming from the performance of toy programs. Otherwise, I can't explain why your friend likes complaining by using "shit" while Pythoners don't.
    est
        2
    est  
       2011-01-03 11:19:06 +08:00
    At least python doesn't use \ for namespace delimiter. lol
    TheOnly92
        3
    TheOnly92  
       2011-01-03 11:22:06 +08:00
    Just choose the language that will let you get things done, that's all.
    ayanamist
        4
    ayanamist  
       2011-01-03 11:42:25 +08:00
    按这人的逻辑,所有的动态语言都是垃圾了……
    貌似在他眼里,只有C/C++才是王道了。
    其实要看具体应用的,动态语言的开发效率不是静态语言能比拟的
    CupTools
        5
    CupTools  
    OP
       2011-01-03 11:45:30 +08:00
    @ayanamist 他玩PHP/C/C++/ASM
    fanix
        6
    fanix  
       2011-01-03 12:02:13 +08:00
    最后一段说得还是对的,语言不重要,你才重要
    hanfeizi
        7
    hanfeizi  
       2011-01-03 13:48:33 +08:00
    看不懂英文。。
    francis
        8
    francis  
       2011-01-03 15:13:26 +08:00
    重点在于,用Py的人鄙视PHP也不是一次两次了,还好已经习惯了……
    ayanamist
        9
    ayanamist  
       2011-01-03 15:25:54 +08:00
    @francis PHP有很多地方让人不爽的……某从PHP跳到Python后深深的感到Python的好,PHP的丑陋
    fsw90628
        10
    fsw90628  
       2011-01-03 16:23:58 +08:00
    机器编译的速度慢容易弥补,写代码的速度慢很难弥补。
    harryxu
        11
    harryxu  
       2011-01-04 21:19:17 +08:00
    @ayanamist 话说Python的确很不错,但是我觉得php也没什么丑的,2个语言风格不太一样,但是写起来感觉都挺爽
    AntiGameZ
        12
    AntiGameZ  
       2011-01-05 06:02:08 +08:00
    我觉得这人说的话并不是在贬低python或者php吧
    reus
        13
    reus  
       2011-01-07 21:30:42 +08:00
    php有trait,python有么?(找茬来的
    keakon
        14
    keakon  
       2011-01-07 22:00:53 +08:00
    @reus 首先确认你问的是不是这个: http://wiki.php.net/rfc/traits

    粗略看了下,类似于Ruby的mixin。

    A Trait is a unit of reuse much like a class, but only intended to group functionality in a fine-grained and consistent way.
    Python是支持多继承的,所以没有traits。

    简单来说,这个问题好比拿了台手机,然后问别人你的电脑键盘可以敲3下2打出个c么?
    cellsea
        15
    cellsea  
       2011-01-15 03:42:33 +08:00
    我还是不在乎你的女朋友比我的女朋友漂亮/跑得快。
    itommy
        16
    itommy  
       2011-01-15 06:05:34 +08:00
    @francis @ayanamist 说话者没有贬低任何一种他提到的language...
    reus
        17
    reus  
       2011-05-01 19:03:32 +08:00
    @keakon http://web.cecs.pdx.edu/~black/publications/TR_CSE_02-012.pdf 请阅读此论文并自行判断,我的理解是这个是比mixin和多继承更好用的实现代码复用的机制
    xatest
        18
    xatest  
       2011-05-01 19:30:49 +08:00
    快有2种:开发效率高和执行效率高~
    Python属于前者,C/C++属于后者~
    对于一个实际项目,语言选择最好是采用上动下静这样的体位~
    xatest
        19
    xatest  
       2011-05-01 19:32:37 +08:00
    补充: http://blog.csdn.net/linkerlin/archive/2011/04/23/6347577.aspx
    “体位”一词来自这篇文章~
    CupTools
        20
    CupTools  
    OP
       2011-05-07 16:11:58 +08:00
    我现在过渡到NodeJS了....
    改天玩一下神气haXe
    chuck911
        21
    chuck911  
       2011-05-07 17:15:41 +08:00
    shit means thing.
    "it's a new shit"
    args
        22
    args  
       2011-05-07 18:18:10 +08:00
    除了脏话,说的挺有道理的嘛~
    chone
        23
    chone  
       2011-05-07 19:22:53 +08:00
    语言争论是没有意义的,完全可以说所有语言都是shit,因为根本不存在一种完全能在任何场合都胜任的语言。语言的好在于它适应了你的需求,脱离了具体的场景去比较是完全没有意义的。
    felinx
        24
    felinx  
       2011-05-08 09:03:56 +08:00
    what's really important is not to choose a language because it is "fast" or not, but choose a language because you "master" it"

    看这一句就够了,其它的看了反倒容易造成误解。
    summic
        25
    summic  
       2011-05-08 09:36:13 +08:00
    */* is the same shit.
    apoclast
        26
    apoclast  
       2011-05-08 11:00:37 +08:00 via Android
    我的疑问是python真的没有字节码优化吗?
    jjlovegrape
        27
    jjlovegrape  
       2011-05-08 11:08:43 +08:00
    C++和JAVA基本就是手动档和自动挡的区别。各有各的优势。
    MCVector
        28
    MCVector  
       2011-05-27 14:14:45 +08:00
    C/C++, Python, PHP都在学习当中,暂不作评论,感觉各有各的用处
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3988 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 00:59 · PVG 08:59 · LAX 16:59 · JFK 19:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.