I would add the REPL to the list of things that increase a Python programmer's productivity. The interpreter improves my productivity very significantly.
On the C# side, maybe I would add the IDE into the equation somewhere. There are good Python IDEs, but none as good as Visual Studio. I don't like IDEs (VIMmer myself), but in a team environment they may be important.
I was going to mention that you overlooked the big issue of 3rd party tools and libraries. But then I saw that you're going to discuss that in your next installment.
IMO, this is an extremely important aspect of this decision. One of the reasons I like Java so much is its abundance of 3rd party tools and libraries. You name it: web frameworks, pie graph generators, XML/XSL parsers and processors - and, most importantly, advanced IDE's with automated refactoring capabilities - Java's got it. And usually several to choose from! (At this point, I'm loathe to choose to work in a language that doesn't have a refactoring IDE - or a plugin for Eclipse.)
From what (little) I know of Python, it's in good shape in this regard too. As far as C#, I don't know that development scene enough to answer.
But this issue definitely keeps me from doing development in less mature languages like PHP and such.
And during a recent discussion with another developer friend of mine who was raving to me about caml/ocaml, he had to concede that it was a weak language if you did much GUI development.
Just FYI, I think Google uses Python quite a bit.
I'd like to stress how much I agree with Bill on pointing out that the REPL is a huge time saver while programming ... especially when you're working on something "very new."
The ability to interact with your code live is a huge bonus to me ... I'm currently working on a rather large (and complicated -- to me) project in Java, and which I had this tool available .. there are some OSS programs that try to replicate this in Java, but none really come close.
Woops .. I can't believe I wrote "... and which I had this tool available ...".
"which" is meant to be "wish" .. yeesh ... I thought I had drank enough coffee by now ...
re: Building binaries. py2exe and nsis make it trivial to build a non-source distributable which feels native to windows users. Doing this leaves open your ability to give source to a linux or mac user if you want to test the cross platform waters.
RE: Performance, I tend to find myself on data and computationally intensive projects. Performance is usually very important for me. Saying that Windows is a slower environment has some, but little, validity. To add perspective, if you look at the Java versus Python debate, both languages are platform independent, but Java can be made to run as fast as C.
(As an aside, I wonder how fast C# is on mono. My company is using mono in some places, with limited success, but we have not had to worry about speed there yet.)
RE: 3rd party tools, both sides have many. .NET’s offerings tend to be proprietary instead of open source, just like the platform itself. There are open source .NET projects, but they tend to be copy cats from other open source projects originally build in another language (usually Java, e.g. Lucene.NET, NAnt, NUnit, SharpHSQL, and so on).
A startup I recently worked for used python, Java, and C++. This multi-language approach seems like a good choice if your startup has many pieces that interop asynchronously. Even in this situation I would use the same language for the first six to twelve months, for a few reasons. This company recently had a successful acquisition.
One more thing: popularity is also important on the language family level.
C# is more popular than python, but Java is also more popular than LISP or any other weakly typed language. The latter fact has an impact on the C# versus python debate, for two reasons:
1) Code can be reliably ported from Java to C# with little more than regex-like rules. (C# supersets Java.)
2) There are more .NET big companies out there than python companies, but there are also many Java companies. Such companies would prefer a .NET acquisition than a python acquisition.
re: binaries: I managed a team in a large software company that routinely delivered very large mixed Python/C++ binaries. We use a "roll our own" approach to packaging Python but it essentially involved bundling up all of the compiled .pyc files into zipped tarballs (.pyz extension) and then having a simple shell script unzip these and run the application. I believe it took one of our developers a couple days to implements and it worked impeccably for many years. We were shipping Python "binaries" long before any of the current packaging tools.
"there are also many Java companies. Such companies would prefer a .NET acquisition than a python acquisition"
jython.org has been a bit too quiet for a while, but provides an excellent integration of python and java. See my comments on it here http://cariaso.livejournal.com/29055.html
beyond that, python has now been implemented in several languages, the original C (Cpython), Java (jython), Python (PyPy), and .net (IronPython). Having so many independent implementations help to flush out spec ambiguities, and helps ensure someone else has already resolved many interlanguage issues.
I have to disagree with your logic on the first point. I tend to believe that although being open source appears to be a strength at first, Imany times it can be more of a liability. Open source communities tend to be more fickle and will jump ship more often. I've seen this with several products that I came to rely on in the past 5 years. Although they tend to still be alive and well, the amount of effort put into developing and furthering them has dwindled to nothing. This does me no good since I don't have time to support these products myself.
Also, don't forget that closed source languages like C# and Java have HUGE communities outside of the companies that create and maintain the language. This is often overlooked as everyone assumes that open source (oftentimes being solely a community effort) must have better communities than closed source alternatives. This just isn't the case.
Anyway, a very nice set of articles. It is a hard decision to make as both languages/platforms stack up nicely against each other. I personally prefer static languages and choose to use C#. I also use Java for my "day job" and have found that even though we claim to be cross platform capable, not a single customer runs our system on anything other than Windows. So when you finally get to the cross platform debate, be sure to include similar statistics along with the costs of supporting more than one platform.
Keep up the good work.
When I was researching programming languages I came across the fact that Google used a huge amount of Python in its apps (including crawler). A quick search brings me to a few URLs. The first one is from Greg Stein from Google:
In it it says "We consider Python to be our 'secret sauce'" which I think is quite important.
Regarding protection of your code, this is something that is very important to some people. One of my companies is SourceGuardian and we protect PHP code with our software (Others like Zend and Ioncube offer the same thing). When I investigated Python I found that it also has the ability to create exe's and one of my team tested it and said that it works well. We also added in a level of obfuscation using our own systems just to make sure!
I have never personally used C#, so its difficult for me to comment on it, either positively or negatively, but I can say that I continue to be amazed by how great Python is
oh, and just looked on the Google jobs site. This is the kind of thing they seek:
"Experience in scripting in a major scripting language such as Perl or Python. Python is desirable."
So, whilst not a startup now, Google shows what Python is being used for
A quick Google for Python success stories also brought up a load of sites
Developers with a Java background should be more productive faster in C# than in Python since the syntax is almost identical. They would need to focus on how the Java libraries are implemented in .net
And for what it's worth.... I don't think the fact that Google uses Python makes any difference. I'm certainly not Google and either are you. And I wouldn't be surprised to learn that Google specifically didn't use .NET or Java because they consider the "owners" of those two languages to be competitors.
But to me the comment "no one cares about Python anymore... Ruby is the new hotness" sums up the attitudes of many open source programers. They are quick to move to whatever is today's hottest buzzword. Big companies like Sun and Microsoft don't work that way. So although you run the risk of the owning company pulling the plug down the road for closed source languages, the threat of your open source language de jour being abandoned by the open source community seems much more likely. Especially since I've seen this myself several times.
For a non tech person all the comments on this thread are exceptionally informative. Many thanks to all the contributors.
Something else to consider is the level of committment that Microsoft itself is making to Python. Till about 2 years ago, most all knowledge base articles were prefaced with either being C++ or VB centric. Now I see a great deal of Python based glue logic showing up in their articles. Technical articles from MS on WMI is about 50/50 C++/Python and less VB.
Not only that but the .Net environment is now heavily influenced by the IronPython team. It just might be that Python maybe become the preferred choice for that development framework.
One last point. Of the teams that have some stature in using Python it really is a mixed bag. In most cases these teams are using lower level C++ and MFC classes for grunt work stuff and overalying those functions with the Python code for the higher level logic and presentation.
Mr. Bravado, Shamus,
Yes Ruby (especially w/Rails) seems to be the lastest thing since sliced bread for the programming staff. I've delved into to it myself to see what the hoopla was about. What I find it has a good deal of merit.
However I also find a few warts. The expressiveness is too much like Perl 5 in some ways. Only the number of ways of doing X is cut down unlike Perl. In the case of Rails, I find too much in the way of 'and magic occurs right here' in the underlying code. Being the fuddy duddy I am, I still prefer explictness. (Though truth be laid bare, decorators in Python have the same problem).
All that being said, one item that has not been touched on is the accessories that come with a language or not. In my early youth on PDP8's if you wanted a math library for C; you either waded thru Knuth's 'Algorithms' rolling your own, wrote a C wrapper to the Fortran code or bought a third party library. The point is does whatever language you use have the libraries you need?
C#, acceptable though web toolkits looks to be mostly 3rd party. Java, well it has grown up with an eye to network usage so out of the box it does well on the web especially client side web. Ruby, great for web work. But if I were developing a SNMP backend I don't think I would pick it. PHP surprisingly has a wealth of 3rd party scripts and can do system level work though not well. Python can do all of these fuctions. Web, SNMP, Templates, HTTP servers, URL screen scraping. All of it. Some better than others.
Once you have the language down, speed is the next concern. Can the prototype be developed fast enough to make that next meeting with your 'Angel' investors? In some cases that might leave the compiled languages at a disadvantage. IP protection? Forget PHP then. In my view then you are left with Java, Python or Ruby. Or possibly a mix of any two.
You might want to also look at a language called Boo. It is Python inspired and runs on top of the .NET framework. I am not sure how it compares to IronPython, but it does seem to have some interesting features which I am not sure are available in CPython or IronPython.
I think the litmus test has two parts:
1. Can you build it?
Shiny new language X might be cool/interpreted/dynamic, but a track record of delivering on passe/compiled/static old language Y shouldn't be underestimated. Ideas are cheap. If you are a startup, you need to turn your ideas into code that works. Until you cross that barrier, there is no product. Turning the concept into working code is a process that you should make as easy for yourself as possible. Choose the Y that you know (and are successful with) over the X that you don't, even if it isn't as sexy. Finding programmers, acquiring companies, etc. is a secondary problem. You need to build the software first, even if it is on a more boring platform. There will never be a shortage of people to take a good idea from a relatively crusty platform to the Next Great Thing.
2. Can the customer run it?
Platforms like .NET and J2EE have an (arguably undeserved) advantage over Python and Perl due to the inertia of corporate IT environments. My experience is that the web-is-the-platform (hence who cares what language we use?) architecture collapses as soon as a paying customer appears who wants to bring the software in-house.
a question for John McGinnis. John, why did you say "IP protection? Forget PHP then." ? Just curious - I agreed with the majority of your post, but would just like some clarification on this point.
This is a personal prejudice on my part. PHP itself has little in the way of protecting the source if you needed to distribute the code. The byte compilers I have seen available I just have not felt comfortable with. Comfortable in the sense of the end result not being robust. I ran across invocation errors and code fragments that just did not sit well in a 'compiled' state even though the base PHP code was rock solid.
That was 6-8 months ago. And again that is a personal perception.
Thanks John. Was just curious. Feel free to contact me at sourceguardian if you want to play with our latest version - I'd be curious to see if you experience the same problems. Our research into Python is that the code protection solutions out there are good enough for distribution of code too
C# is ECMA 334 & ISO/IEC 23271 standard and CIL is ECMA 335 - ISO/IEC 23272 standard. Mono is one implementation of these standards as is dotGNU. So C# isn't as proprietary as would at first appear. The biggest productivity impact is the libraries and the time it takes to come up to speed in using those libraries. And then there is IronPython which is an implementation of Python for CIL enviornments and it runs with both MS .Net as well as Mono. (Don't know about dotGNU).
BTW: love the series of articles. I too am struggling with similar philosophical and technical issues.
>f you’re reading this and know of a startup that has used Python successfully
reddit comes to mind. It's not successful yet in the sense of making the founders rich, but it's already profitable.
My POV is that language usually selected _after_ platform has been selected and its a no-brainer then: use C# on Windows and Python elsewhere. See my post here
Oops, the URL is http://maxischenko.in.ua/blog/entries/93/python-vs-c-follow-your-platform/
I'm part of a trading desk that develops automated trading strategies. We went through a start-up phase building the desk from zero P&L to a good degree of prosperity today (3 years in, with 110% YoY growth). In that time we faced (and still do) pressures that are probably familiar to a start-up: turning ideas into shipping product (profitable trading strategies), making investors (senior management) happy, and adjusting rapidly to shifting customer demands (an unpredictable market). Let me give you my take on this debate.
Our business is an idea business: we get a trading idea, implement it in code, test it historically, and if it works, let it loose to trade on the market. We continuously follow its trading results to adjust and refine it.
Speeding the idea-implement-test-results loop is crucial. We must minimize the amount of time it takes to a) translate ideas into working code, b) discern if those ideas match reality, c) make corrections, and d) try again. Rapid feedback permits constant small adjustments of orientation and quickly surfaces incorrect assumptions.
For the first two years we used Java as our research and development language. It worked. No one looked at us funny. 3rd party libraries abound. Eclipse rocks. Safe choice. Etc.
However, we discovered that there is a limit to how quickly we could implement an idea in Java. There's a certain amount of boilerplate required to code up a new idea. Certainly, we developed libraries and APIs to reduce this time, but we could not eliminate it. Let's call this boilerplate "language imposed time." Java, and its cousin C#, has a moderate amount of language imposed time. C++ and C have higher amounts still.
Since the inception of the desk, we had been using Python for data manipulation and general "duct tape" work and had liked it a lot, but never considered it suited for "real work." What changed was a new hire that, with little prior programming experience, sat down and created a brand new strategy from scratch in half the time it normally took us in Java.
Wow. If a newbie could be 2x more productive with Python than us experienced guys, what could we do? A lot it turns out: research ideas code up in a quarter of the time it took before. We've gained so much time back that we're able to explore alternative ideas previously out of reach.
It's not just programmer productivity I'm talking about. The implications of the time gain are what are most important. You become more agile and adjust to conditions more quickly. You can explore multiple avenues of opportunity because the costs are so much lower. For us, Python has low language imposed time and permits more ideas to be explored in less time speeding our innovation loop. Big win for us.
Any language, platform, etc, represents a set of compromises so it's a matter of knowing what you're giving up in exchange for the benefits you're receiving. In our business, rapid development of working and profitable trading strategies dominates most other concerns. This heavily favors the productivity a dynamic language like Python provides. If I were writing medical imaging software, correctness and safety would be more important and guide my language choice towards the Java's and C#'s of this world.
I would be very interested to know what the original poster believes is most important to him and the start-ups he advises. What is he willing to trade off and why?
I find this kind of discussion of this language vs. that language utterly ridiculous. What difference does it make in the end? Is a house built better because the contractor used Delta power tools rather than Makita? Do you see how pointless this argument of python vs c# is?
I find this kind of discussion of this language vs. that language utterly ridiculous. What difference does it make in the end? Is a house built better because the contractor used Delta power tools rather than Makita? Do you see how pointless this argument of python vs c# is?
I totally disagree. If you sit down for drinks with a contractor (and I have) they love talking shop about their tools. Anyone involved in a professional enterprise uses tools and evaluating them and comparing and contrasting is a key part of the process (I'd argue a *fun* part of it, but some might not see it that way).
C++, C#, Python, Ruby, Java, et al are all tools and the comments all go toward presenting compelling arguments supporting (or dismissing) one or another. The choice of language and the level of abstraction it offers makes a *huge* difference in productivity and the amount of work you have to do to get to where you want to get and you have to revisit the decision for each and every project to take make sure you're using the best tool for the job.
It's a critical part of starting a project, product, or company since you have to live with it for years to come.
It is also worthy of note in terms of python success stories is Bit Torrent was developed (quickly) with python. A lot of the smaller client still use it. That does point out the lack of robust GUI support for python.
If you want many of the nice, wrist-friendly features of Python in addition to a lot of the resources and libraries that .net provides, then I'd recommend Boo. It's a great new language that includes many of the things that make Python easier on the wrists (type inference, duck typing) combined with many of the strengths of C# (static typing). I highly recommend checking it out. Even though it is a relatively new language, development is continuing on it.
I must disagree with you as you analogy is flawed. Comparing the language to the tools is not quite accurate. The language is more aptly compared to the building materials used instead of the tools. The tools would include things like the IDE. With this corrected analogy hopefully you can see choice of building material is very important. Using 2x4's vs 2x6's will have a big impact on insulation properties (thicker wall cavities) and cost. Is this important? Absolutely.
Unfortunately, too many scripting language fans make the same flawed analogy in order to justify the use of their pet language instead of a higher performance language like C++.
I'm sorry but slower is slower and speed is important.
I am developing a ashnah php interpreter with built in xml, database, regular expression support.
ashnah server has all like xampp package but altogther it is one megabyte size and all in one server.
you are welcome to my sitewww.ashnah.com
and make comments.
Obfuscators for Python code are now available. For example, there is one at http://pawsense.com/python..obfuscator/
which you don't even have to install to use for free.
After you obfuscate your Python code you can build it into an .EXE, as prior commentors mentioned. If you don't want to distribute it as an .EXE, you can distribute it as (a) byte-compiled .PYC file(s) which only require a compatible Python interpreter (which again is free, and not difficult to distribute.)
The obfuscation options for Python are growing.
Pick both! Don't you know there's Ironpython out there?
This is python fpor the .NET framework.
Yoiu can use python wherever you want and, if you need better performance in some small compute-intensive parts, just write them in c# (or VB whatever .NET language for thet matter).
Soon you'll be able to write (Iron)python with Visual Studio, with forms designer included, so there's really no reason to choose one or the other.
Using both in the same project is extremely easy.
One of the great things about I like about python is being able to test code with the interpreter interactively, but recently i found theres a C# Interpreter project called CSI at
that I've just noticed while browsing the net, anyways IMHO I think it would be nice if C# could implement an interpreter officially that would help testing out code faster.
For successful startups being acquired, you can't get a better example than YouTube, and YouTube is almost entirely written in Python:
<p> This is a very informative article. I appreciate all the insights provided by this forum. To respond to the request for information on companies using Python, I found <a href = "http://www.eweek.com/article2/0,1895,2100639,00.asp"> this article from eWeek that could be the interest of some of you. </p> <p> As another example of successful implementation of enterprise level application using Python, ITA, a Cambridge, Mass., provider of airline IT software and services, has adopted Python to build key components of its airline reservation system that is used by companies like Air Canada, Alaska Airlines, Alitalia, Continental Airlines, US Airways, Star Alliance, Galileo International, Kayak, Orbitz and others. ITA has about 200,000 lines of Python code in use in its production software. According Dan Kelley, Director of Application Integration, "(Python) it's definitely an enterprise-caliber language in terms of stability, scalability [and] the ability to have a large number of people work together on a project." Kelley also said [Python is] definitely viewed internally here by some of the best computer scientists in the world, people from MIT's AI [artificial intelligence] and CS [computer science] labs, as enterprise worthy,". </P> <p> P.S. Not only doesGoogle use Python heavily along with C++ and Java, it also hires the creator of Python as full time employee spending 50% his time on Python. This shows the commitment of Google to Python. </p>
1. Open Source Is Good
--In addition, ever tried to get a bugfix on a closed source library where you're not paying oodles per year? I thought so. It's well nigh impossible. Batteries included mean every library under the sun is included in python or freely available, and usually actively maintained (something a lot of the available C++ libraries are missing).
2. Dynamic vs. Static Languages
--Dynamism is a very powerful tool. Additions such as pychecker give you all the advantages of the statically typed language, with few of the failings. It also makes your programs shorter. And as studies everywhere show, total lines of code is *highly* correlated with number of errors in the program, across languages. The more terse and powerful language will have less errors for the same functionality.
3. The Cost Of Compiling
- The compile step really hurts flow when you start getting build steps in there that are minutes long. Python *IS* compiled. Its the .pyc files. You just don't have to specifically call the compiler. running python is like pushing F5 in Visual Studio. It compiles, then runs if it successfully compiles. Adding in pychecker gives you almost all the static type checking that languages such as C/C++ get, and you get none of the casting errors of those languages.
4. Building Binaries
--Ship .pyc files. Build monolithic EXE's using something like cx_freeze or py2exe. Use one of the various obfuscators before compiling. You'll be just as secure as the C# code. You don't have to ship a single .py file. Email me if you need help understanding this approach
--Performance wise, I'd say python is actually a beast compared to C#. Here is a test of that: I want you to try to connect up some custom unmanaged C/C++ code to a C# program. Now connect up the same code (either writing the glue code yourself, or SWIG). Which was faster? Oh yeah, the python process was. Which runs faster?, they're about the same. Python's great profiling capabilities allow you to quickly and easily add a C/C++ module in and call into it. You just take that one part of your program that's slow, and ba da bing, your entire app is fast. (I'm actually a C/C++ programmer originally....python is just such a better object system, it ends up being the high level code whenever I'm writing apps these days, with specific parts that are slow redone in C/C++ if needed).
6. Does Mainstream = Mediocrity?
-- People who are highly proficient at technical tasks continually refine themselves with activities designed to sharpen the saw. The more training activities they do makes them better. That's why you buy the python programmer over the C# programmer: He's much much more likely to train himself on new things (for free), as they are so much more available and easy to use in outside projects. There are *plenty* of C# outside projects there, but it currently doesn't have near the percentage adoption as python does in sheer numbers of outside projects (remember, python is used for system maintenance as well as application development).
The biggest issue here for me is that *you get too many applicants for a C# listing*. The search cost alone through those applicants is astounding. There probably are some good people in there, but the 100 resumes you get from a python listing are a lot easier to reasonably evaluate than the 1000 resumes you get from a C# search.
7. Programmer Productivity
--Libraries are the only code-reuse system shown to work over any length of time. Python is the *bees knees* at library development. It has a self documenting format that is 1/5th as much typing as the javadoc style stuff C# requires (or javadoc itself), therefore much more likely to be used. The REPL allows you to interrogate the classes and functions directly, leaving you no need to actually have the documentation separate from the code at all.
Having worked on both large scale .Net/VC6/Python and C/C++ Unix programs, the large scale python programs are the most maintainable by far. One of the reasons why is that there is *no explicit typing* to cause type mismatch. Adapting between types (or design meetings to deal with that) is a huge source of issues with languages such as C#. You only have to satisfy polymorphism interface requirements, (which you can validate with pychecker) with python, which means you have very flexible api's which are hard to screw up. Again, the REPL is essential here as well, as it allows you to play with other people's code to see if changes are going to break things, compared to C#, where you're going to spend awhile just getting things to compile after a merge before you can even begin to understand if you broke things.
Unit test are easier to write in python (it's the dynamism again), but C# has some nice suites as well.
8. Popularity and Precedence
-- Those languages were simply mature earlier than python. For instance, python web frame works only completely matured in the last 12-18 months. Beforehand everything was ghettoized. Some of them were quite functional (Zope, Django, Turbogears), but are only now working together. Rails is *still* ghettoized.
In addition, several companies *have* used python a lot/exclusively: eShop, Collabnet, Google (they have SWIG bindings on many if not all of their C++ projects), RackSpace, Siena, ILM (aka Industrial Light and Magic, the people who did special effects for Star Wars...) and more.
9. Valuation Impact
C# *sharply* penalizes you for companies that work on unix based servers. Mono doesn't really work that well, as its hard to install on some platforms, and not everything is supported. So you're screwing yourself over as C# isn't cross platform. While there are certainly libraries of python that aren't cross platform, the VAST majority of it is.
Secondly, python can be embedded in many many languages, and also can run *in* the JVM (Jython). It is by far more interoperable. Once/if IronPython becomes more of a real .Net language, python will even be as integrated as C# there.
A couple of start-ups that have used Python: