Skip to content

Commit d742d74

Browse files
committed
Update readme.
1 parent 2f483e7 commit d742d74

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ assert_eq!(c.get::<i32>("foo"), 5);
7878
### Syntax issues
7979

8080
Since the Rust tokenizer will tokenize the Python code, some valid Python
81-
code is rejected. The two main things to remember are:
81+
code is rejected. The main things to remember are:
8282

8383
- Use double quoted strings (`""`) instead of single quoted strings (`''`).
8484

@@ -90,24 +90,30 @@ code is rejected. The two main things to remember are:
9090
(If you use `#` comments, the Rust tokenizer will try to tokenize your
9191
comment, and complain if your comment doesn't tokenize properly.)
9292

93+
- Write `f ""` instead of `f""`.
94+
95+
(String literals with prefixes, like `f""`, are reserved in Rust for
96+
future use. You can write `f ""` instead, which is automatically
97+
converted back to to `f""`.)
98+
9399
Other minor things that don't work are:
94100

101+
- The `//` and `//=` operators are unusable, as they start a comment.
102+
103+
Workaround: you can write `##` instead, which is automatically converted
104+
to `//`.
105+
95106
- Certain escape codes in string literals.
96107
(Specifically: `\a`, `\b`, `\f`, `\v`, `\N{..}`, `\123` (octal escape
97108
codes), `\u`, and `\U`.)
98109

99110
These, however, are accepted just fine: `\\`, `\n`, `\t`, `\r`, `\xAB`
100-
(hex escape codes), and `\0`
111+
(hex escape codes), and `\0`.
101112

102113
- Raw string literals with escaped double quotes. (E.g. `r"...\"..."`.)
103114

104115
- Triple-quoted byte- and raw-strings with content that would not be valid
105116
as a regular string. And the same for raw-byte and raw-format strings.
106117
(E.g. `b"""\xFF"""`, `r"""\z"""`, `fr"\z"`, `br"\xFF"`.)
107118

108-
- The `//` and `//=` operators are unusable, as they start a comment.
109-
110-
Workaround: you can write `##` instead, which is automatically converted
111-
to `//`.
112-
113119
Everything else should work fine.

src/lib.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
//! ## Syntax issues
7878
//!
7979
//! Since the Rust tokenizer will tokenize the Python code, some valid Python
80-
//! code is rejected. The two main things to remember are:
80+
//! code is rejected. The main things to remember are:
8181
//!
8282
//! - Use double quoted strings (`""`) instead of single quoted strings (`''`).
8383
//!
@@ -89,26 +89,32 @@
8989
//! (If you use `#` comments, the Rust tokenizer will try to tokenize your
9090
//! comment, and complain if your comment doesn't tokenize properly.)
9191
//!
92+
//! - Write `f ""` instead of `f""`.
93+
//!
94+
//! (String literals with prefixes, like `f""`, are reserved in Rust for
95+
//! future use. You can write `f ""` instead, which is automatically
96+
//! converted back to to `f""`.)
97+
//!
9298
//! Other minor things that don't work are:
9399
//!
100+
//! - The `//` and `//=` operators are unusable, as they start a comment.
101+
//!
102+
//! Workaround: you can write `##` instead, which is automatically converted
103+
//! to `//`.
104+
//!
94105
//! - Certain escape codes in string literals.
95106
//! (Specifically: `\a`, `\b`, `\f`, `\v`, `\N{..}`, `\123` (octal escape
96107
//! codes), `\u`, and `\U`.)
97108
//!
98109
//! These, however, are accepted just fine: `\\`, `\n`, `\t`, `\r`, `\xAB`
99-
//! (hex escape codes), and `\0`
110+
//! (hex escape codes), and `\0`.
100111
//!
101112
//! - Raw string literals with escaped double quotes. (E.g. `r"...\"..."`.)
102113
//!
103114
//! - Triple-quoted byte- and raw-strings with content that would not be valid
104115
//! as a regular string. And the same for raw-byte and raw-format strings.
105116
//! (E.g. `b"""\xFF"""`, `r"""\z"""`, `fr"\z"`, `br"\xFF"`.)
106117
//!
107-
//! - The `//` and `//=` operators are unusable, as they start a comment.
108-
//!
109-
//! Workaround: you can write `##` instead, which is automatically converted
110-
//! to `//`.
111-
//!
112118
//! Everything else should work fine.
113119
114120
use pyo3::{Bound, Python, types::PyDict};

0 commit comments

Comments
 (0)