Skip to content

[Typo]: complex的部分翻译存在未删除的原文 #391

@frostylight

Description

@frostylight

Python Version

3.12+

Docs Page

https://docs.python.org/zh-cn/3.13/library/functions.html#complex

Original Translation

如果该参数为字符串,则它必须包含一个实部(使用与 float() 相同的格式)或一个虚部(使用相同的格式但带有 'j''J' 后缀),或者同时包含实部和虚部(在此情况下虚部必须加上正负号)。 该字符串首尾可以选择加上空格和圆括号 '(' and ')',它们将会被忽略。 该字符串的, which are ignored. The string must not contain whitespace between '+', '-', 'j''J' 后缀以及十进制数字之间不可包含空格。 例如,complex('1+2j') 是可以的,但 complex('1 + 2j') 则会引发 ValueError。 更准确地说,输入在移除圆括号以及开头和末尾的空格符之后,必须符合使用以下语法的 complexvalue 产生规则:

Original Docs Paragraph

If the argument is a string, it must contain either a real part (in the same format as for float()) or an imaginary part (in the same format but with a 'j' or 'J' suffix), or both real and imaginary parts (the sign of the imaginary part is mandatory in this case). The string can optionally be surrounded by whitespaces and the round parentheses '(' and ')', which are ignored. The string must not contain whitespace between '+', '-', the 'j' or 'J' suffix, and the decimal number. For example, complex('1+2j') is fine, but complex('1 + 2j') raises ValueError. More precisely, the input must conform to the complexvalue production rule in the following grammar, after parentheses and leading and trailing whitespace characters are removed:

Suggested Fix

此文本的问题自3.12版本文档加入该文本后一直存在,英文原文部分在翻译后未被正确删除。
以下翻译对原翻译的部分表述进行了改进,如原文的whitespaces空格修正为空白字符等。

如果该参数为字符串,则它必须包含一个实部(格式与 float() 接受的格式相同)或一个虚部(与实部格式相同,但带有 'j''J' 后缀),或者同时包含实部和虚部(在此情况下虚部必须加上正负号)。 该字符串可以被空白字符和圆括号 '('')'包裹,但它们会被忽略。 该字符串中的 '+''-''j''J' 后缀与十进制数字之间不可存在空格。 例如,complex('1+2j') 是可以的,但 complex('1 + 2j') 则会引发 ValueError。 更准确地说,输入在移除圆括号以及首尾的空白字符之后,必须符合以下 complexvalue 产生式规则:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy