> > so just import io.StringIO every time.
>
> this is problematic due to Unicode handling.
Hang on, it should make your life easier, not harder :)
Python 3 code needs clear separation of unicode vs byte strings. TBH, your python2 code should as well. If you want to deal with bytes, you can import 'io.BytesIO' instead. In my experience, using the older StringIO.StringIO class leads to problems down the line, since the behavior is remarkably different depending on what version of python you're running.
I guess if you're maintaining the code then that's fine, but I think this is going to cause you problems down the line :)
> > so just import io.StringIO every time.
>
> this is problematic due to Unicode handling.
Hang on, it should make your life easier, not harder :)
Python 3 code needs clear separation of unicode vs byte strings. TBH, your python2 code should as well. If you want to deal with bytes, you can import 'io.BytesIO' instead. In my experience, using the older StringIO.StringIO class leads to problems down the line, since the behavior is remarkably different depending on what version of python you're running.
I guess if you're maintaining the code then that's fine, but I think this is going to cause you problems down the line :)