Helmut Jarausch, 09.11.2012 10:18: > probably I'm missing something. > > Using str(Arg) works just fine if Arg is a list. > But > str([],encoding='latin-1') > > gives the error > TypeError: coercing to str: need bytes, bytearray or buffer-like object, > list found > > If this isn't a bug how can I use str(Arg,encoding='latin-1') in general. > Do I need to flatten any data structure which is normally excepted by str() ?
Funny idea to call this a bug in Python. What your code is asking for is to decode the object you pass in using the "latin-1" encoding. Since a list is not something that is "encoded", let alone in latin-1, you get an error, and actually a rather clear one. Note that this is not specific to Python3.3 or even 3.x. It's the same thing in Py2 when you call the equivalent unicode() function. Stefan -- http://mail.python.org/mailman/listinfo/python-list