在Python中划分为零崩溃Windows 98,等?

时间:2012-02-20 23:17:59

标签: python windows

一位教授告诉我,如果在Windows 98中执行此操作,则除以零或在Python崩溃中使用负平方根。

这似乎很荒谬,因为Python是一种解释性语言,但我没有办法验证这一点,Windows也是臭名昭着的......任何人都可以确认或否认这种说法吗?如果是这样,它是否与Python用C语言编写的事实有关? (并且C会真正使整个操作系统崩溃,除以零!?)

3 个答案:

答案 0 :(得分:7)

Python 2.7.2 (Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Joke)] on win98
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(-1) / 0
A fatal exception 0E has occurred at 0028:C0011E36 in VXD VMM(01) +
00010E36.  The current application will be terminated

* Press any key to terminate the current application.
* Press CTRL+ALT+DEL again to restart your computer.  You will
  lose any unsaved information in all applications

enter image description here


* 免责声明:当然,我把这一切都搞定了。我倾向于同意 tito 这个 - 一个拖钓教授是最可能的解释!

░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░
░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░
░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░
░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░
░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░
█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█
█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█
░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░
░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░
░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░
░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░
░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░
░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░
░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░
░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░

答案 1 :(得分:6)

它应该导致ZeroDivisionError异常。我无法想象为什么在Windows 98中这会有所不同。

>>> 1/0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

多么浪费时间。

在Win98下使用Python 2.3.5

Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.

    ****************************************************************
    Personal firewall software may warn about the connection IDLE
    makes to its subprocess using this computer's internal loopback
    interface.  This connection is not visible on any external
    interface and no data is sent to or received from the Internet.
    ****************************************************************

IDLE 1.0.5      
>>> import sys
>>> sys.getwindowsversion()
(4, 10, 67766446, 1, ' A ')
>>> sys.version_info
(2, 3, 5, 'final', 0)
>>> 1/0

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in -toplevel-
    1/0
ZeroDivisionError: integer division or modulo by zero
>>>

答案 2 :(得分:2)

如果我没有错,我记得对于某些处理器系列(AMD?),除零会导致处理器循环并导致系统崩溃(在win 95和win 98上)。

也许你的教授指的是那个?