Ask HN: Why use Python or similar?
21–30 of 72 posts
Re: Ask HN: Why use Python or similar?
#22using System; public class Hello { public static void Main() { Console.WriteLine("Hello, World!"); } } vs print "Hello, World!" Everything is just simpler in python and ruby.
Console.WriteLine("Hello, World!");
That's all. So I'm not even talking about the greatness of the C# IDE.
Re: Ask HN: Why use Python or similar?
#23Re: Ask HN: Why use Python or similar?
#24Re: Ask HN: Why use Python or similar?
#25using System; public class Hello { public static void Main() { Console.WriteLine("Hello, World!"); } } vs print "Hello, World!" Everything is just simpler in python and ruby.
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.
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.
Re: Ask HN: Why use Python or similar?
#26using System; public class Hello { public static void Main() { Console.WriteLine("Hello, World!"); } } vs print "Hello, World!" Everything is just simpler in python and ruby.
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.
(read: there is just a MASSIVE culture gap. It's just as unfathomable to Ruby/Python people why you'd ever use C#.)
Re: Ask HN: Why use Python or similar?
#27We 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.
Re: Ask HN: Why use Python or similar?
#28Use 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)…
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
Re: Ask HN: Why use Python or similar?
#29Earlier quoted context omitted.
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.
> 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.
Re: Ask HN: Why use Python or similar?
#30Python 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.