Re: OT: Python 3 conversion
Charles Cazabon <[email protected]> Wed, 27 Oct 2021 13:34:19 -0600
| Newsgroups | gmane.mail.getmail.user |
|---|---|
| Message-ID | <[email protected]> |
Matthias Andree <[email protected]> wrote: > > The string vs. bytes vs. Unicode matter is still needed, so reviewing > and checking if you need .decode() or .encode(), or class/exception > updates are required Yes, this is a big part of it. Just arbitrarily throwing away the "u" prefix on string literals and changing to bytes where the prefix wasn't used doesn't get you very far. It requires knowledge of the codebase and what it's doing. > , and sometimes I found it necessary to convert some method outputs to > list()s explicitly ("for i in list(former_result):") I'm glad I'm not the only one who finds this change in Python 3 a bit annoying. > For fetchmailconf, it wasn't a very clean conversion, but interspersed > with fixes for bugs also present under Python 2.x, so it's probably not > the prime example on how to do a conversion... but it is doable. A barebones conversion is doable, but it gets worse as the codebase grows larger or more complex. For getmail, it's a significant chunk of work that I think is better invested in a rewrite that cleans up a ton of stuff from early Python 2, and even Python 1.5, that I had to monkeypatch in or implement myself because it simply didn't exist in the ecosystem at the time. Charles -- ----------------------------------------------------------------------- Charles Cazabon GPL'ed software available at: http://pyropus.ca/software/ -----------------------------------------------------------------------