diff options
author | 2017-02-16 13:48:37 +0000 | |
---|---|---|
committer | 2017-02-16 16:56:17 +0000 | |
commit | 7f0cd62e3f7c896ace34997c330517e3c557ca64 (patch) | |
tree | 6950717635e3ce5107217547ab7c4ba2cb29c244 /site/versions/master/docs/skylark | |
parent | 45282686be49297b3e910f8876a28dc0e9eeef5d (diff) |
Disallow comparison of objects of different types in Skylark
RELNOTES[INC]: It's not allowed anymore to compare objects of different types
(i.e. a string to an integer) and objects for which comparison rules are not
defined (i.e. a dict to another dict) using order operators.
--
PiperOrigin-RevId: 147710942
MOS_MIGRATED_REVID=147710942
Diffstat (limited to 'site/versions/master/docs/skylark')
-rw-r--r-- | site/versions/master/docs/skylark/concepts.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/site/versions/master/docs/skylark/concepts.md b/site/versions/master/docs/skylark/concepts.md index 2d5430f0f8..59b3d2e25e 100644 --- a/site/versions/master/docs/skylark/concepts.md +++ b/site/versions/master/docs/skylark/concepts.md @@ -199,6 +199,12 @@ Python: declaration. However, it is fine to define `f()` before `g()`, even if `f()` calls `g()`. +* The order comparison operators (<, <=, >=, >) are not defined across different + types of values, e.g., you can't compare `5 < 'foo'` (however you still can + compare them using == or !=). This is a difference with Python 2, but + consistent with Python 3. Note that this means you are unable to sort lists + that contain mixed types of values. + The following Python features are not supported: * `class` (see [`struct`](lib/globals.html#struct) function) @@ -244,11 +250,6 @@ The following items are upcoming changes. * The `|` operator is defined for depsets as a synonym for `+`. This will be going away; use `+` instead. -* The order comparison operators (<, <=, >=, >) are currently defined across - different types of values, e.g., you can write `5 < 'foo'`. This will be an - error, just like in Python 3. Note that this means you will be unable to - sort lists that contain mixed types of values. - * The structure of the set that you get back from using the `+` or `|` operator is changing. Previously `a + b`, where `a` is a set, would include as its direct items all of `a`'s direct items. Under the upcoming way, the |