[Python-Dev] [Python-checkins] cpython (3.2): Avoid codec spelling issues by just using the utf-8 default. (original) (raw)
Victor Stinner victor.stinner at haypocalc.com
Fri May 6 01:14:14 CEST 2011
- Previous message: [Python-Dev] [Python-checkins] cpython (3.2): Avoid codec spelling issues by just using the utf-8 default.
- Next message: [Python-Dev] cpython (3.2): Avoid codec spelling issues by just using the utf-8 default.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le jeudi 05 mai 2011 à 18:54 -0400, Alexander Belopolsky a écrit :
On Thu, May 5, 2011 at 6:32 PM, M.-A. Lemburg <mal at egenix.com> wrote: .. >> Either way, the code is simpler by just using the default. > > ... as long as the casual reader knows what the default it :-) >
.. or cares. I this particular case, it hardly matters how random bits are encoded.
You don't get the same random number sequence if you use a different encoding.
r=random.Random() r.seed('\xe9'.encode('iso-8859-1')); r.randint(0, 1000) 639 r.seed('\xe9'.encode('utf-8')); r.randint(0, 1000) 992
So it is useful to know how the seed was computed. The real question is which encoding gives the most random numbers? :-)
Victor
- Previous message: [Python-Dev] [Python-checkins] cpython (3.2): Avoid codec spelling issues by just using the utf-8 default.
- Next message: [Python-Dev] cpython (3.2): Avoid codec spelling issues by just using the utf-8 default.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]