aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralandonovan <adonovan@google.com>2019-12-01 12:46:01 -0500
committeralandonovan <adonovan@google.com>2019-12-01 12:46:01 -0500
commit52794b6d230111cdb5f3f45816f441da67c09926 (patch)
tree0a3253e11ebf90604ae7d4da951219d33420db66
parent698e61cae82e899f5597668f27cb312153f2da85 (diff)
downloadstarlark-go-52794b6d230111cdb5f3f45816f441da67c09926.tar.gz
spec: document 3-arg getattr
Change-Id: I0d547e0cdc908b89250115805925f83fa2d87714
-rw-r--r--doc/spec.md3
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/spec.md b/doc/spec.md
index f496282..211650e 100644
--- a/doc/spec.md
+++ b/doc/spec.md
@@ -3007,6 +3007,9 @@ It is a dynamic error if x has no such attribute.
getattr("banana", "split")("a") # ["b", "n", "n", ""], equivalent to "banana".split("a")
```
+The three-argument form `getattr(x, name, default)` returns the
+provided `default` value instead of failing.
+
### hasattr
`hasattr(x, name)` reports whether x has an attribute (field or method) named `name`.