• Re: Python2 idiosyncrasies in Python3 scripts

    From Andrey Rakhmatullin@21:1/5 to Jerome BENOIT on Thu Aug 15 13:00:01 2024
    On Thu, Aug 15, 2024 at 12:11:55PM +0200, Jerome BENOIT wrote:
    is there a reliable way to isolate Python2 idiosyncrasies in Python3 scripts ?

    Do you mean code that still works in Python 3 but can be simplified?
    Lots of linters do this in whole or in part, though I don't have
    suggestions for something that does *only* this. You can also look at pyupgrade.

    --
    WBR, wRAR

    -----BEGIN PGP SIGNATURE-----

    iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAma93vYtFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh veIP/1kxUv3OQchBVshEUXcRwulRNiaaRGVv4inB0G5Y9KqCHRo8HrVns0SjuyzS HJqOUVvj6WxRVn/89KgZUgdrbYdZQaClxx9Ec3xbpTIj5UfwFbLMsFOZx4/FXW8g XdwLXqELnRl2Dl+FgD3g9p4VyuJOZ5tWxoMZd/oK6cCy29Pc8LM50SFXqW+HTmnX ekPCcIyIDQhReRwNkmgCTwv9mb4RGAMNjiDy5p47YwsVBfQHX8G0VRsDxcTC0Tzb ZZrSX38vfArvytG6gbrDwvF30I54ZNr9Je/zGnKd3iVfIyAzfEJoAEcQx1zSwCH0 AORTeMZk9oHqtpUp+O53rVcyOqqEMuh0V8hhtWgFr3QbgrN5+hgcZjtIoBVf4lMD 6/2LOmxA8zuk/wy7ILBqTUvunXCjhqJu9zj06fkHmoyCStBlLC9gYSzeRAnqIf0w n+L/4cmY9010p178a5WDlTC1VT2KoqINN8KoaODBs2yxQq3Y7QdHqq6/NP6tw8Dq A9zBHRVZ0hIXIbiJSIYP6KWeyvFfaybQj3KPiNbVmZrsAtOyrBN7STQwwscQ47Am t8GHdJKHZh83JWD4aHphfquCNvn0tc7fQRChS9Zt10L5SgyN4icRu/n/NwsqeVXv 2l9u/BBeHQvEaP1rGbnl+sAXJo+MGyhIdnBEBIgbIhrzb+Zu
    =Ki+t
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jerome BENOIT@21:1/5 to All on Thu Aug 15 12:30:02 2024
    Hi,

    is there a reliable way to isolate Python2 idiosyncrasies in Python3 scripts ?

    I guess that I am looking for Python scripts what checkbashisms(1) is for shell scripts.

    Cheers,
    Jerone

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrey Rakhmatullin@21:1/5 to Jerome BENOIT on Thu Aug 15 13:40:02 2024
    On Thu, Aug 15, 2024 at 01:11:23PM +0200, Jerome BENOIT wrote:
    is there a reliable way to isolate Python2 idiosyncrasies in Python3 scripts ?

    Do you mean code that still works in Python 3 but can be simplified?
    Lots of linters do this in whole or in part, though I don't have suggestions for something that does *only* this. You can also look at pyupgrade.



    I look to check if a bunch of Python[2] scripts can run with Python3 as-is or with minor changes.
    The involve scripts are very basic.

    Try modernize or any linter.

    --
    WBR, wRAR

    -----BEGIN PGP SIGNATURE-----

    iQJhBAABCgBLFiEEolIP6gqGcKZh3YxVM2L3AxpJkuEFAma96PAtFIAAAAAAFQAP cGthLWFkZHJlc3NAZ251cGcub3Jnd3JhckBkZWJpYW4ub3JnAAoJEDNi9wMaSZLh IMUQAIrGR2b+ANKZwEzObgVuEK44K3/3ZYIVFwnnjCm3YOMT9jiOZsWajc6u4j2U y7mm7doS2/8h7zotYnkWO85BuV3Lk20g4mFrRPZs5xKehOFM5XNvEkJuCEANnaJa PKARQ8ZkxaEiaSAM9xZ0D4Ba1tE1PCEgR63/Z8AP3HvmdjbJ9OuTMd/obDqqbQ4Q mRCWEYaMRcqG/6Tx1A5bI9nx3aTdiEUTADIhZPFGlcQvJ88BevgfCA5FN6dGN+Pd d3MIA6rK9Lap+CVU0RLkkNxb6k0t8Rm6/z3YYUaRTztFX81QvmoJl3b+scaEbXpT aHYQssgbKxmBVkdZMYqxL1hphKMNrd+k1kHua5ltZaum/UR2hHmCFPK7dXCMkwcj Qvu7Labh8tg+NNVh3esffzyQquA9mti12/IzwtF0LvUo/KwW4BEEpW6M5RUbIgyg jZYIMJaqVyFAJHRmqtre0fl7r4ihB7HpcuLJY+adCmkBJRSQVQTxGzp2oWRJ7ExA y9d8/WmB9CBCSq7FmbFhFh8z65bhAklnp2dNh4878twIkRy2QUeWDmdn2OWaDMYB g8/QvNYgwyKARf9xPHAyLILg1PnSICDfZk/jNjbXnlessZtWheBMKK5eGCBXrnXe WSPxeIbmYDdhgka92nxp+oJOfktnU3mHq7kSZ6Z13aIjOklc
    =DwxI
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jerome BENOIT@21:1/5 to Andrey Rakhmatullin on Thu Aug 15 13:30:01 2024
    Hello Andrey, thanks for your reply.

    On 15/08/2024 12:56, Andrey Rakhmatullin wrote:
    On Thu, Aug 15, 2024 at 12:11:55PM +0200, Jerome BENOIT wrote:
    is there a reliable way to isolate Python2 idiosyncrasies in Python3 scripts ?

    Do you mean code that still works in Python 3 but can be simplified?
    Lots of linters do this in whole or in part, though I don't have
    suggestions for something that does *only* this. You can also look at pyupgrade.



    I look to check if a bunch of Python[2] scripts can run with Python3 as-is or with minor changes.
    The involve scripts are very basic.

    Cheers,
    Jerome

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bastian Venthur@21:1/5 to Jerome BENOIT on Thu Aug 15 14:40:02 2024
    On 15.08.24 12:11, Jerome BENOIT wrote:
    Hi,

    is there a reliable way to isolate Python2 idiosyncrasies in Python3
    scripts ?

    I guess that I am looking for Python scripts what checkbashisms(1) is
    for shell scripts.

    I have good experience with 2to3
    (https://docs.python.org/3/library/2to3.html).


    Hope that helps,

    Bastian

    --
    Dr. Bastian Venthur https://venthur.de
    Debian Developer venthur at debian org

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)