I'd give up Perl tomorrow if only...

Gerhard Häring gerhard.haering at gmx.de
Fri Jun 21 07:07:37 EDT 2002


* David Mitchell <djmitchell at NOSPAM.optushome.com.au> [2002-06-21 20:48 +1000]:
> ASCII<->EBCDIC conversion is pretty easy to implement in just about any
> language, but it's also easy to make a typo somewhere when you're typing in
> lots and lots of ASCII codes.  I know; I've done it ;->

No need to do it yourself. In Python 2.2+:

>>> u"foo".encode("ebcdic_cp_us")
'\x86\x96\x96'

Of course, if you have ascii, you'll have to construct the unicode
string first: unicode("foo", "ascii").encode(...)

> However, when speed of development is absolutely crucial, Perl can't
> be beat.

For me, nothing beats Python. I don't know Perl (I've tried to learn it,
but it was too frustrating). And I don't believe Perl were more
efficient for me. The more terse code argument doesn't count, because
I'm a fast typist :-)

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))





More information about the Python-list mailing list