Kaydet (Commit) 340383ce authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Tuples now have both count() and index().

üst 9973ee86
...@@ -1441,13 +1441,15 @@ Here are all of the changes that Python 2.6 makes to the core Python language. ...@@ -1441,13 +1441,15 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
it will be returned if *iterator* has been exhausted; otherwise, it will be returned if *iterator* has been exhausted; otherwise,
the :exc:`StopIteration` exception will be raised. (:issue:`2719`) the :exc:`StopIteration` exception will be raised. (:issue:`2719`)
* Tuples now have an :meth:`index` method matching the list type's * Tuples now have :meth:`index` and :meth:`count` methods matching the
:meth:`index` method:: list type's :meth:`index` and :meth:`count` methods::
>>> t = (0,1,2,3,4) >>> t = (0,1,2,3,4)
>>> t.index(3) >>> t.index(3)
3 3
(Contributed by Raymond Hettinger)
* The built-in types now have improved support for extended slicing syntax, * The built-in types now have improved support for extended slicing syntax,
where various combinations of ``(start, stop, step)`` are supplied. where various combinations of ``(start, stop, step)`` are supplied.
Previously, the support was partial and certain corner cases wouldn't work. Previously, the support was partial and certain corner cases wouldn't work.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment