python - 当需要 long/bigints 时强制 python 失败
问题描述
有没有办法在程序中禁止这些?
例如:
x = 2**50 # expected to work (in a 64 bit binary)
x = x * x # expected to fail/raise
原因:bigint 操作比 int 慢得多,但是 python 从一个切换到另一个没有警告。我想知道这样我就可以专注于优化工作。
我对 python 2.7(特别是 pypy)感兴趣。我知道在 python 3 中对 long 的处理是不同的。
解决方案
推荐阅读
- sql - 如何创建将在没有 sqlplus lib 的 CentOS 上运行 SQL 文件的 sh 脚本
- scikit-learn - scikit-learn 中有 davies_bouldin_score 系数的归一化值吗?
- javascript - 在javascript中合并来自audiobuffer的两个通道数据
- r - 如何使用 Dendextend 读取 Newick 系统发育树进行树比较?
- laravel - 为什么 npm install && npm run dev 不起作用
- django - 单击链接并返回后登录页面上的 Django ERR_CACHE_MISS
- modelica - OpenModelica 无法运行 FMU?
- python - IBM RTC Python 创建工作项
- node.js - 如何处理 twitch passport.js 验证码?
- amazon-web-services - 使用 CDK 部署时 AWS Lambda 无法正常工作