[issue13538] Improve doc for str(bytesobject)

2012-11-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c39e3906ce9 by Chris Jerdonek in branch '3.2':
Fix label in docs (from issue #13538).
http://hg.python.org/cpython/rev/5c39e3906ce9

--

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



[issue13538] Improve doc for str(bytesobject)

2012-11-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f32f1cb508ad by Chris Jerdonek in branch '3.2':
Improve str() and object.__str__() documentation (issue #13538).
http://hg.python.org/cpython/rev/f32f1cb508ad

New changeset 6630a1c42204 by Chris Jerdonek in branch '3.3':
Null merge from 3.2 (issue #13538).
http://hg.python.org/cpython/rev/6630a1c42204

New changeset 325f80d792b9 by Chris Jerdonek in branch '3.3':
Improve str() and object.__str__() documentation (issue #13538).
http://hg.python.org/cpython/rev/325f80d792b9

New changeset 59acd5cac8b5 by Chris Jerdonek in branch 'default':
Merge from 3.3: Improve str() and object.__str__() docs (issue #13538).
http://hg.python.org/cpython/rev/59acd5cac8b5

--
nosy: +python-dev

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



[issue13538] Improve doc for str(bytesobject)

2012-11-20 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue13538] Improve doc for str(bytesobject)

2012-11-19 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Updating patch after Ezio's review on Rietveld.

--
Added file: http://bugs.python.org/file28040/issue-13538-6-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-11-19 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Attaching new patch to address Ezio's further comments (for the convenience of 
comparing in Rietveld).  I will be committing this.

--
Added file: http://bugs.python.org/file28045/issue-13538-7-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-11-19 Thread Éric Araujo

Éric Araujo added the comment:

I left a few remarks.  The patch is very nice, thanks!

--

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



[issue13538] Improve doc for str(bytesobject)

2012-11-19 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks, Éric!  (And thanks also to Ezio who helped quite a bit with the 
improvements.)  I replied to your comments on Rietveld.

--

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



[issue13538] Improve doc for str(bytesobject)

2012-11-10 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


Added file: http://bugs.python.org/file27944/issue-13538-5-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-11-10 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


Removed file: http://bugs.python.org/file27939/issue-13538-4-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-11-09 Thread Chris Jerdonek

Chris Jerdonek added the comment:

New patch incorporating Ezio's suggestions, along with some other changes.

--
Added file: http://bugs.python.org/file27939/issue-13538-4-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Attaching updated patch based on Ezio and Antoine's comments.  Let me know if 
I'm not using the correct or preferred terminology around buffer objects and 
the buffer protocol.

It doesn't seem like the section on the buffer protocol actually says what 
objects implementing the buffer protocol should be called.  I gather indirectly 
from the docs that such objects are called buffer objects (as opposed to just 
buffers):

http://docs.python.org/dev/c-api/buffer.html#bufferobjects

--
stage: needs patch - patch review
Added file: http://bugs.python.org/file27591/issue-13538-2-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Reattaching patch (a line was missing).

--
Added file: http://bugs.python.org/file27592/issue-13538-3-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-10-16 Thread Ezio Melotti

Ezio Melotti added the comment:

+  str(bytes, encoding[, errors='strict'])
+  str(bytes, errors[, encoding='utf-8'])

Why not simply str(bytes, encoding='utf-8', errors='strict')? (Your signature 
suggests that str(b'abc', 'strict') should work.)

+   the string itself.  This behavior differs from :func:`repr` in that the

I'm not sure this is the right place where to explain the differences between 
__str__ and __repr__ (or maybe it is?).  Also doesn't str() falls back on 
__repr__ if __str__ is missing?  Does :meth:`__str__` link to object.__str__?

+   If *encoding* or *errors* is given,

and/or

+   (or :class:`bytearray`) object, then :func:`str` calls

I would use 'is equivalent to', rather than 'calls'.

+   :meth:`bytes.decode(encoding, errors) bytes.decode` on the object
+   and returns the value.  Otherwise, the bytes object underlying the buffer
+   object is obtained before calling :meth:`bytes.decode() bytes.decode`.

:meth:`bytes.decode` should be enough.

+   Passing a :func:`bytes bytes`

:func:`bytes` should be enough (if it isn't, maybe you want :func:`.bytes`).

--

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



[issue13538] Improve doc for str(bytesobject)

2012-10-15 Thread Ezio Melotti

Ezio Melotti added the comment:

Instead of documenting what *encoding* and *errors* do, I would just say that 
str(bytesobj, encoding, errors) is equivalent to bytesobj.decode(encoding, 
errors) (assuming it really is).  I don't like encodings/decodings done via the 
str/bytes constructors, and I think the docs should encourage the use of 
bytes.decode/str.encode.

--

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



[issue13538] Improve doc for str(bytesobject)

2012-10-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 I would just say that str(bytesobj, encoding, errors) is equivalent to 
 bytesobj.decode(encoding, errors) (assuming it really is).

Good suggestion.  And yes, code is shared in the following way:

http://hg.python.org/cpython/file/d3c7ebdc71bb/Objects/bytesobject.c#l2306

One thing that would need to be addressed in the str() version is if bytesobj 
is a PEP 3118 character buffer, after which it falls back to 
bytesobj.decode(encoding, errors).  I will update the patch so people can see 
how it looks.

--

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



[issue13538] Improve doc for str(bytesobject)

2012-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Indeed:

 m = memoryview(b)
 str(m, utf-8)
''
 m.decode(utf-8)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'memoryview' object has no attribute 'decode'

--

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



[issue13538] Improve doc for str(bytesobject)

2012-10-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note: character buffer isn't a term we use anymore (in Python 3, that is).

--

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



[issue13538] Improve doc for str(bytesobject)

2012-10-13 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Attaching a proposed patch along the lines suggested by Éric.

--
keywords: +patch
versions: +Python 3.4
Added file: http://bugs.python.org/file27556/issue-13538-1-default.patch

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



[issue13538] Improve doc for str(bytesobject)

2012-10-11 Thread Chris Jerdonek

Chris Jerdonek added the comment:

This may have been addressed to some extent by issue 14783:

http://hg.python.org/cpython/rev/3773c98d9da8

--
nosy: +chris.jerdonek

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



[issue13538] Improve doc for str(bytesobject)

2012-07-25 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
keywords: +easy
stage:  - needs patch
type:  - enhancement

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



[issue13538] Improve doc for str(bytesobject)

2011-12-12 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I think Eric's suggestion is the proper approach.

--
nosy: +terry.reedy

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



[issue13538] Improve doc for str(bytesobject)

2011-12-12 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue13538] Improve doc for str(bytesobject)

2011-12-10 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
title: Docstring of str() and/or behavior - Improve doc for str(bytesobject)

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