[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-31 Thread Raymond Hettinger

Raymond Hettinger added the comment:

There isn't much defense against an overly literal reading of the docs.  Both 
``s.pop([i])`` and ``s.pop(i=-1)`` fail (the latter because pop doesn't take 
key word arguments and the docstring calls it index.  Also, you would have to 
define *s* and *i*. 

FWIW, there is already a note to the effect, The optional argument i defaults 
to -1, so that by default the last item is removed and returned.

The [optional_arg] notation is used in a number of places in the docs and 
docstrings.  It is also common with other languages as well and it is used in 
third-party Python references as well.  Eric's initial suggestion of 
``s.pop(i)`` is simply wrong and would make the docs worse.

As a starting point, realize that the docs have worked well for a lot of people 
for a long time so there should be a reluctance to change them on a single 
misreading.

The tutorial also includes the same notation, (see 
https://docs.python.org/3/tutorial/datastructures.html#more-on-lists ) and as 
far as I can tell, this has never been an issue.

One other thought, the most common way to call pop() is without an argument 
(usually, if you use an argument, it is a performance bug).  We want to make 
sure the docs don't suggest otherwise.

Unless there is some strong objection, I recommend leaving the docs as-is.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I don't feel particularly strongly about it. It's mildly more confusing in the 
3.x docs than 2.7 because it's the only use in that section of an optional 
argument.

I disagree that s.pop(i) is wrong, since it agrees with the Results column. 
But I agree it's not an improvement and we shouldn't encourage it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-31 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-31 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - not a bug
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-29 Thread Eric V. Smith

Eric V. Smith added the comment:

It's trying to say that i is optional, as stated in the footnote. I agree it 
would be better written as s.pop(i), since square brackets are otherwise used 
in that section as indexing operators. But the footnote should stay, explaining 
what happens if you omit the parameter.

--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-29 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
versions:  -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-29 Thread eimista

New submission from eimista:

In section 
(https://docs.python.org/3.5/library/stdtypes.html#mutable-sequence-types) 
written s.pop([i]). But this syntax doesn't work.
Maybe the correct notation will be s.pop(i)?

--
assignee: docs@python
components: Documentation
messages: 244365
nosy: docs@python, eimista
priority: normal
severity: normal
status: open
title: Typo in Mutable Sequence Types documentation.
type: resource usage
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-29 Thread Yury Selivanov

Yury Selivanov added the comment:

I think it should be changed to `pop(i=-1)`.

--
nosy: +yselivanov

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24323] Typo in Mutable Sequence Types documentation.

2015-05-29 Thread Eric V. Smith

Eric V. Smith added the comment:

s.pop(i=-1) doesn't actually work, but I guess it gets the point across.

For 2.7 it's even more confusing, since it includes:
s.index(x[, i[, j]])
and
s.sort([cmp[, key[, reverse]]])

I'd suggest not changing the 2.7 docs.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24323
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com