diff options
author | Antonin ENFRUN <antonin.e@me.com> | 2016-05-22 19:28:04 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-05-23 21:08:07 +0100 |
commit | ca41dc27504c68e805472a6788c4cddbb0da28b1 (patch) | |
tree | 0ee2873c0724889b1232afb1e1316b39e30a5fbe /tests | |
parent | 2133924e4603e2d692f92e048798f0982dbbf793 (diff) | |
download | micropython-ca41dc27504c68e805472a6788c4cddbb0da28b1.tar.gz micropython-ca41dc27504c68e805472a6788c4cddbb0da28b1.zip |
py/objnamedtuple: Allow passing field names as a tuple.
So the documentation's example works. Besides, a tuple can be more
memory efficient.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/namedtuple1.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py index dfbb79f2eb..346e32fbfc 100644 --- a/tests/basics/namedtuple1.py +++ b/tests/basics/namedtuple1.py @@ -66,6 +66,11 @@ T3 = namedtuple("TupComma", "foo bar") t = T3(1, 2) print(t.foo, t.bar) +# Try tuple +T4 = namedtuple("TupTuple", ("foo", "bar")) +t = T4(1, 2) +print(t.foo, t.bar) + # Try single string with comma field seperator # Not implemented so far #T2 = namedtuple("TupComma", "foo,bar") |