TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Mathematics in Python

7 点作者 rayvega将近 14 年前

1 comment

ggchappell将近 14 年前
This is a clean, well written demonstration of how convenient it is to create new types with overloaded math operators in Python. Devotees of C++, in particular, really need to see how nice it can be when operators and inheritance Just Work.<p>But I got a twinge of irritation near the beginning of the article. Call it a pet peeve if you want, but it's ridiculous to say that Python is "untyped". On the contrary, Python's typing can be quite unforgiving, never letting you weasel out of a type error with arbitrary conversions (a la C or C++).<p>It <i>is</i> true that implicit, dynamic, duck-by-default typing (like Python) looks at first glance quite similar to no typing at all (like ANSI Forth). This is particularly true if one is used to languages like C or (as he mentions) Pascal.<p>But this is only true at first glance. What is really going on here is that, since Pascal came out, the language-design community has figured out how to put together type systems that mostly stay out of the programmer's way, while still being strong enough to provide useful safety guarantees. (See also Haskell, etc.)<p>And this, I think, is a terribly nifty thing that should not be glossed over.
评论 #2586785 未加载