Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Why use Python or similar?
36 points by Xelom on Jan 12, 2014 | hide | past | favorite | 69 comments
Hi,

I am a .Net developer. I love C#, I think it is a great language with fantastic features. I'm looking at new startups job offerings and open source projects source codes a lot. I see a lot of Python or Ruby generally.

I know C# is not open source. That is not the case. You can use Java even Scala. But when I look at performance Python is not near C# or Java. And I can't seem the find features of C# in Python. In my opinion, I feel more comfortable writing C# than Python. What is the reason behind choosing Python if it is slower and lack a lot of features when compared to my preferred language?

I'm not trying to say Python is bad or anything. If a lot of people using it there must be a reason. But I can't see that reason. I'm trying to find it so I can give my time to the langauge.

Thanks



One thing that I really like about Python is the interactive style of development that it encourages, at least for me. I tend to do Python development in emacs with source code in one buffer and a repl in another buffer, building my program up slowly and evaluating bits of it as I go along. This style of development works very well for me. There are other languages where you can do development like this but (and please correct me if I'm wrong), this doesn't seem to be the way that people write code in C#.

Secondly, with Python, the most popular implementation of the language is supported on all the main platforms. Compare this to C# and .Net where, although you can use Mono on Linux and Mac, you'd not be using the same runtime that folks would be using on Windows. Call me paranoid but I still don't wouldn't trust Mono as much as I would trust CPython or Microsoft's .Net runtime.

Having said all that, and despite the fact that I've written little C# code in anger, I still do like the look of C#. Microsoft seem to have done a pretty good job of updating the language over the years to support stuff like generics and functional programming. They've certainly done a better job on this front than Sun/Oracle have done with Java. If C# works better for you than Python does on the platform that you use then I wouldn't worry about sticking with it.

(EDIT - typo)


Smart comment, the very accessible REPL can inject some fun into development.


Generally speaking, the Python community believes the strength of Python is in its culture, which can be summed up by the Zen of Python: http://www.python.org/dev/peps/pep-0020/. Python also recieves much praise for being easy to learn, readability, productivity, expressiveness, and its library support, namely NumPy and SciPy (Python is often used in scientific computing for this very reason). Aside from this, Python programmers like it and that's reason enough. Performance for Python (and Ruby) is adequate for most use cases.

Personally, I don't like Python. If I want a dynamically typed language, I use Ruby, but I came to this conclusion after spending time with both languages, and it wasn't the feature set that sold me of one over the other, but rather how I felt while working in the language and its ecosystem. In other words, whether or not Python or Ruby are worth your time is a decision you'll only be able to make after using the language.

I believe in being language agnostic whenever possible. Don't hold strong opinions about languages. People invest a lot of time and energy into their tools. This is a "sunk cost." Their time and energy can't be reclaimed. So it's no surprise that, when asked, they will praise their tools -- even if they aren't objectively all that great -- solely to justify the costs. They aren't trying to convince you, they're trying to convince themselves. So don't waste time trying to find feature comparisons. All languages have redeemable values, and learning a new one is always a valuable exercise.

So give Python and Ruby a shot. You might find you actually like them, but not for the reasons you expected to. And if you don't like them, at least you'll know why.


I have to disagree with the last part of your post. Some languages are actually better in quantifiable ways; for example, shorter development time, better performance, etc.


But no language is best in every case. Putting skills into language agnostic pursuits means you can use whatever is objectively best as needed, ideally you'll have already used it.


There are any number of reasons to use Python over C#.

(1) Ecosystem. Choice of language is often not dictated by language features, but what library features and especially third party libraries are available.

(2) Simplicity. It's a lot easier to teach Python to non-programmer domain experts than C# or Java (a major reason, I think, why Python is used so extensively in scientific computing).

(3) Not being dependent on an IDE. Using an IDE is not always an option (e.g., system administration on the far end of an SSH connection).

(4) Prototyping. Especially when doing exploratory programming, a static type system can get in the way of drafting your ideas.

(5) Extensibility. It allows you to easily provide scriptability or configurability via Python.

(6) Portability. Like most interpreted languages, Python is extremely portable across a great many architectures.

(7) Interfacing with C. While P/Invoke is much better than the JNI, Cython is easier than both.

Speed, incidentally, isn't as much of an issue in many application domains as people seem to think. If it's needed, it's frequently just a few inner loops that dominate execution time, which can be implemented easily enough in Cython.

As for Python (or any other language) lacking features that you find in C#, I think you'll find that some programmers will think the opposite (e.g., much more cumbersome metaprogramming in C#).

In short, which language to pick (insofar as that choice isn't dictated by your job anyway) is influenced by a large number of factors, which different people will weigh differently.


In a lot of cases, the "performance" people care about when making language choice is "developer performance". People choosing Python feel (perhaps incorrectly) that they will be more productive and able to build things faster with that language than any of the other ones they considered.

Contrived example: If it will take you 8 hours to write something in Language A that takes 30 seconds to run, or 30 hours to write it in Language B and have it run in 15 seconds, which do you choose? If raw performance isn't the thing that's valuable to your company, maybe Language A is a better choice (even if it's slower than Language B).


    using System;

    public class Hello
    {
       public static void Main()
       {
          Console.WriteLine("Hello, World!");
       }
    }
vs

    print "Hello, World!"
Everything is just simpler in python and ruby.


Assuming size of a pretty normal simple program is 10k LOC. Lines required to get an entry point of program, Python: 1 (0,01% of such program), C#: 7 (0,07% of such program).

Worry about the things that matter, the number of lines required to get to an entry point is not one of them. Neither is printing to the console.

And to be fair, if you are doing python seriously you would probably also have an ´if __name__ == "__main__":´ line, and a ´main()´ function called immediately from there to avoid shadowing of module variables. Assuming also you want to use the command line arguments you will have to ´import sys´ and suddenly the lines required are almost exactly equivalent short of the braces in C#.

Don't get me wrong, i absolutely love the conciseness of python but i frequently see this silly example being used which in the big picture doesn't mean anything. List comprehensions on the other hand is an excellent example of where the conciseness really shines. Really, you can do things in 1 line that in other languages takes 30. Although C# also has similar feature through LINQ so that's not a killer feature to convert someone from C# to python in particular.


> Assuming size of a pretty normal simple program is 10k LOC.

This is a pretty big assumption, no pun intended.


You can remove or add one digit if you want, the example is equally silly :)


"Worry about the things that matter, the number of lines required to get to an entry point is not one of them"

Getting started on prototyping ideas is most of my life. I rarely use the code I write.


If I open a new console application in Visual Studio. I have all those boilerplate ready for me so I'm also typing:

Console.WriteLine("Hello, World!");

That's all. So I'm not even talking about the greatness of the C# IDE.


Then you're in Windows.... And Visual Sudio is a best in class IDE, but that still means it's an IDE.

(read: there is just a MASSIVE culture gap. It's just as unfathomable to Ruby/Python people why you'd ever use C#.)


I really don't see any bad point of using and IDE. Or being in Windows... It's making me a lot productive. I don't have to search the docs when I forget a function, it is there with intellisense(and explanation of it). I can debug every piece of my code with the values of my variables. It handles a lot of the boilerplate for me too.


As I said, it's culture. C# is a pretty decent language, but all of this is so far removed from what I (and others) want that they sound like negatives, not positives.

In the exact same way that I might say "I use Arch Linux, and the only GUI program is Firefox. I live my entire life in the terminal, in vim, and I use languages that have no ceremony in the first place and prefer log statements to debuggers." That probably sounds like all downside to you.

Use whatever you like. It's not that important.


The difference is that Python and Ruby (and similar languages) don't have this boilerplate to begin with. Someone writing Python for a living doesn't have to use an IDE (most don't), but for a Java dev it's almost a requirement.


Like the parent of your comment said: There is nothing bad about it. It's a cultural gap.

I would never resort to a language like C#. It doesn't mean I think less of the language. I just prefer Ruby.

I like not having to use IDEs. I like my text editors.

Discussing languages is like discussion flavours. It's just preference. It's like asking me why I prefer bananas over apples. I just do.


You can either write a program that'll help you create programs in a language it can understand (the IDE way), or you can use a language that's so powerfull that no program can completely understand, and use it to write simpler programs, avoiding the need of automating things (the Lisp way). Anyway, you can not have both, but you can be in between.

Python is not at the Lisp extreme, but it's not very far from it.


Boilerplate isn't a good thing, even if it's auto generated there is still overhead


> If I open a new console application in Visual Studio

That's the thing, you need an IDE to be able to skip the boilerplate, whereas both Python and Ruby have a great REPL that is available from virtually every terminal emulator.


I like my IDE. It makes the development really easy. I have intellisense and fantastic debug features. I install it one time and open it every time like how you open your terminal.


I'm just saying that C# comes with a lot of baggage. You may like that baggage, but most people who chose Python/Ruby instead of C# don't.

Personally, I like C# the language. I hate the baggage.


vs

    H
in HQ9+ (http://esolangs.org/wiki/HQ9%2B).

Everything is just simpler in HQ9+.


Hardy har, har, Giuseppe.

Simpler and easier to read.


To some extent if you choose C#, you also have to choose windows, visual studio, iis, etc. In python you can take each of those pieces and exchange it for something else. A lot of people like to do that.

Fortunately if there's no need for a lot of .net ecosystem, you can run .net on linux and similar systems using mono. (I have and it's a great platform to write for) But as soon as you want something more than the bare .net you'll realise the pieces are hard to find.

Regarding the missing features - I don't think there's anything missing, you just need to know where to look. Only linq may not be available since relies on specific syntax, but due to what you can do dynamically, it's not that needed in the first place.


Use what works for you.

In my case, that's python.

It's portable (cross platform), the final product is (usually) the script files themselves vs. an architecture specific "executable", and the language includes "batteries" I find useful in the standard distribution: XML, JSON, and (a limited amount of) HTML parsing, URL parsing and retrieving, regular expressions - stuff that makes what I love to do (data wrangling) easy.

Additionally it has the benefit of being pre-installed on my OS of choice, OS X, and in that specific distribution a very useful third-party library comes pre-bundled: pyobjc

This means that I can write what is, in essence, a plain text file that "runs" on most any recent version of OS X and has almost full access to Apple's ObjC (and C) APIs for controlling their systems. Talk about power!

And if someone on OS X wants to change the program? Nothing more than a text editor is needed. No need to re-compile, install an IDE, or a set of developer tools (outside of the python interpreter itself, which is pretty much on everything but Windows out of the box).

This last reason is specifically why python is very popular in the OS X sysadmin world right now. A large number of great open source OS X tools are written in python.


Beyond just OS X, you can use python and most other languages in that space on cheap, ubiquitous hosting without having to pay extra licensing fees. For me, this is one of the biggest advantages to going the open source route. There are, of course, downsides to not having a company backing your tools, but they can be balanced against the community associated with the your language of choice.

There's also the build/test/deployment cycle when developing, which pudquick touched on indirectly. With scripting languages, deploying a new build to test is usually as simple as saving and restarting the process. Sometimes you don't have to go past saving. The last time I dealt with C# and languages in that space (C/Java/ etc..) a build cycle involved a compiling a potentially several more steps. If you've worked with languages that don't require that, having to use one that does can get annoying pretty quickly. Especially if the project is of any size.

Another big point is the availability of libraries to do things you want to do. Most of the open source language platforms have large repositories of libraries that you can pull into your project with ease (pip, rubygems, cpan, pear, clojars, etc ...) and management tools (gem, bundler, cpan, perl-lib, composer, leiningen, pip, etc ...) to simplify installing/using those libraries.

One other thing, and this is one I see as absolutely huge, python, ruby, php, etc encourage pull people into a larger community if you get beyond anything trivial. This exposes a developer to other languages, other platforms, and other ways of looking at software. Of course, that means the developer has to go looking as well.

Still, there are four (non-comprehensive) big reasons to use any language:

* It pays the bills

* Its a good technical choice for the "job"/project

* You like working with it

* You have to maintain someone else's toys


One thing that has not come up in other comments -- how many languages do you speak? From the tone of your comment, it seems like, not many.

If so, you owe it to yourself to diversify your language set. Which way you go does not matter so much as going somewhere. So don't over analyze it, just write some stuff in Python for a couple of months and see how it feels. The learning curve is not steep.

As you do this, don't waste energy trying to write C# code using Python, or giving up because feature X is not there.


If you like C# then use C#.

I think there are some people who see C# as a "Microsoft Thing" and won't have anything to do with it.

As for Python, I don't particularly care for it, but many people find it to be a satisfactory language in the sense that you find C# satisfactory. That is, there are lots of good libraries that you can do to get many tasks done quickly. Performance doesn't matter much in applications that are limited by network latency, disk I/O or waiting for database calls to come back.


I'm writing a lot of little batch programs in my job. Like get those 1M records from db. Process them with an algorithm and write to results to this other table. I think you should write faster with Python. But performance of the processing is also important and LINQ helps a lot with the writing time.


That'll of course depend completely on the nature of the things you do with those records you get from the database, but 1M recors don't seem like much (do you join them with something?).

But if LINQ is what you need, well, Python may have a similar or not, depending on how you use it, but there is no reason for you to start writting C# in Python.


This maybe a bit overkill, but you could take a look at ORM layers. Something like http://www.sqlalchemy.org/ instead of playing with SQL directly.


yeah, sqlalchemy core is pretty good _if you really need to build up dynamic queries_. (I haven't used the full up orm).

But if possible, I still just prefer looking at a full sql statement.


I'm a scientist who uses programming as a problem solving tool. Before learning Python, I spent upwards of a decade using Visual Basic.

My workplace has mostly C#, whereas I'm not part of the software development team, and am free to choose my own tools.

For me, a problem with proprietary IDE's is that the forced distinction between "development" and "run time" environments encourages centralized development, which invariably becomes bureaucratic. When I need something from the programming department, they hand me a program which I have to carry to the target computer, test, and report back to them on any bugs or further changes. This cycle can take days or weeks if they're busy with other projects at the same time.

In contrast, most of my work happens to be decentralized because it occurs in labs where the physical problem to be solved is located. Some of this work now occurs overseas. Much of it is done on computers that are off-network because the IT department rations connections. Locating the full development tools on each computer lets me quickly write and debug programs. And if I share a program with somebody else, it's not prohibitive for them to learn how to make their own changes. I had a total non-programmer say to me: "I think I found a bug in your code, and fixed it."

My situation is one where I actually have a reason to keep and share my programs in the form of source code rather than as an installable / executable package.

As well, I found Python to be easy for an old geezer to learn, and to write reasonably bug free code. And I love the packages.


Python code is smaller, and had better package management. I am sceptical you have something in C# that does not exist within a "pip install XXX" in python.

Python requires less LOCs than C#

Less code to maintain and it's quicker to write. Binding to C is no problem either when you need raw performance.

You can run it on a wide range of systems too.


Actually p/invoke in .net is as easy to use as cffi, so c bindings are not a big differentiator between those languages.


The main reason people use Python or Ruby is that it's typically more productive. It's basically saying that you value saving development time, organization, a vast range of free 3rd party libraries, and easy dependency management more than you value runtime efficiency or code execution speed.


I love and use both, so here's my two cents:

(Context: I am not a 'hardcore programmer'. I don't use vim or emacs because I'm simply faster/more productive with an editor that I don't need to go through a learning curve for. I am not averse to the command line, but GUIs can be advantageous at times too.)

Python is great. It's free, and available on every platform I care about. It has libraries that do absolutely everything in the world right out of the box. C#/.NET is great too. It keeps everything structured, the syntax just makes sense, and Visual Studio is the best IDE I've ever used, with great debugging tools and smooth integration of everything you require (I've even started using the built-in git control at times). However, when I was previously using a Mac as my main machine, .NET programming was largely ruled out for practical purposes. For similar reasons, finding web hosts for my ASP.NET MVC applications (which is an AWESOME framework btw) was harder and costlier. Visual Studio was free for me as a student, but the pricing would be absolutely ridiculous if I had to pay for it myself. On Python, I have a ton of choice, eg for a web framework I could choose a barebones HTTP server, or web.py, or something as heavy-weight as Django. On .NET, I'm pretty much restricted to ASP.NET, and if I don't like its defaults or the convention over configuration aspect, I'm so outta luck. In fact, for less common things, like client API libraries for specific websites, I might only find implementations in Python and Ruby, not C#. If I want help or to find documentation, the Python docs suck IMHO, but the community is amazing, whereas the community for ASP.NET isn't as robust in my opinion. There are many python experts who will happily explain obvious-in-retrospect things, whereas with .NET I'll sometimes get stuck with configuration files and what not that make no sense to me or to anyone willing to help. Lastly, if I want to quickly throw a script together for a puzzle or online coding competition, Python feels a lot more light-weight and easy to get started with than C#.

Python has a lot of downsides too, but I've got to cut this comment short now. The point is, each language has its own pros and cons - try Python for a few weeks and you might find that it isn't as one-sided as you think.


Performance is not the only reason to choose a language. Suitability to the particular project, availability of useful libraries, developer productivity, team members' existing skillset, health of the language's community, speed of change in the language, integration of the language with tools already in use, ease of learning for new team members.

In my experience as a sysadmin running hundreds of different applications written in a wide variety of languages over the years, I've seen some of the worst performing apps written in the "fast" languages you mention, and some of the best performing written in Ruby and Python. Of course, it can go the other way as well. My point is that the quality of the code has as much to do with "speed" as the language chosen.

And I could go on and on about maintainability, ease of refactoring, and more. But I think you probably get the point.

If you're curious about why people like Python, the best way to understand it is to learn it yourself. There are lots of free tutorials online and if you are already a skilled OO programmer, you should have no trouble picking it up. Spend a few weeks investigating it, and you might find that you prefer it, too!


As some others have pointed out, speed of the application at runtime is not always the most important consideration, else we'd probably be doing everything in a mix of Fortran, C, and Assembly.

I have found that developer productivity is higher, especially when it comes to maintenance. For me, all the tools in an IDE help offset Python or Ruby's simplicity when working in say, Java, when writing new code. But when reasoning about old code I haven't touched in a while, or looking at others' code, Python is easier for me to reason about.

If casting about for a reason to learn any new language, I can think of a few. Understanding another language and how you approach problems with it may provide insight on how to better use your main language. Your career may be long, and your main language may not be popular forever. When acting as a hiring manager, I look for people who know multiple languages, even if I only need one. Especially if they tackled learning them outside of school. It shows both passion and initiative.


I've used python for at least 8 years, all on linux. It works fantastically well for complex shell script replacements and small projects like web interfaces. It is extremely expressive (lots of power on a few lines of code) while being readable (at least certainly to english speakers, since strange symbols are minimized).

We replaced an old perl-cgi web site with it, and I wouldn't touch anything related to perl with a 10 foot pole ever again in my life time (cough, cough, ruby). Perl is astounding at hiding bugs.

Python integrates pretty well with Unix kernel apis, and the unchecked exception handling is fantastic IMHO. If you want, you can also do exactly what GO does and have multiple return values (for apis you define), but I haven't felt the need to do that too many times.

I also like pythons string and regex methods. C++ std::string is a freaking pile of crap. (even in c++11, I believe).

Where python annoys me is on a large code base (30K lines+). This is where a very bad contradiction in python's zen appears: staying readable. I should be able to read all the call sites of a function, or method, or references of an attribute, and python makes that impossible compared to what I'm sure you can do in c#. Frankly, I was considering whether using mono/c# would be more appropriate, what is holding me back is clearly microsoft's 'intentions' and I don't like being a second class citizen.

It is also frustrating to have many classes of error appear only at run time, which would have been caught by a statically typed language. Edit: I've used pylint and pyflakes, and currently just use pyflakes regularly, but that's a bare minimum of checking.

So I would be very careful about choosing python on a large project. The problem is, it's just so damn good at doing quick development.


It's simple. Speed and cost.

Python/Ruby projects cost less fixed cost to develop and maintain. They cost more to run and scale.

Startups lack development and maintenance costs and generally scaling dollars are followed by revenue or additional funding to finance that cost.

--

Additionally Python/Ruby have a lot more features, frameworks, extensions that specially deal with modern startup issues.


I don't know C#, so i can't compare it with python. Some reasons why I like python:

- The REPL. I 'm so used to play around with newly installed libraries or certain features in the REPL that I'm always kind of lost when coding in a language where there is none:)

- I can do almost everything I need in one language. From simple scripts to web applications. This makes it great for rapid prototyping. I can replace parts later if there is a benefit.

- Readability of code. I really like the uncluttered visual layout and the use of English keywords instead of punctuation.

- The vast amount of solid libraries available.

- No need for an IDE. I use emacs, but I think it's great for collaboration if everybody can start right away without having to install or buy anything (at least on systems, containing python out of the box). Not really important in a business environment, but it lowers the entry threshold for people new to the language or programming.


As an experienced Python dev who recently started programming primarily in java: You should build something big in a scripting language - probably ruby or python - the different style really will make you a better developer.

I think learning java made me better ad designing classes (I never explicitly used a singleton in python before) and helped a bit in my thinking about concurrency.

For python or ruby try to follow the common idioms rather than programming in a familiar style. I'd recommend avoiding classes altogether at first, trying to get as much done with the built-in data structures and functional aspects of the languages.

For me the thing I miss most in java is the interactive interpreter. I usually develop with an ipython instance open so I can test out different ideas and explore the features of a new package quickly. I believe that is why scripting languages are favored by hackers and startups.


> I never explicitly used a singleton in python before

And that's the right way to do it. Python has global functions, Java needs singletons.


I can't see the reason either. There's a lot of hate here for "enterprisy" languages like C#, but little to back it up.

Surely, "Hello world" style programs are simpler in Python. It's probably easier to maintain and refactor C# programs due to the better tool support. The list goes on like this, with pros and cons on either side, but all in all, the differences are actually rather small: both are imperative (with some functional sauce added later), but are object-oriented, both allow you to express a large amount of logic in relatively little space (compared to e.g. Java or C++), both have a large ecosystem and both come with batteries included.

The biggest difference, really, is culture. Python has a very nice community, but unfortunately a sizeable part of this community learned Python as their first non-crap language, and thus can't imagine anything better than Python. These are the people who keep raging that non-Python programmers aren't as smart, or good, somehow, as them. It's from these people that you get the vibe that C# is somehow inferior, but you can safely ignore them.

The C# community doesn't have many such people, but in exchange it has it's own flavour of idiot: a large share of mediocre programmers who can't actually really code well, but just get by because the IDE helps them so much. These people completely depend on libraries and tools made by Microsoft and a small amount of commercial suppliers, not looking to any of the great open source stuff out there. They weren't productive doing databases until Microsoft released Entity Framework. They weren't productive doing web apps until Microsoft released ASP.NET MVC. They can't fathom sharing their work, and they think certifications are more important than great software. In the companies they work, people like this easily make manager, which makes the problem worse.

Clearly, I'm generalizing strongly with respect to both communities. I'm mostly trying to make clear that even on the community level, the difference is very small. There's awesome folks, and there's mindless morons. The kinds of awesome that exists in both communities is pretty similar, the kinds of morons are slightly different.

You'll find that, as a C# programmer, Python is very easy to learn, should you wish to do this. There's no real technical need, because C# just about equally great (I think slightly greater, but that's for religious reasons such as typing, and this thread is full of smart people who disagree). If you want to work at a shop that happens to use Python, you'll live with it. Do spend some days getting into "Pythonic" thinking. Resist putting everything into a class. Bite the bullet of lacking editor support and more concise docs than you're used to. Look past the included batteries, there's often much better alternatives outside the standard library, much more than what you're used to in .NET.


Python and Ruby are great because they have pragmatic communities which strive to produce simple and easy-to-use frameworks and libraries. This is also reflected in the languages, which are easy to read and write, and keeps things simple. Look at libs like rails, Django and pyparsing. These all acheive complex tasks in simple manners, while keeping turnaround time to an absolute minimum. Python has an awesome std library which accepts differences in platforms, countrary to the Java API which tried to find the middle ground. This makes python awesome as a scripting language and integration tool.

On the negative side, Ruby and Python threading sucks, since they both have global interpreter locks. And they lack static typing.


Don't try to evaluate the languages in isolation, because it's the libraries and ecosystems of the languages that make all the difference in your life. If you evaluate Erlang the language in isolation, you might hate it. But if you evaluate it while trying to make a server that will scale up from 1 to a hundred machines with fail over and no single point of failure, you might find yourself adoring it (in which case you should look Elixir). Python has its sweet spots of amazing things too, defined mostly by its easy to use libraries for doing everything from image processing, language processing, face recognition, and you name it.


Python is easy to get something up and running in quickly. That is, I would say, its primary benefit -- faster iterations. It also has a syntax that makes it easy to read and write Python programs, and lots of libraries.


Python may be slower than C# but it is good enough. More importantly, it has a thriving, immensely popular ecosystem and great documentation. That's largely about all there is to it.


But when I look at performance Python is not near C# or Java

For most websites out there it doesn't matter. Facebook ran on normal PHP (similar performance to Python) up until the point when they had 500 million users and were forced to make some changes.

Instagram and Pinterest are powered by Python. Unless your site is bigger than those, you'll be fine running Python.

And I can't seem the find features of C# in Python

Python has a huge ecosystem of libraries. Maybe you just don't know where to look?


My 2 cents.

1. OS portability (i.e. a large portion of the Internet world is not MS)

2. Open source community (You can talk to a developer of a library. Can you do that with C#)

3. Can write in simple editor or CLI (IDE's can be nice but a generally overly complex, and require a rich client, and possibly a license)

4. Access to example code is much easier in open source.

5. Extensibility. If you don't like something, you can easily adapt, even the most fundamental elements. You can't do that with a non open source product.


Because you have to type less code when writing Python. No braces, dynamic typing and so on. Programs are half the size or less than C# code. The less code, the less chance there is for screwups, the less time it takes to grok and the less work it is to refactor. That's why Python wins every time.


It is much easier on your eyes. Having to scroll through code bloat is just physically painful.


It's easy. Like, really really easy. That alone makes up for a lot of flaws. Also, it's easy in a way that makes it easy to mold to the problem at hand. It's my goto language when I just want to throw something together, and for a few more complicated projects as well.


And I can't seem the find features of C# in Python.

Which features of C# are you looking for in Python that you can't find?

Also, keep in mind that something that is written in good, idiomatic C# might need to use different idioms in Python in order to make sense as a Python program (and vice versa).


I'm not the original poster, but one of the things that I can see as much easier in c# than in python is process control. The power of the .net process library [0] seems to be much greater than the power of the python process library [1]. Being able to create events on process behavior, etc is rather useful, and the python tools don't seem to give anywhere near that amount of flexibility.

[0] http://msdn.microsoft.com/en-us/library/system.diagnostics.p...

[1] http://docs.python.org/2/library/os.html


That isn't really the "python process library", most of it is an agglomeration of thin wrappers around standard POSIX interfaces.

The subprocess[0] module is probably closer to what you're looking for, though it still does not operate the way you want it to. It's also possible you may be looking for something that you can get by proper use of dtrace.

More broadly, you're not looking at the C# process library there, either. You're really looking at the Windows process library. It's predicated on a different culture and different assumptions and some of its functionality may be difficult or perhaps even impossible to implement on other systems (I note the Mono implementation has several explicit NotImplemented portions).

[0] http://docs.python.org/2/library/subprocess.html


It is not just language. It is the platform behind language. You choose python/ruby your stack probably is opensource/linux stack. If you choose c# you probably is stuck with windows stack, (in which you don't have a lot options like open source stack).


> probably is stuck with windows stack

You're also stuck with licenses for everything from your development environment to your web server, database and not to mention operating system.

Compared to Python/Ruby where development cost can be $0.


You are also stuck with the costs of managing those licenses, and the risk of not being in compliance (howerever well you manage them). Both get bigger than the licensing costs when you get big.

There is also the cost hidden in "new developer? Wait a bit while I'll get another license", "what kind of replication? We don't have enough licenses", "no, you can't just create a small project (that can get huge) for solving this small problem, it can't justify the cost in licenses", and other very common situations.


Mono's also free, and works well on unixes, and I've had no problem with components for various FOSS databases. There are some differences between the ms clr and the mono clr, but then again, there are differences between jython and cpython as well.


This screencast compares python and java very well. I think it also largely applies to C# too.

https://archive.org/details/SeanKellyRecoveryfromAddiction


Check for youself, rewrite some code of yours in python ...... my guess it will be half of C# size, then try again and it will be 1/4 and then you stick to Python .... or maybe not :-)


There is a performance criteria that is fundamental to the use of interpreted languages and justifies their use based on other criteria. It's called "good enough."


Python has bindings/libraries for everything under the sun.


If you're a C# programmer and you want to stay one, then stay one. There are many startups out there that would love to have a skilled C# programmer, I'm sure.

It might depend on where you're living, I'm not sure.

Also, afaik C# is open source, check out Mono. (somebody correct me if wrong)


I'm sorry, but this is a pretty irritating type of question, something I would cheer to be closed if it were on StackOverflow.

Some of the greatest living programmers are using Python to demonstrate and build amazing things, and you have the nerve to ask people to prove to you why you should "give my time to the language?". On one hand, you're right not to just follow something just because everyone else seems to be doing it. Life is short, you can't just walk down every path that appears to be open. On the other hand, you are asking people to use up their short lives explaining to you something that would better be found on your own.

You're a developer. You already know the purpose of code and how to get started in it, in any language. You also live in the age of the Internet, where learning and trying new things in the programming world costs little more than time, thanks to the herculean efforts of open-source programmers who tirelessly make coding more comfortable for the rest of us.

The kind of question you ask is understandable from someone who has never programmed before. But to be a working programmer and to ask that kind of thing? Seriously?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: