
On Sun, Sep 20, 2015 at 10:19 AM, Tim Peters <tim.peters@gmail.com> wrote:
[Chris Angelico <rosuav@gmail.com>]
token_bytes "obviously" should return a bytes,
Which os.urandom() does in Python 3. I'm not writing docs, just suggesting the functions.
and token_alpha equally obviously should be returning a str.
Which part of "string" doesn't suggest "str"?
(Or maybe it should return the same type as alphabet, which could be either?)
: What about the other two?
Which part of "ASCII" is ambiguous?
Also, if you ask for 4 bytes from token_hex, do you get 4 hex digits or 8 (four bytes of entropy)?
And which part of "same"? ;-)
Bikeshed away.; I'm outta this now ;-)
Heh :) My personal preference for shed colour: token_bytes returns a bytestring, its length being the number provided. All the others return Unicode strings, their lengths again being the number provided. So they're all text bar the one that explicitly says it's in bytes. But I'm aware others may disagree, and while "ASCII" might not be ambiguous, Py3 does still distinguish between b"asdf" and u"asdf" :) ChrisA