[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Ok. This is minor fix, I will not fight for my point of view :)

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread R. David Murray

Changes by R. David Murray :


--
Removed message: http://bugs.python.org/msg271381

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread R. David Murray

R. David Murray added the comment:

Looks correct to me as well.  If you can think of a wording that would be 
clearer, Марк, that would be great, but it shouldn't make the docstring much 
wordier (we strive for conciseness in docstrings).  That last phrase can't be 
just removed without omitting an important piece of information (an 
*additional* time OverflowError can be raised).

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread R. David Murray

R. David Murray added the comment:

Looks correct to me as well.  If you can think of a wording that would be 
clearer, Марк, that would be great, but it shouldn't make the docstring much 
wordier (we strive for conciseness in docstrings).  That the last phrase can't 
be just removed without omitting an important piece of information (an 
*additional* time OverflowError can be raised).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The docstring looks correct to me. The last phrase corresponds to the last 
paragraph that describes the signed keyword-only argument.

Is there anyone else for whom the docstring looks wrong?

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread INADA Naoki

INADA Naoki added the comment:

@mmarkk

Do you read full docstring?  It's documented very clearly.

---
int.to_bytes(length, byteorder, *, signed=False) -> bytes

Return an array of bytes representing an integer.

The integer is represented using length bytes.  An OverflowError is
raised if the integer is not representable with the given number of
bytes.

The byteorder argument determines the byte order used to represent the
integer.  If byteorder is 'big', the most significant byte is at the
beginning of the byte array.  If byteorder is 'little', the most
significant byte is at the end of the byte array.  To request the native
byte order of the host system, use `sys.byteorder' as the byte order value.

The signed keyword-only argument determines whether two's complement is
used to represent the integer.  If signed is False and a negative integer
is given, an OverflowError is raised.
---

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

Марк Коренберг added the comment:

So, in order to make documentation consistent, either new text should be added, 
or last phraze removed. That's what I think.

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

Марк Коренберг added the comment:

Well. Phrase `If signed is False and a negative integer is given, an 
OverflowError is raised.` describe onlyhalf of behaviour. It does not explain 
behaviour when `signed=True` and value is big enough to trigger exception, but 
not enough to trigger it when signed=False.

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread INADA Naoki

INADA Naoki added the comment:

docstring says:

The integer is represented using length bytes.  An OverflowError is
raised if the integer is not representable with the given number of
bytes.

(Python 3.5.2)

--
nosy: +methane

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

Марк Коренберг added the comment:

The docstring does not say, that positive values also may raise OverflowError 
if it can not fit into `(byte_count * 8) - 1` bits.

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

Марк Коренберг added the comment:

I mean when signed=True

--

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is wrong?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27622] int.to_bytes(): docstring is not precise

2016-07-26 Thread Марк Коренберг

New submission from Марк Коренберг:

Docstring says:

The signed keyword-only argument determines whether two's complement is
used to represent the integer.  If signed is False and a negative integer
is given, an OverflowError is raised.

But actually, 

(130).to_bytes(1, 'big', signed=True)

will also trigger OverflowError

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 271327
nosy: docs@python, mmarkk
priority: normal
severity: normal
status: open
title: int.to_bytes(): docstring is not precise
type: enhancement
versions: Python 3.6

___
Python tracker 

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