spylang/spy

Track deviations from CPython semantics

开放

#601 创建于 2026年6月24日

 (0 条评论) (0 个反应) (0 位负责人)Python (60 个派生)auto 404
good first issuehelp wanted

仓库指标

星标
 (803 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

As more Python users start using Spy, we will likely encounter deviations from expected CPython semantics. We should track and document those differences as they are identified.

The initial discussion started here. As noted in that PR, Spy currently differs from Python in the behavior of the power operator.

Python:

  • For int operands, the result is a float if the exponent is negative.
  • A negative base with a fractional exponent returns a complex number, e.g. (-5) ** 0.5 == (1.3691967456605067e-16+2.23606797749979j).

Spy:

  • A negative exponent instead raises ValueError.
  • A negative base with a fractional exponent also raises ValueError.

@JeffersGlass raised another semantic difference here, this time involving the in operator.

This issue can serve as a place to collect and document these CPython/SPy semantic differences as they are discovered.

贡献者指南