diff options
author | laurentlb <laurentlb@google.com> | 2018-04-11 04:12:14 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-11 04:13:26 -0700 |
commit | c381cf17f797f485d7a2df4d085ecbec217c79a9 (patch) | |
tree | d082debc4915d9cacb84ca0ac5b7440832109df6 /site/docs/skylark | |
parent | 8a2cd73e1dc6284ba2580f0d1f4c7276e8c1de1b (diff) |
Introduce `--incompatible_disallow_slash_operator` to disable `/` operator.
RELNOTES:
The `/` operator is deprecated in favor of `//` (floor integer division).
Try the `--incompatible_disallow_slash_operator` flag to ensure your code
is forward-compatible.
PiperOrigin-RevId: 192430310
Diffstat (limited to 'site/docs/skylark')
-rw-r--r-- | site/docs/skylark/backward-compatibility.md | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/site/docs/skylark/backward-compatibility.md b/site/docs/skylark/backward-compatibility.md index e5d8c75b62..801148b79d 100644 --- a/site/docs/skylark/backward-compatibility.md +++ b/site/docs/skylark/backward-compatibility.md @@ -98,9 +98,9 @@ To merge two sets, the following examples used to be supported, but are now deprecated: ``` python -depset1 + depset2 -depset1 | depset2 -depset1.union(depset2) +depset1 + depset2 # deprecated +depset1 | depset2 # deprecated +depset1.union(depset2) # deprecated ``` The recommended solution is to use the `depset` constructor: @@ -148,6 +148,20 @@ for i in range(len(my_string)): * Default: `false` +### Integer division operator is `//` + +Integer division operator is now `//` instead of `/`. This aligns with +Python 3 and it highlights the fact it is a floor division. + +```python +x = 7 / 2 # deprecated + +x = 7 // 2 # x is 3 +``` + +* Flag: `--incompatible_disallow_slash_operator` +* Default: `false` + ### New actions API This change removes the old methods for registering actions within rules, and |