R. David Murray added the comment:
Looks like this was left open for post-commit review, but since no one has
objected (and it looks fine to me) I'm going to close it.
--
nosy: +r.david.murray
resolution: - fixed
stage: commit review - resolved
status: open - closed
Changes by A.M. Kuchling a...@amk.ca:
--
stage: needs patch - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16728
___
___
A.M. Kuchling added the comment:
Here's a possible patch that mentions collections.abc.Sequence. I left out
MutableSequence, because I couldn't see how to mention it without making the
definition longer and more complicated.
(It could be objected that this is the *glossary*, and is
Roundup Robot added the comment:
New changeset 30d0816939a3 by Andrew Kuchling in branch '3.3':
#16728: Mention collections.abc.Sequence in 'sequence' glossary entry
http://hg.python.org/cpython/rev/30d0816939a3
--
nosy: +python-dev
___
Python
Nick Coghlan added the comment:
Many algorithms that require a sequence only need __len__ and __getitem__. The
term sequence is used to distinguish such containers from mere iterables that
only provide __iter__ (and may be consumed by iteration). The glossary entry
covers this use of the
Nick Coghlan added the comment:
As Amaury notes, implicit ducktyping is not feasible for sequences or mappings,
as the method names overlap - you have to add explicit semantic information to
say which kind of container you're implementing.
--
___
INADA Naoki added the comment:
Thanks, Nick.
I see that the sequence doesn't have strict definition.
Though, I think collections.abc module's document should describe
this manner. For example:
But checking type with these abc may be too strict for most case.
For example, some user defined
Nick Coghlan added the comment:
No, that runs counter to the purpose of ABCs. If you have a type that is good
enough for your purposes, then you can just register it.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16728
INADA Naoki added the comment:
So, I feel the 2nd meaning of sequence should be
collections.abc.(Mutable)Sequence.
sequence types in stdlib have richer API then the ABC. (e.g. comparison, +,
*, etc...)
They are APIs that sequence may have but not APIs makes the type sequence.
--
INADA Naoki added the comment:
And nice symmetry with mapping entry.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16728
___
___
10 matches
Mail list logo