Variables in C# vs Python - why people like Python more

Поділитися
Вставка

КОМЕНТАРІ • 8

  • @Pasi4K5
    @Pasi4K5 21 день тому +10

    I think most of the arguments you've presented are invalid. You've pointed out these 4 inconveniences of C#:
    1. "In C#, you have to use a Semicolon at the end of every statement."
    This is true, but on the other hand, in Python, you need to use a \ or parentheses to let the interpreter know that the statement isn't finished yet if you have a multi-line statement. So Python basically just removes one inconvenience and adds a new one in exchange.
    2. "In C#, you need to specify the type when declaring a variable."
    This is simply not true. You can use the `var` keyword for type inference, and using this feature has been the de facto standard in C# for many years.
    3. For some reason you made it look like using a lowercase l instead of an uppercase L being a problem is specific to C#. I'm not sure why, but this is with every case-sensitive programming language, including Python. If you try to run `Print('Hello World')` in python, it won't work, so not sure why you put this in a video comparing C# to Python and kind of list it as a negative for C#.
    4. "C# can't handle a trillion because you only have 32 bits to work with."
    Again, not true. You have 32 bits to work with *if you are using a variable of type int*. There are also larger data types. the `long` type is a 64 bit integer that can store numbers much larger than a trillion. BTW, if you would just use the `var` keyword for declaring variables, you would know that this is possible since the compiler would automatically choose `long` as the datatype because `int` is too small.
    Additionally, I just feel like this video is kind of unfairly one-sided, because you talk about all these differences as "inconveniences of C#" when really those are the things that make C# as robust as it is. You WANT the compiler to yell at you, because if the compiler doesn't yell at you, your program will probably yell at you at runtime at some point, making it much harder and slower to debug.

  • @hypenheimer
    @hypenheimer 21 день тому +1

    mfw AI generated thumbnail

  • @marsovac
    @marsovac 21 день тому +1

    var x = 10000000000000;
    this is perfectly valid in C#. So the argument that C# can't handle trillion is completely bogus.
    What is wrong in C# is to do:
    var x = 1000;
    x += 100000000000;
    This will tell you that long cannot fit into int. Which is a good thing.
    You need to be explicit in this case, because this often is a runtime bug even in python when some bogus high value coming from a bug is fit into another variable and you loose the trace of where the bug came from.
    long x = 1000;
    x += 100000000000;
    This will work, and you explicitly said that you want to handle such big numbers.
    But I understand that python is easier on novices. This is why it is becoming popular.
    However when such novices start to use it for anything serious it becomes a nuisance that leads to bugs that are hard to trace and debug. And if they learnt programming through python they are hardwired to not understanding how code interacts with the machine, making then worse programmers.
    Lower level languages are better to learn the essence of programming.
    Statically typed languages are better for larger projects.
    Python is ok for quick scripting.
    And this is the order in which they should be learnt.

  • @widrolo
    @widrolo 21 день тому

    As a C++ dev, i can only tell you one thing. The problem youre presenting will not be a problem once youre fluent in a C-like language. In fact, i personally cant even write Python, because i constantly keep placing semicolons on the end of lines, surrounding code blocks in brackets and trying to define a type for variables.
    You wouldnt go to China, and complain that English is not understood by Chinese people, and then assume that English is easier than Chinese, since you speak it fluently.
    The same is with C-like languages. I cant write Python without the interpreter calling me a stupid C++ dev, and you cant write C# without the compiler calling you a stupid Python dev.
    Also, no one likes Python more, there is a reason why people and companies use it for making tools and data analysis software, and not for runtime apps and server software.

  • @ScottyCorpse
    @ScottyCorpse 21 день тому

    Buncha C# coders in the comments who've never heard of a joke, and also gloss over the fact that all that was said is true for new devs - but that doesn't mean it's an infallible viewpoint. There's a reason people recommend learning with Python, and a lot of the lulz covered are reasons why. And that's okay.
    Everything has a place.
    Except for jokes on the internet. No place for those.

  • @casunax3484
    @casunax3484 21 день тому

    python is trash

    • @hggpi
      @hggpi 21 день тому +1

      nice edgy pfp

    • @casunax3484
      @casunax3484 21 день тому

      @@hggpi it's from when I was a kid