Live data from Hacker News

Ask HN: Why use Python or similar?

news.ycombinator.com

21–30 of 72 posts

Re: Ask HN: Why use Python or similar?

#21
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.

Re: Ask HN: Why use Python or similar?

#22

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.

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.

Re: Ask HN: Why use Python or similar?

#25
post #22

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.

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?

#26
post #22

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.

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#.)

Re: Ask HN: Why use Python or similar?

#27
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.

Re: Ask HN: Why use Python or similar?

#28
post #6

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)…

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

Re: Ask HN: Why use Python or similar?

#29
post #25
post #22

Earlier 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.

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.

Re: Ask HN: Why use Python or similar?

#30

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.
Post reply on HN