473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python's Suitability?

I have some questions about the suitability of Python for some
applications I've developed in C/C++. These are 32 bit Console
applications, but they make extensive use of STL structures and
functions (Lists, Maps, Vectors, arrays) - primarily because the data
volume is high (2,500,000+ records).
The main thing I'd like to do is port one part of the system that has
a series of user menus and works with several text data files (one
_very_ large). I'm not using any database system, just my home-grown
indexed sequential file database. There's nothing but volume that
precludes this application from running from almost any text file-
processing language system (e.g. Perl, BASIC, etc.).
From what little I've seen of Python, it appears I could port this
application to Python code, but I'd do so only if I could:
1. Integrate it into a Web application in such a way that the user
could select it as an option from a main page and have it execute as a
WEB GUI application. Currently, the application's interface is only a
crude DOS window.
2. Assure that the performance isn't totally crippled by using Python,
an interpretted language. While I don't expect native C/C++
performance, I don't want to be embarrassed...
3. Make sure that the volume of stored data (2.5+ million records) can
be accommodated in Python structures (I don't know enough about Python
to answer this question...).
Note that I'm not considering using the existing C/C++ code in my Web
application, because I don't know how to write a C/C++ Windows
application - and I'm sure the learning curve here is greater than
Python's. I'm a very old procedural-based application developer (47+
years of programming experience), and developing Windows applications is
beyond me.
So, I only (?) want to take an existing application that uses a large
text file (and several smaller text indexing files) and put it into a
Web system I already have. I feel Python (or Perl) is(are) my best
option(s), and here I'm only looking for some initial guidance from the
Python users. TIA
Aug 28 '07 #1
2 1986
On 28 Aug., 02:28, mrc2...@cox.net (Michael R. Copeland) wrote:
Note that I'm not considering using the existing C/C++ code in my Web
application, because I don't know how to write a C/C++ Windows
application - and I'm sure the learning curve here is greater than
Python's. I'm a very old procedural-based application developer (47+
years of programming experience), and developing Windows applications is
beyond me.
As I see it you might separate the console frontend from your database/
model backend and reuse your database code. The next step would be
selecting a webframework that allows you to plugin your own database
driver which has to be wrapped into a Python module. For wrapping into
a Python module there are several alternatives. SWIG and BOOST.Python
are most natural solutions for wrapping C++ code and exposing its
functionality to Python. Other options are writing a C interface to
your database and use ctypes, Pythons stdlib FFI ( see Python 2.5
docs ). Not sure if there are tools yet to derive a C interface
automatically from C++ classes. If so I would prefer the FFI approach.
For database plugins: a framework like Pylons [1] seems to be
particularly suited for this option but I would recommend requesting
answers by the Pylons community directly.

[1] http://pylonshq.com/
Aug 28 '07 #2
Michael R. Copeland <mr*****@cox.netwrote:
I have some questions about the suitability of Python for some
applications I've developed in C/C++. These are 32 bit Console
applications, but they make extensive use of STL structures and
functions (Lists, Maps, Vectors, arrays) - primarily because the data
volume is high (2,500,000+ records).
This is all bread and butter stuff to python and 10 times easier to do
in python than C++!
The main thing I'd like to do is port one part of the system that has
a series of user menus and works with several text data files (one
_very_ large). I'm not using any database system, just my home-grown
indexed sequential file database. There's nothing but volume that
precludes this application from running from almost any text file-
processing language system (e.g. Perl, BASIC, etc.).
From what little I've seen of Python, it appears I could port this
application to Python code, but I'd do so only if I could:
1. Integrate it into a Web application in such a way that the user
could select it as an option from a main page and have it execute as a
WEB GUI application. Currently, the application's interface is only a
crude DOS window.
A web application is possible. You can start your application which
would run its own embedded web server which the user could then
control. Python has a web server in the standard library. I've done
exactly this using cherrypy as a simple web application framework.

The asynchronous nature of web applications are often a pain. You
could write a windows GUI using TKinter (which comes with python) or
WxPython (which doesn't). Those toolkits make it very easy to make
GUI applications.
2. Assure that the performance isn't totally crippled by using Python,
an interpretted language. While I don't expect native C/C++
performance, I don't want to be embarrassed...
Depends exactly what you are doing. If you are IO limited then Python
is just as fast as C++.

If you are doing lots of calculation on the data then python can be
slow. You can use the numpy library which is a library of scientific
maths routines all coded in C for speed which is very quick.

http://numpy.scipy.org
http://sourceforge.net/projects/numpy
3. Make sure that the volume of stored data (2.5+ million records) can
be accommodated in Python structures (I don't know enough about Python
to answer this question...).
I wouldn't have thought that would be a problem.
Note that I'm not considering using the existing C/C++ code in my Web
application, because I don't know how to write a C/C++ Windows
application - and I'm sure the learning curve here is greater than
Python's.
You could always use ctypes from python to interface with your C
code. If you can export your code in a DLL then ctypes can use it.
(Not sure about C++ though)
I'm a very old procedural-based application developer (47+
years of programming experience), and developing Windows applications is
beyond me.
So, I only (?) want to take an existing application that uses a large
text file (and several smaller text indexing files) and put it into a
Web system I already have. I feel Python (or Perl) is(are) my best
option(s), and here I'm only looking for some initial guidance from the
Python users. TIA
Go for it! Python is such an easy language to write stuff in
(escpecially compared to C++) that you'll have the prototype done very
quickly and you can evaluate the rest of your concerns with working
code!

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Aug 28 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

226
by: Stephen C. Waterbury | last post by:
This seems like it ought to work, according to the description of reduce(), but it doesn't. Is this a bug, or am I missing something? Python 2.3.2 (#1, Oct 20 2003, 01:04:35) on linux2 Type...
36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # some venture into standard modules import os # print all names exported by the module print dir(os)
68
by: Lad | last post by:
Is anyone capable of providing Python advantages over PHP if there are any? Cheers, L.
20
by: xeys_00 | last post by:
I posted a article earlier pertaining programming for my boss. Now I am gonna ask a question about programming for myself. I just finished my first C++ Class. Next semester is a class on...
5
by: EP | last post by:
This inquiry may either turn out to be about the suitability of the SHA-1 (160 bit digest) for file identification, the sha function in Python ... or about some error in my script. Any insight...
122
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
2
by: Paul Boddie | last post by:
QOTW: "c.l.python is just a small speck at the outer parts of the python universe. most python programmers don't even read this newsgroup, except, perhaps, when they stumble upon it via a search...
17
by: chewie54 | last post by:
Hello, As an electronics engineer I use some very expensive EDA CAD tool programs that are scriptable using Tcl. I was wondering why these companies have choose to use Tcl instead of Python. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.