From 58bef02dbb7d6b9691e0e6a320058b86e3a5f754 Mon Sep 17 00:00:00 2001 From: Vivek Soundrapandi Date: Tue, 16 Oct 2018 09:49:28 +0530 Subject: [PATCH] added example for immutability for consistency as in other data structure descriptions (#19260) Other immutable data structures have examples to show immutability which is missing in tuple description which makes it look inconsistent --- .../guide/english/python/data-structures/tuples/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/pages/guide/english/python/data-structures/tuples/index.md b/client/src/pages/guide/english/python/data-structures/tuples/index.md index e3babb718e..bbd88efa27 100644 --- a/client/src/pages/guide/english/python/data-structures/tuples/index.md +++ b/client/src/pages/guide/english/python/data-structures/tuples/index.md @@ -5,6 +5,12 @@ title: The Tuples A tuple is a sequence of Python objects. Tuples are immutable which means they cannot be modified after creation, unlike lists. + >>> tuple = (1,2,3) + >>> tuple[1] = 4 + Traceback (most recent call last): + File "", line 1, in + TypeError: 'tuple' object does not support item assignment + **Creation:** An empty `tuple` is created using a pair of round brackets, `()`: