Re: Python 2.7 code: a spring-clean
Steve - Gadget Barnes <[email protected]> Wed, 4 Dec 2019 07:04:08 +0000
| Newsgroups | gmane.comp.python.org.uk |
|---|---|
| Message-ID | <LNXP123MB19328F858FEE7489328B8F74AA5D0@LNXP123MB1932.GBRP123.PROD.OUTLOOK.COM> |
Hi Richard, One trick that I have used is to use os.walk to find all of the python files and then tried parsing them with ast - this at least throws an error for the files that are completely broken for python 3. Another is to use the python 3 version pylint on the files/project this finds more but in many cases results in a lot more noise. Steve (Gadget). -----Original Message----- From: python-uk <[email protected]> On Behalf Of Richard Barran Sent: 03 December 2019 21:13 To: UK Python Users <[email protected]> Subject: [python-uk] Python 2.7 code: a spring-clean Hi all, With the end-of-life of Python 2 upon us, I wondered about cleaning up code that has (had!) to support both Python 2 and Python 3. Some of it is easy (e.g. look for any references to the ‘six’ library), some of it is relatively easy (e.g. super(Foobar, self) ) and… actually, there could be quite a few things to tidy up. I’m wondering if there is a script out there to quickly introspect a codebase and flag up any legacy code? I’ve tried googling but drew up a blank. Any suggestions welcome! Richard _______________________________________________ python-uk mailing list [email protected] https://mail.python.org/mailman/listinfo/python-uk _______________________________________________ python-uk mailing list [email protected] https://mail.python.org/mailman/listinfo/python-uk