[issue16496] Simplify and optimize random_seed()

Mark Dickinson report at bugs.python.org
Sun Nov 18 18:06:24 CET 2012


Mark Dickinson added the comment:

> Apparently my feeling of comfort is different from your own. ;)

Yes:  I tend to favour direct, readable, and portable code over unnecessarily optimized code.  To address the specific points:

> The code is larger.

Very slightly.  It's (IMO) more readable and comprehensible though.

> There is one additional allocation.

Yep.  Is this a problem?

> CPU tacts wasted for uint32->ulong conversion.

random.seed is hardly going to be a bottleneck in most applications.  Again, I don't see that as a problem.

> One additional ValeError/OverflowError.

That's not really additional:  it should really have already been there in the original code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16496>
_______________________________________


More information about the Python-bugs-list mailing list