Now of course, you gotta remember that installing something is usually more than copying the code, and there is nothing to help you with that, in any language.
Welcome to the world of deployment, which is why things like ansible and docker exist.
Python already does so much for you, and provides so much tooling to do even more, it's hard to write bad code if your daily job is to be a coder.
The iterator protocol means you rarely get off by one errors, context managers and GC deals with resource handling, the GIL, for all its faults, helps a lot of concurrency errors...
Now, add a good IDE, and syntax errors, names errors and attribute errors go away. Play a little in the REPL, and use cases become more obvious, behaviors more clear.
Want more security? You can add type hints and unit tests (which are incredibly easy to write, thanks to pytest).
Even without all that, the size of the ecosystem means you won't write most of the code anyway, and less code, means less potential for mistakes. Adds to that the language bare bone syntax, and you really has something that actively helps with writing good code.
Not to say you can't write bad code in Python, but unless you are not a professional dev (in that case, you can write bad code in any lang), you have a lot to help you there.
Not to mention facebook leaders don't care, they already made billions by misbehaving without any consequence. Even if the story did end there, it's 100% win for them.
This is the lesson of our generation: makes money by delegating the consequences to society. Nothing will happen to you. In fact, in 20 years, you could buy the service of some PR firm, and they will even make you a hero in the eyes of the public eventually.
I mean, they abuse the system like dictators "abuse" guns to kill people.
If you have a company selling a weapon, it's pretty obvious it's going to be used to harm. That's by design.
And just like we were never able to prevent the guns to arrive in the hand of the wrong people, or make sure people using guns respect any kind of rules, why would we expect NSO clients to be well filtered and behaved?
If you are a 40 year old, inactive person, try defending yourself against a knife or a club, especially against a younger person who has had experience using it.
But that is what I meant, this StopIteration would not be affected by the zero cost optimization. The zero cost optimization is about compiled Python bytecode and the VM interpreter. The StopIteration is handled internally by CPython (not via Python bytecode).
For example, consider this function:
def foo():
for i in range(3):
print(i)
There is no try-except in this code, and neither in its bytecode. So this is not affected by the zero cost optimization from the linked issue.
The iteration logic is inside the `FOR_ITER` op. And that is purely handled inside CPython.
Also, this is again what I meant: In user code, you rarely would use custom exceptions for control flow. Please show me any example where you have seen otherwise.
So, again, what I wrote: I'm very confident that for most user code, the code path under `except ...:` is only rarely executed. Please show me any big Python project where this would not be the case. I doubt that there is any.
> The for loop in python is a try/except catching StopIteration in a trench coat.
That's...horrifying, both from a computational efficiency perspective (due to the overhead of exceptions) and from a "beauty" perspective (exceptions are supposed to be exceptional, darn it!). Why is it implemented this way? Why not just use a normal loop and check a return value from the iterator?
(It's certainly not unanimous. Guido himself is on the record as saying EAFP isn't better than LBYL, but in most of the Python I've cruised through these last umpteen years [that wasn't some other language written in Python], I've certainly seen an overall preference for EAFP. Naturally YMMV.)
I think that implies that either "exceptions" are misnamed in Python (as in every other language with that name, they're meant to be exactly that - exceptional - so whatever Python calls "exceptions" isn't the same as in other languages), or that that particular idiom is wrong, and needs to be rethought.
> Why not just use a normal loop and check a return value from the iterator?
Because an iterator needs to be able to return any python value, and if you did that, there would be at least one python value that an iterator could not actually return.
Unless you required the iterator to wrap real return values in a container (basically, an optional/maybe monad) but then you have unwrapping overhead on every real return value, which is worse.
Couldn't the runtime just allocate a specific Python object representing the case where the iterator is complete? Make that object implementation-specific, hide it as best as you can, write documentation stating that users should not use this value directly, and if they do - they voided the warranty, and should expect evil to befall them. (ultimately, you can't prevent the user from doing really dumb things e.g. editing the Python binary directly)
You do that with two or more of the protocols that Python has that use return values for return values ans exceptions for flow control signals and...you make it a lot harder to work with them, especially in conjunction.
Can you give an example of this? I can't think of any myself - generators also raise a StopIteration exception, for instance, so they could use the same value.
> they have created a system of incentives that are inexorably leading to harmful outcomes
If the people inside are "smart, thoughtful, kind, well-intentioned people", they would have tried to work around the incentive, influence them, denounce them, or quit.
It rarely happened. Most of the time, the just take the money, and goes with the flow.
A long time ago, I worked in a startup full of smart, thoughtful, kind, well-intentioned people. Of course, there was also a CEO who was a ruthless manipulator and managed to make everyone believe that they were working for the greater good. In truth, in the course of lining his pockets, he was in the process of destroying several employees and former employees.
Getting past the illusion was hard.
Taking a stand against said CEO while nobody else was aware of the problem? Really, really hard.
Now, instead of a few dozen employees, Facebook has tens of thousands. I assume that all of them are subject to permanent propaganda, as in many tech companies, and that the semi-official word is that they are being misunderstood by the rest of the world, because of course they are doing the right thing but the problem is harder than people think (well, that last part is true, at least). I suspect that it's even harder to go against the flow.
It's a good insight for any transformation really, including change in code: look at what's in common between the desired outcome and the current situation to have an idea how how much work to do.
1 - I need the client to use encryption and be open source
2 - It needs to run on linux
3 - It needs to backup files in arbitrary locations, including spanning several partitions (one NTFS, one ext3)
4 - It needs good filtering / curation capabilities
5 - Restore should have great granularity, and I should be able to browser the archive without having to unpack it all
6 - it needs to be easy to setup. I don't want to setup my own instance or mess with config files.
I've never found a tools that could do all that. One of those always fail, and sometimes the tool promise all of them, but doesn't even manage to backup. Some backup only partially, missing a files. Some backup, and don't restore. Some can only restore the all archive. Some don't encrypt. Some are close source, or only available on Mac and Linux. Some will store wrong files, and you can't them out of the backup.
It's crazy that in 2021, the state of backup sucks so much.
So have 2 backups on 2 different hard drives for all my files. One with "way back machine", the other one with a simple cp. Then I take essential files, and I put them on a usb drive.
You have a very particular list, so it's not at all surprising that you're having trouble finding something.
> It needs to run on linux
That right there is going to imply some level of knowledge from the user. Expecting a zero-config install for Linux is pushing it to begin with.
> It needs to backup files in arbitrary locations, including spanning several partitions (one NTFS, one ext3)
And
> It needs good filtering / curation capabilities
And
> it needs to be easy to setup. I don't want to setup my own instance or mess with config files.
Are pretty much mutually exclusive. If you want it to be powerful you'll need to do the work to configure it. If you don't want to do the work it's not going to meet your needs, period. No product exists that will meet all of these criteria, even for Windows. I don't think a product exists that would meet half of them, and certainly if it does it's not open source.
What you really want is rsync over SSH to a ZFS volume with encryption enabled, or some other CoW filesystem that lets you do snapshots and access them online.
If you want to get close, go buy a Synology NAS and set up a nightly rsync cron to it, then set it up to archive to AWS Glacier. That'll get you most of the way to your ideal, and it'll be done instead of perfect.
> Expecting a zero-config install for Linux is pushing it to begin with.
How so? Dropbox is zero config install for linux.
> Are pretty much mutually exclusive. If you want it to be powerful you'll need to do the work to configure it.
I never said zero config, I said easy to configure. Firefox has plenty of configuration nobs, but it's easy to configure it.
> What you really want is rsync over SSH to a ZFS volume with encryption enabled, or some other CoW filesystem that lets you do snapshots and access them online.
No because that's very complicated. I've done it in the past, and just the fact I have to manage a VPS to do so is more than what I want to do.
I've used rsync as well, it's again, too much scripting, meaning to much margin for errors.
Apple Time machine for linux is what I want, with remote capabilities.
You have Dropbox and it's no-config required. What's wrong with that? Is it that you have to configure it for it to do what you want, and you don't want to take the time to do so?
You don't want to set up a VPS, even though I mentioned nothing about one. I said to buy an appliance, same as a Time Capsule or whatever that Apple thing used to be called.
You think rsync+SSH+snapshot is complicated, but you don't know that Time Machine is exactly that, just hidden from you so if anything goes wrong it's a black box that you can't recover from.
You think rsync is too much scripting - what are you trying to do that requires scripting beyond `rsync -aP src dest`?
I use borg with rsync.net (and another host as a backup-backup). Works on linux. Backs up what I tell it to, I can mount any historical backup as a filesystem and copy stuff over. Uses encryption, is open source. You can point it to multiple backup locations for local and remote backups. Works for me. Takes about three minutes to do an incremental backup to two locations every evening.
I get that you want what you want, but I gently note that I see quite often in FOSS circles people decide they need a laundry list of things unsatisfied by the available offerings and determine the field is a mess.
You've DQ'd the majority of backup services with your first requirement. You want what you want, but realize you're doing it.
But Firefox has a much better feature: tab containers. You can attach a label to a tab, and only tabs sharing this label will share states, such as cookies, cache, localstorage and so on. This means you don't need to open a new window. You can have 2 HN accounts with each a different user logged in, in 2 tabs, next to each other, distinguishable with a color.
Multiple browser profiles also let me have one profile for work, another one for personal stuff, and yet another one only with stuff like vue/react/svelte dev tools and remote debugging enabled, and _then_ decide which one to open at any given time. This instead of opening every container at once, or something like selectively opening a bunch of bookmarks manually into a specific container (I use buku to manage and sync my bookmarks too, so no tab container support there).
Installs are now an scp.
Now of course, you gotta remember that installing something is usually more than copying the code, and there is nothing to help you with that, in any language.
Welcome to the world of deployment, which is why things like ansible and docker exist.