PEP-0263 and default encoding
Duncan Booth
duncan at NOSPAMrcp.co.uk
Tue Sep 30 03:45:34 EDT 2003
Klaus Alexander Seistrup <spam at magnetic-ink.dk> wrote in news:3f79171c-
d4c587aa-d4ac-44b9-97da-5e0024d4d268 at news.szn.dk:
>
> Still beats me why it doesn't use the sys.getdefaultencoding() instead
> of inconveniencing me.
>
I think the reasoning was that you might give your scripts to someone else
who has a different default encoding and it would then fail obscurely. A
script should be portable, and that means it can't depend on things like
the default encoding.
i.e. Its an attempt to satisfy both of these:
Explicit is better than implicit.
Errors should never pass silently.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list