• 0 Posts
  • 122 Comments
Joined 1 year ago
cake
Cake day: September 9th, 2023

help-circle




  • Python is just glorified shell scripting

    Absolutely not, python is an actual programming language with sane error handling and arbitrarily nestable data structures.

    I don’t like the indentation crap

    Don’t be so superficial. When learning something, go with the flow and try to work with the design choices, not against them.

    Python simply writes a bit differently: you do e.g. more function definitions and list comprehensions.







  • Huh, I really like code like that. Having a multi-step process split up into sections like that is amazing to reason about actual dependencies of the individual sections. Granted, that only applies if the individual steps are kinda independently meaningful

    To adapt your example to what I mean:

    Baz do_stuff(int count, boolean cond) {
    	Foo part1 = function1(count);
    	Bar part2 = function2(cond);
    	return function3(part1, part2);
    }
    

    This allows you to immediately see that part1 and part2 are independently calculated, and what goes into calculating them.

    There are several benefits, e.g.:

    1. if there is a problem, you can more easily narrow down where it is (e.g. if part2 calculates as expected and part1 doesn’t, the problem is probably in function1, not function2 or function3). If you have to understand the whole do_stuff before you can effectively debug it, you waste time.
    2. if the function needs to be optimized, you know immediately that function1 and function 2 can probably run in parallel, and even if you don’t want to do that, the slow part will show up in a flame graph.




  • You can update the whole base image. Vanilla OS and SteamOS have an A/B partition that holds the currently-in-use image and can also hold a to-be-used image.

    Updating works by adding the to-be-used image, setting a configuration option that tells the system to boot that one, and on the next boot it’ll check if the new one is bootable, then either boot it and mark it as working, or boot into the old one and display an error about how out wasn’t able to boot into the new one.

    There’s smart things going on like maybe hard linking files that didn’t change between the two images and therefore saving space and copying time.

    The result is that you never have a broken system, but you can still frequently update the base image.





  • flying_sheep@lemmy.mltolinuxmemes@lemmy.worldTough choice
    link
    fedilink
    arrow-up
    16
    arrow-down
    2
    ·
    edit-2
    2 months ago

    Laptop tries to reboot for 5th update of the day

    I can’t connect to the internet, Dave, I’m afraid I cannot allow you to start me up again

    You try to ignore helpful tips from the guy next to you, pretending your headphones are still active.

    You choke back tears as Windows had enough from your feeble attempts to boot and the power button stops doing anything.