[issue33228] Use Random.choices in tempfile

2019-04-08 Thread Inada Naoki


Inada Naoki  added the comment:

I'm +0 too.  Since there are no +1 from core dev for a long time,
I close this issue for now.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

-0 on making anything other than the doc change.  For the most part, we avoid 
sweeping through the standard library to substitute-in new features and instead 
have a preference for code stability rather than code churn.

FWIW, the main rationale for introducing choices() was to support weighting.  
Existing code that calls choice() multiple times is still correct and clear.

--
nosy: +rhettinger

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

Actually, in Python2.7 random.choice is implemented with the same 
susceptibility to the rounding bug as Python3's choices, still nobody ever 
reported a tempfile IndexError problem (I guess).

--

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

sorry, should have been issue 24567, of course.

--

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

@serhiy as I understand issue 33228, the double rounding problem potentially 
causing an IndexError can only affect choices() if the len of the sequence to 
choose from is greater than 2049, but the string in question here is only 37 
characters long.
Alternatively, choices may fail with certain weights 
(https://bugs.python.org/msg275594), but _RandomNameSequence is not using 
weights.

--

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread INADA Naoki

INADA Naoki  added the comment:

@wolma Would you split your PR?  One for fix docstring and one for using 
Random.choices.

Since former is document bug, I want to backport it. (while _RandomNameSequence 
is private)

--
nosy: +inada.naoki

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See issue24567. It affects Random.choices(), but not Random.choice() because 
the latter uses getrandbits().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier

Change by Wolfgang Maier :


--
keywords: +patch
pull_requests: +6093
stage:  -> patch review

___
Python tracker 

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



[issue33228] Use Random.choices in tempfile

2018-04-05 Thread Wolfgang Maier

New submission from Wolfgang Maier :

A rather trivial change: tempfile._RandomNameSequence could make use of
random.Random.choices introduced in 3.6.
IMO, the suggested change would give clearer and also faster code.
It also updates the docstring of the class, which currently talks about
a six-character string, when an eight-character string gets returned.

--
messages: 314969
nosy: wolma
priority: normal
severity: normal
status: open
title: Use Random.choices in tempfile
type: performance
versions: Python 3.8

___
Python tracker 

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