3 ms·
this post is a great example of why python 3 didn't go far enough. it's too close to python 2 to be still called python and too far from python 2 to be still ca
by baq 13y ago
this post is a great example of why python 3 didn't go far enough. it's too close to python 2 to be still called python and too far from python 2 to be still called python 2.
personally, coming from a country that needs to deal with non-ascii, i love unicode by default and there are b'' strings if you need them. str.encode is a non-issue - you wasted more words on it than the two-line function enc() it takes to fix it.
- keyme 13y agoIf I recall, writing no boilerplate code was a big deal in python once... And while 2 lines are not worth my rant, writing those 2 lines again and again all the time, is.
- baq 13y agoi'd argue this is not boilerplate, more like a shortcut for your particular use case: import codecs enc = lambda x: codecs.encode(x, 'hex') i have a program in python 2 that uses this approach, because i have a lot of decoding from utf and encoding to a different charset to do. python 3 is absolutely the same for me.