News for hackers. Stuff that matters.
Re:Python dicts are now ordered by gnulinux on Friday February 07, 2020 @12:08PM (#22268125)
Why does it matter if it's explicit or not. If python doesn't support forward compatibility, you should know that if you write code for 3.7, it's not gonna work in 3.5. Doesn't seem like a big deal to me.
Re:Python dicts are now ordered by jakear on Friday February 07, 2020 @12:44PM (#22268566)
If you’re the only one writing it and you’re the only one running it, it’s probably fine. But if I’m putting a file out there that will only work in 3.7, it’d be nice if any potential users of that file would get a good error message if they try to run it on 3.5, rather than wrong results.

I could potentially assert a version, but do I really want to do that each time I wrote something that might be used somewhere else?

And yes of course I could add a line of documentation, but there is a 100% chance I’d still get bug reports from people on 3.5.

Re:Python dicts are now ordered by orf on Friday February 07, 2020 @05:52PM (#22272005)
Setuptools solves this, add a python version specifier to your setup.py or pyproject.toml file.

If you are just distributing raw python files then congratulations you’ve just realised why packaging is valuable.

Re:Python dicts are now ordered by Aachen on Saturday February 08, 2020 @06:09AM (#22275181)
If I rely on a python version and I expect other people to use it, I add a version if statement on top. I hate those packaging tools that insist on installing stuff in your system and create a frankendebian when really all I want to do is run a single py file standalone once. Often have to do chenanigans like "python3 -c 'from sometool import __app__'".

If you want to install it, go ahead and copy or symlink it in your ~/bin or whatever you fancy (that's your personal preference anyway unless I'd specifically package it for some OS like Debian). I don't want to have to use some setup.py that I have no clue where in my OS it installs things.

Re:Python dicts are now ordered by orf on Saturday February 08, 2020 @07:27AM (#22275398)
Yes, a failure to understand how your tools work or how to use them effectively does indeed make things harder.
Re:Python dicts are now ordered by Aachen on Saturday February 08, 2020 @06:36PM (#22279381)
Well I know how my tools work, I don't know how this custom file works that is duplicated and delivered with each project.
Re:Python dicts are now ordered by orf on Saturday February 08, 2020 @06:55PM (#22279460)
> I don't know how this custom file works that is duplicated and delivered with each project.

It's not duplicated and in most cases it's not even delivered as part of the installation.

> If you want to install it, go ahead and copy or symlink it in your ~/bin or whatever you fancy

That's exactly what pip will do if invoked with `--user`.

> I don't want to have to use some setup.py that I have no clue where in my OS it installs things.

It installs it to a single place. Run `python3 -m site` and look at `USER_BASE`.

To avoid a lot of this, use pipx[1] to keep things even more isolated.

> Often have to do chenanigans like "python3 -c 'from sometool import __app__'".

You're doing things wrong because you don't know the tooling. You'd also typically just do `python3 -m sometool`.

Things that are distributed as a single file are either so simplistic and have no other dependencies that you can just make do, or written by someone who doesn't know what they are doing and so you're going to have a bad time.

1. https://github.com/pipxproject/pipx

Re:Python dicts are now ordered by zeulhex on Friday February 07, 2020 @04:56PM (#22271441)
Most projects use setuptools for package management, which ensures that the environment is as expected.
Re:Python dicts are now ordered by lonelappde on Friday February 07, 2020 @02:05PM (#22269502)
If you write code that doesn't work in 3.5, you should check the version at startup and exit
Re:Python dicts are now ordered by jakear on Friday February 07, 2020 @05:36PM (#22271881)
Yes, that would be a good idea. But if you ever run scripts you didn’t write, there’s the potential people didn’t do this, and you have the potential for hard to discover bugs. The language should be designed such that bugs are difficult to encounter, this is an instance where it wasn’t.
Re:Python dicts are now ordered by fctorial on Friday February 07, 2020 @08:54PM (#22273177)
#!/usr/bin/env python3.7
Re:Python dicts are now ordered by gruez on Friday February 07, 2020 @11:43PM (#22273933)
so now you have to install a specific python version for your script to work?
Re:Python dicts are now ordered by fctorial on Saturday February 08, 2020 @08:04AM (#22275519)
Only if you're using version specific features.
Re:Python dicts are now ordered by jakear on Saturday February 08, 2020 @02:50PM (#22277930)
What happens when python 3.8 comes out? Everybody needs to go into your script to change the hashbang every time a new release comes?
Re:Python dicts are now ordered by sgillen on Sunday February 09, 2020 @04:03AM (#22281161)
you can just hashbang to python3 which is a symlink to whichever python3.X the user has.

If your code won’t work for older versions you can make an explicit check that the version of python is greater than whatever you need.

Re:Python dicts are now ordered by rmdashrfstar on Friday February 07, 2020 @12:22PM (#22268315)
Major version changes are for API compatibility. If there is a change which makes all other 3.* incompatible, then it should be a major version increase.
Re:Python dicts are now ordered by eatonphil on Friday February 07, 2020 @12:24PM (#22268348)
You're describing something like semver, but Python doesn't do semver.
Re:Python dicts are now ordered by dmurray on Friday February 07, 2020 @12:45PM (#22268574)
And this change would be fine even if Python did.
Re:Python dicts are now ordered by gnulinux on Friday February 07, 2020 @12:32PM (#22268437)
Who told you that? I'm looking at PEP 606, it says nothing like what you claim. https://www.python.org/dev/peps/pep-0606/