mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[pyflakes
] Improve invalid-print-syntax
documentation (#11171)
This syntax wasn't "deprecated" in Python 3; it was removed. I started looking at this rule because I was curious how Ruff could even detect this without a Python 2 parser. Then I realized that "print >> f, x" is actually valid Python 3 syntax: it creates a tuple containing a right-shifted version of the print function.
This commit is contained in:
parent
61c97a037c
commit
59b73fabc1
1 changed files with 3 additions and 2 deletions
|
@ -10,8 +10,9 @@ use crate::checkers::ast::Checker;
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// In Python 2, the `print` statement can be used with the `>>` syntax to
|
/// In Python 2, the `print` statement can be used with the `>>` syntax to
|
||||||
/// print to a file-like object. This `print >> sys.stderr` syntax is
|
/// print to a file-like object. This `print >> sys.stderr` syntax no
|
||||||
/// deprecated in Python 3.
|
/// longer exists in Python 3, where `print` is only a function, not a
|
||||||
|
/// statement.
|
||||||
///
|
///
|
||||||
/// Instead, use the `file` keyword argument to the `print` function, the
|
/// Instead, use the `file` keyword argument to the `print` function, the
|
||||||
/// `sys.stderr.write` function, or the `logging` module.
|
/// `sys.stderr.write` function, or the `logging` module.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue