Please forgive the ignorance I am about to show on this subject.
On another website I spend time on this programming language gets mentioned an awful lot, and seems to be the first one people recommend to others looking for a good programming language to learn. I myself wanted to dip my toes back into the world of ‘offline’ programming (Creating real executable apps rather than interactive internet apps) so I took the recommendation on board and downloaded Python.
I was immediately put off by the apparent fact (I could be wrong about this) that anyone who wants to run your program needs to have Python installed on their computer. As someone who has created executables using Borland’s Builder (C++) this fact seemed very backwards to me.
It also seems to be geared towards absolute beginners so I may have made a mistake in thinking it’s for me.
On a seperate but related note: What I’m looking for is to create offline apps that are as easy to write database access into as it is for my PHP apps. I tried creating database apps with Borland C++ once but I just found it confusing as hell. (I think my skills have moved on since though, so I might give it another try)
They don’t.py2exe is a good compiler module for standalone apps. There are others (squeeze and freeze come to mind).
I wouldn’t say so. The extensive, nay, exhaustive, libraries may make it seem like a lot of the work’s been done for you, but it’s not that simple. I’ve had to rethink a bit of what I used to do fairly easily in Perl, Java and PHP.
Python is a fantastic language for both prototyping and developing modular or distributed projects that may be used on multiple platforms. The flexibility of the language–allowing imperative, procedural, functional, and object oriented paradigms–allows use on many different scales, and the shear number of libraries and packages allows rapid development of many technical packages without having to reinvent the wheel in writing numerical analysis or data handling routines, which is the bane of languages like C or Fortran (although the availability of free packages for those languages has expanded in recent years for those who don’t have access to IMSL libraries). The amount of data analysis and visualization tools available that can be used with Python makes it a valid and readily portable alternative to Matlab and Mathematica. Python is a standard package in every major desktop and server operating system except Microsoft Windows, and is freely available for download and install for that OS.
That being said, I don’t think Python is particularly well suited to the needs of the o.p., who if I understand properly is just looking for a tool to perform function calls and data handling, for which PHP or Perl is better suited. Python is really built from the ground up as a fast prototyping and algorithm implementation code in a rigorous and readable fashion via enforced whitespace formatting, not as a specific text and data manipulation tool.
You favour a different one, then recommend the darn thing. I said py2exe because it’s what I know, and it needs no separate C compiler.
But I agree with you that Python probably isn’t best for the OP, and should have said something. For what he wants, I’d say PHP is better than Perl, nowadays. And that can be compiled down to standalone too, although I’ve not played around with it.
Python programs charge a lot more. When I’ve help people start up websites, I recommend PHP (or even Perl) simply because Python programmers are more expensive.
I wonder if that makes any difference to those who like it and recommend it
Aside from the broken functionality that seems to result from all Python “compilers” and the inherent inefficiencies (as the code isn’t actually compiled to machine code directly but instead integrates a Python Virtual Machine into the object code), it goes against the grain to compile Python code, which is optimized to function as interpreted code. There is no reason to compile Python into an executable (save for Microsoft’s insistence of not providing a Python interpreter with their OS, which as noted is unique among operating systems) and my own personal benchmarking shows that not only is compiled code slower than using a Python interpreter on Windows, it is actually slower than running interpreted Python scripts within a *nix emulator. In other words, the only advantage is that you don’t need to install Python on your Winders machine, something that takes about ten minutes at most.
If you want a properly compiled executable, you should convert the code to C, C++, Objective-C, Fortran, or whatever compilable language you are most familiar with, and compile it into true machine code. Compiling Python code into a platform-dependent executable is like taking a ground mock-up of an aircraft, attaching engines to it, and trying to make it fly at Mach 3. Python is, first and foremost, a toolbox language intended to produce prototype code quickly, yet readable and readily traced or modified for future extension. Compiling Python is nearly as unpalatable as developing major software projects in Delphi.
Whether it’s the best language for YOUR purposes I can’t say.
However, it’s a very good language for us, and by us I mean a major software company. Sure, we use C++ too. But for certain tasks Python is perfect. It’s much easier to program in than C++ (IMO). So we can build new software prototypes very quickly.
We do not use it as a “beginners” language, but as a real language for most of our in-house software. We have thousands of lines of Python code for all sorts of projects. One project in particular that I can think of – a prototype of a new platform for our main product – has about 20,000 lines of Python code. If we had to write it in C++ it would be maybe twice as long both in number of lines and in the time it took to write.
It’s quite recent that I found out that PHP could be used to make standalone apps, but nothing I googled was able to make it clear how to do this.
How, for instance, would I go about creating a basic ‘hello world’ app with an ok button that closes the app. Does such an app need the PHP runtime to work, or could it be made to be standalone?
And is there a specific name for it that might help me google (Up to now I’ve googled things like “standalone PHP” “offline php” “php application”)
A PHP interpreter is part of every standard full-featured HTTP server like Apache (although PHP support may be disabled depending on administration procedures). PHP is primarily an imperative, primarily event driven language. A PH “Hello World” script would be a method bound to an object (like a button) that is defined by a GUI toolkit like GTK+, such that when a user loads the web page and pushes the button, it executes the method that outputs the “Hello World” message to a pop-up window or text box.
Python is the most popular data handling language among statisticians, econometricians and computer scientists specializing in natural language processing. I have no idea what you’re basing your claims on.