Roundup Robot added the comment:
New changeset 95d487abbfd8 by Terry Jan Reedy in branch '2.7':
Issue #19362: Tweek len() doc and docstring to expand the indicated range of
http://hg.python.org/cpython/rev/95d487abbfd8
New changeset 8fcbe41e1242 by Terry Jan Reedy in branch '3.4':
Issue #19362:
Changes by Terry J. Reedy tjre...@udel.edu:
--
resolution: - fixed
stage: - resolved
status: open - closed
versions: +Python 2.7, Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
Mark Lawrence added the comment:
This is a very simple docs patch so could we have it committed please?
--
nosy: +BreamoreBoy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
Raymond Hettinger added the comment:
I'll apply this (if only to bring this vacuous discussion to a close).
--
assignee: docs@python - rhettinger
priority: normal - low
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
Terry J. Reedy added the comment:
Raymond, I was planning to do this today along with other small patches
(already done). Just say so and I will take it.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
Raymond Hettinger added the comment:
Thanks Terry.
--
assignee: rhettinger - terry.reedy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
Gareth Rees added the comment:
Here's a revised patch using Ezio's suggestion (Return the number of items of
a sequence or container).
--
Added file: http://bugs.python.org/file33904/len-set.patch
___
Python tracker rep...@bugs.python.org
Changes by Gareth Rees g...@garethrees.org:
--
title: Documentation for len() fails to mention that it works on sets -
Documentation for len() fails to mention that it works on sets
versions: +Python 3.4
___
Python tracker rep...@bugs.python.org
Terry J. Reedy added the comment:
My objection to 'container' is that it is inaccurate and leads to inaccurate
mental models. A set is like a non-exclusive club or association, defined
either by rule or roster, not like a box or room, which contain exclusively. I
am 'in' the set Python
Gareth Rees added the comment:
Here's a revised patch for Terry (Return the number of items of a sequence or
collection.)
--
Added file: http://bugs.python.org/file33916/len-set.patch
___
Python tracker rep...@bugs.python.org
Ezio Melotti added the comment:
I think it's better to do:
-Return the number of items of a sequence or mapping.
+Return the number of items of a sequence or container.
While it's true that most sequences are clearly containers (e.g. lists), the
same is not so evident for other types like
Ramchandra Apte added the comment:
I also prefer collection.
--
nosy: +Ramchandra Apte
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
___
Terry J. Reedy added the comment:
I would prefer 'collections with a known size' but 'collections' should be good
enough for the doc string. The manual can follow with examples.
--
nosy: +terry.reedy
___
Python tracker rep...@bugs.python.org
Raymond Hettinger added the comment:
Return the number of items of a container sounds
simple and accurate to me.
I agree this would be best.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
New submission from Gareth Rees:
The help text for the len() built-in function says:
Return the number of items of a sequence or mapping.
This omits to mention that len() works on sets too. I suggest this be changed
to:
Return the number of items of a sequence, mapping, or set.
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
___
Antoine Pitrou added the comment:
Return the number of items of a container sounds simple and accurate to me.
--
nosy: +pitrou, rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
Gareth Rees added the comment:
I considered suggesting container, but the problem is that container is
used elsewhere to mean object supporting the 'in' operator (in particular,
collections.abc.Container has a __contains__ method but no __len__ method).
The abstract base class for object with
R. David Murray added the comment:
Perhaps it would be better to say that the argument may be any object with a
__len__, such as the commonly used Python sequence and container types str,
bytes, tuple, list, dict, and set. After all, there are other built in types
it works on as well:
Antoine Pitrou added the comment:
Perhaps it would be better to say that the argument may be any
object with a __len__, such as the commonly used Python sequence and
container types str, bytes, tuple, list, dict, and set. After all,
there are other built in types it works on as well:
R. David Murray added the comment:
I thought we were talking about the reference guide, not the tutorial?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
Antoine Pitrou added the comment:
Well, the patch is for the builtins documentation as well as len.__doc__.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19362
___
22 matches
Mail list logo