The Differences Between C# & Python

48
3



C# & Python are both great languages! But what makes them different?

Check out more lessons in this course:

SUBSCRIBE FOR MORE:
SUPPORT ON PATREON:

Please follow me on social networks:
twitter:
instagram:
reddit:
facebook:

REMEMBER TO ALWAYS FEED YOUR CURIOSITY

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

48 COMMENTS

  1. With the use of dynamic feature (C# 4.0) you can write doit = true; and then doit = 1234; I have implemented such an object and I'm able to write the following:
    var doit = new DynamicStruct(); // DynamicStruct is my implementation (~150 lines of code) that uses dynamic feature introduced in C# 4.0
    doit = true;
    doit = false;
    doit.whatever = 1234; // no need to declare "whatever", just write the assignation, it will be created on the fly
    doit.whatever.anotherVariable = new List<string>();
    doit.a_new_var_when_I_want = doit.whatever;
    When looking at comparisons between C# and Python over the Internet, because they are not made thoroughly, all of them are pretty much the same incomplete and deceptive consensus.

  2. Only a very young developer would think changing the type of a variable is remotely a good thing to be able to do. It's not "cool," it's a massive source of bugs and represents a total lack of discipline. Declaring a second variable is not a remotely significant amount of work and it provides clarity by having a name specific to its new use. Reusing the same variable over and over just to avoid declaring another is just an invitation to extremely muddy code.
    Yes, data scientists do like this feature, but that's because they're not professional programmers, they're professional data scientists. They write very buggy code. Frankly, Python is a very old language and people only use it because young, undisciplined devs are seduced by the supposed utility of writing fewer characters.

  3. In C# i would replace bool and int with var. Essentially the compiler will still complain when you use the variable in invalid places, so type checking is still done in this case.

  4. Side note: Python looks MUCH simpler and easier here. But don't be fooled, it's not at all as simple as that when choosing between programming languages.

  5. nooo… no, just no… 😩😩 Typecasting is completely different thing… aghhh… we *DECLARE*. When we do that in C#, we're basically saying – yo, processor, save some space in the RAM. But typecasting is when you want to assign a value of one data type to another. Example:
    {
    int x = 5;
    double y = 2.25;
    int z = Convert.ToInt32(y);
    Console.WriteLine(x+y+z);
    }
    A variable of type int gets a value of type double (it rounds itself).
    Pretty sure he doesn't know what a compiler is too(Most Python users don't :D), but gotta give him some points, because it'd not really matter for beginners (however when they go to a interview after 2-3 years 😐). Python is an interpreted language? Let's not even start with that…

  6. When I was coding in python, the indented lines were being accessed from outside of the indents, idk how my syntax is wrong, here is a copy+paste of my code,(it still prints a in console)

    doit = True

    print("Checking…")

    if doit:
    a = 1
    doit=False
    print("Set to False!")

    print(a)

    print(a)

  7. you should dig a bit deeper to reveal real nature of difference between Python and C#… it's not about being an interpreted language… true reason behind Python's flexibility is its consistent object design… there are no primitive data types like in C# and Python’s variables are nothing more than tags which store reference to objects… Python’s variables have no type, they just link to objects which have type. When you do assignment operation in Python you just create a new object and assign name (variable) to store reference to it 😉
    apart above seems like don't understand scoping in Python… you can't access variable assigned inside if statement when tested condition is false… this assignment never happened and it is not due to scoping! in fact if statement has no local scope in Python… modules, functions and classes have local scope in contrary.

  8. Whenever I run the code, my output says "'python' is not recognized as an internal or external command,
    operable program or batch file." I've tried going into Adanced System Settings on my computer to change the Path, but it still shows the same output. Can anyone help me with this problem?

  9. I feel like I'm learning something here but it's just not being absorbed well. Regardless I'm glad these videos exist because it beats trying to read textbooks.

  10. Most highly experienced programmers welcome the required variable declaration of C#. The small amount of time spent declaring a variable can pay huge dividends in debugging. It easy to assign a result to a typo instead of an existing variable name and spend hours tracking it down. The rule is pay a little now, or pay a lot more with interest later.

  11. maybe i misunderstood but as far as i know you can actually initialise a variable in one code block and read it /set a new value in another.. it just didn't work because doit was False, the if condition therefore wasn't met and the variable wasn't actually initialised.

  12. also in python (don't know about c#) you can use the keyword global to define a variable in a local scope to be used globally (outside that block of code)

  13. Funny how any low level tutorial begins with declaring method variables when in fact along the way to code enlightenment you realise you should never use method variables. Peace,

  14. Jabrils man I love your videos you have great content. But this playlist isn't what I need. I know the basics of syntax and I know python pretty well. But every other video I see about coding is all about syntax and commands. What commands do this and that. But what I need is more about implementation. There isn't a lot of content about how to implement the language into creating an app. Like why do def _init_ what's that mean why do we need it, how is it needed when do we need it. Syntax is simple and easy to get through and most languages are the same with syntax just put together differently. I think you'd hit a good amount of beginners if you show us how you know what you need to do. How to find out what you need to creat for specific program ideas etc. I don't know how else to explain it but you're the only one I've reached out to.

  15. This is the first video I've seen from you and I want to say that this was a very good video. I am a java developer but I'm looking for another language (just so i can more easily relate to other developers). I've coded a tiny bit in python and I was wondering if I should switch to C# and this video was very informative thank you!
    The only thing was that you used casting incorrectly, casting is changing a data type to another data type, an easy example would be an int to a float or vice versa, so like the random function (at least in java) returns a float but let's say you want to use an int you could cast it using int random = (int) Math.random(); what you meant to say was just declaring the type. However since casting works the same way in C# vs Python (as far as I understand that might be wrong) I don't have a problem with it.
    Great video tho, I subbed and I can't wait to watch more of your videos!

  16. I like python, because it’s quick to get applications running. However for large projects where you may be working in a team,or needs to be maintained, you should use c#. The strong typing prevents bugs from forming and helps greatly for self documenting code.

  17. You do declare data type in both C# and Python. Explicitly in C#, implicitly in Python. In C# you can't redeclare, but in Python you can.

LEAVE A REPLY

Please enter your comment!
Please enter your name here