@@ -78,7 +78,7 @@ assert_eq!(c.get::<i32>("foo"), 5);
78
78
### Syntax issues
79
79
80
80
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:
82
82
83
83
- Use double quoted strings (` "" ` ) instead of single quoted strings (` '' ` ).
84
84
@@ -90,24 +90,30 @@ code is rejected. The two main things to remember are:
90
90
(If you use ` # ` comments, the Rust tokenizer will try to tokenize your
91
91
comment, and complain if your comment doesn't tokenize properly.)
92
92
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
+
93
99
Other minor things that don't work are:
94
100
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
+
95
106
- Certain escape codes in string literals.
96
107
(Specifically: ` \a ` , ` \b ` , ` \f ` , ` \v ` , ` \N{..} ` , ` \123 ` (octal escape
97
108
codes), ` \u ` , and ` \U ` .)
98
109
99
110
These, however, are accepted just fine: ` \\ ` , ` \n ` , ` \t ` , ` \r ` , ` \xAB `
100
- (hex escape codes), and ` \0 `
111
+ (hex escape codes), and ` \0 ` .
101
112
102
113
- Raw string literals with escaped double quotes. (E.g. ` r"...\"..." ` .)
103
114
104
115
- Triple-quoted byte- and raw-strings with content that would not be valid
105
116
as a regular string. And the same for raw-byte and raw-format strings.
106
117
(E.g. ` b"""\xFF""" ` , ` r"""\z""" ` , ` fr"\z" ` , ` br"\xFF" ` .)
107
118
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
-
113
119
Everything else should work fine.
0 commit comments