• 0 Posts
  • 26 Comments
Joined 3 months ago
cake
Cake day: March 28th, 2024

help-circle





  • No problems. Learning a new concept is not stupid. So you are familiar with C. In C term, you are likely to do something like this:

    int a[10] = {0}; // Just imagine this is 0,1,2,etc...
    int b[10] = {0};
    for (int i=0; i < 10; i++) {
      b[i] = a[i]*2;
    }
    

    A 1 to 1 correspondent might looks like ths:

    a = range(10) # 0,1,2,etc...
    b = []
    for x in a:
      b.append(x*2)
    

    However in python, you can then simplify to this:

    a = range(10) # Same as before, 0,1,2,etc...
    b = [x*2 for x in a]
    
    # This is also works
    b = [x*2 for x in [0,1,2,...]]
    

    Remember that list comprehension is used to make a new list, not just iteration. If you want to do something other than making a list from another list, it is better to use iteration. List comprehension is just “syntactic sugar” so to speak. The concept comes from functional programming paradigm.


  • You can. Whatever the method returns will be the element of that list. So if for example I do this:

    def mul(x):
      return x*2
    
    list = [mul(value) for value in range(1,20)]
    

    It will have the same effect. But this:

    def mul(x):
      return
    
    list = [mul(value) for value in range(1,20)]
    

    Will just makes the list element all None

    Edit to add more: List comprehension works not from the range function. Rather, the range function is returning a list. Hence the name, “list comprehension”. You can use any old list for it.

    What it did under the hood is that it iterates each element on the list that you specify (the in ...), and applies those to the function that you specify in the very first place. If you are familiar with the concept of Array.map in other languages, this is that. There is also a technical explanation for it if it helps, but it requires more time to explain. Just let me know if you would like to know it.





  • I prefer concise and accurate documentation than clean code tbh. The reason is that if the documentation stated that it should perform something with side effects a,b,c then I at least know what to expect. When contributing, this also makes it easier to implement something because we have the requirement at hand. Understanding shitty code is easier than understanding human requirements. Shitty code is the language we use to talk with a computer, so at least you’ll know exactly what will happen.


  • I didn’t specifically comment on GNOME ma dude. Just the other commenter that said most people don’t want choice. I think it’s not “choice” but it should be “choose”. Having to choose can indeed become confusing, so there should be a default or pre chosen choice. Having no choice means you are locked in. Hence my comment. I am having no problem with people not wanting to choose, but people that do not want a choice is when I am starting to have a problem.





  • Yes, and hence my comment on flatpak which turns out is false (that the upstream developer is usually the distributor/packager too). And the other still applies, distro usually adds a specific tag anyway for their refresh. Like that one time xz on rolling debian was named something x.y.z-really-a.b.c.

    I think flatpak packagers should also append the specific tag too if that is the case. Like, x.y.z-flatpak-w where w can be the build release version




  • Yeah, that’s fair. But I will still recommend anyone trying out linux AND having a problem to consult Arch Wiki when they can. It is amazing what they have there. It will also increase your technical understanding of how your system works overtime. But if you don’t have any problems when driving linux, that is good too. It just means linux for the masses is coming closer.

    For some distro recommendations, if you love to tinker, I’d say go arch. You will learn a lot about your computer too, and it is also how I learn about mine and get the know how for a lot of things now. But also, if you don’t have the time to tinker, I’d recommend bazzite. I’ve read their documentation and came to the conclusion that if anything goes wrong, it would be easy to recover from it, has great community, and is based on a solid distro.


  • Yes, first you need to resize the partition to accommodate the new OS. Usually 40-60 GB is good enough for minimal linux installation if you didn’t do any gaming or other massive applications. The resizing can be done in windows using disk management utility baked into windows, or some other partition manager (easeus, magic tools, etc). After that, linux can be safely installed in the free space as a single partition.

    Now, sometimes the bootloader is fucked, but it is quite easy to fix. In fact, if you use grub, it usually runs os-probe for you to check for any other OS. So sometimes, fixing it is as simple as rerunning grubmkconfig. But there are other times where it is not as simple. It will vary depending on what happened and too long to list here. Arch Wiki usually covers a lot of the topic so you could try searching there, especially on the topic of boot sequence.

    Lastly, if you need to move the partition, the data already inside will need to be moved too. This can take time depending on the size. But it is doable and safe.

    If, later down the road you want to remove either OS, you can simply remove the partition after moving the data first. Linux can mount ntfs natively so no problem there. On windows, there is a program called ext4 explorer or something along the line to browse and copy from linux filesystem (which is usually ext4). Don’t forget to remove the boot information too after you’re done removing the partition.

    Now there is also the other suggestion to use a live environment but I didn’t suggest it since the experience can be lacking and more hassle in and of itself.