Experienced programmer evaluating Python

  • Thread starter Michael L. Labbe
  • Start date
M

Michael L. Labbe

Hello. I'm an experienced programmer who is evaluating learning Python if
it is applicable to a few projects. The programs I am going to list are
production software - they are not throwaway toy projects, but will
actually have real world application. I've spent years writing C++ and
Perl code, but I would like to try "this Python language" out in their
implementation, as I have the luxury of slack deadlines for the next
little while.

That said, I was hoping Python gurus could quickly tell me if these
projects would be a good fit, or if there are any pitfalls I should look
for.

1] Embedding Python into a realtime game. I'm willing to take a
performance hit over strict c++ in the range of 10%, if the implementation
can be elegant. I've embedded Perl into a cross platform application
(win32 & Linux) and I found it to be a nasty undertaking. Perl.h had
namespace conflicts with libraries, and I had crashes within the
statically linked Perl library that essentially made traces impossible. I
could go on, but it was basically an inelegant solution.

I understand I haven't given enough details to let people know if 10% is
in order, but a general opinion about scalability and bytecode execution
working in a non-threaded realtime environment in parallel with c++ code
would be appreciated.

2] IRC bot. I understand there are third party libraries available, but
they all claim to be alpha. Can anyone recommend a solid one?

I think I miss CPAN. Is this normal?

3] Redistributable end-user product development tools. I know and love
using wxWindows in C++. Basically, I need the ability to distribute
everything necessary for developers on the Internet (read: not average
users) to run wxWindows based Python apps on Win32 development
workstations. Licenses and convenience come into play. I don't mind a
large download for this crowd, but asking them to compile anything is
above and beyond.

Finally, is there any issues with me not distributing Python source if I
include a compiled DLL with commercial software? If I embed Python for
Win32, I have read that I need to dynamically link it. If I do so with no
modifications, am I free to not offer source code for download? (Yes, I
am addressing all you IANALs out there...)

Thanks for the advice. I will check back as I continue to research this
intriguing language.
 
K

KefX

1] Embedding Python into a realtime game. I'm willing to take a
performance hit over strict c++ in the range of 10%, if the implementation
can be elegant. I've embedded Perl into a cross platform application
(win32 & Linux) and I found it to be a nasty undertaking. Perl.h had
namespace conflicts with libraries, and I had crashes within the
statically linked Perl library that essentially made traces impossible. I
could go on, but it was basically an inelegant solution.

Most people believe that extending Python (Python calling C code) is much
easier and much better than embedding Python (C code calling Python code). It's
possible to embed, but it's a real pain in the butt (I know, I tried it.)
Anything too slow to run in Python can be done in C, and there's a library
called Psyco (psyco.sourceforge.net) that you'll definitely want to look at
(it's sort of a JIT compiler). Psyco's not a panacea, but it sure as heck can
help. This is the approach I'm using for my own game design, which is an RPG.
(By the way, I find XML DocBook to be a great format to write design documents
in, if you're also a designer.) Because most of the execution is in such a
small portion of the code, it shouldn't be a big deal.
3] Redistributable end-user product development tools. I know and love
using wxWindows in C++. Basically, I need the ability to distribute
everything necessary for developers on the Internet (read: not average
users) to run wxWindows based Python apps on Win32 development
workstations. Licenses and convenience come into play. I don't mind a
large download for this crowd, but asking them to compile anything is
above and beyond.

wxPython is what you want. http://wxpython.org/
Finally, is there any issues with me not distributing Python source if I
include a compiled DLL with commercial software?

I'm not sure how you'll manage to use Python code without giving the Python
source in some for. You could distribute .pyc files, but I think they could be
reasonably decompiled (not sure).

- Kef
 
R

Rainer Deyke

Michael said:
1] Embedding Python into a realtime game. I'm willing to take a
performance hit over strict c++ in the range of 10%, if the
implementation can be elegant. I've embedded Perl into a cross
platform application (win32 & Linux) and I found it to be a nasty
undertaking. Perl.h had namespace conflicts with libraries, and I
had crashes within the statically linked Perl library that
essentially made traces impossible. I could go on, but it was
basically an inelegant solution.

See boost::python.
 
D

Dave Brueck

Hello. I'm an experienced programmer who is evaluating learning Python if
it is applicable to a few projects. The programs I am going to list are
production software - they are not throwaway toy projects, but will
actually have real world application. I've spent years writing C++ and
Perl code, but I would like to try "this Python language" out in their
implementation, as I have the luxury of slack deadlines for the next
little while.

Awesome - hope you find the info below helpful.
1] Embedding Python into a realtime game. I'm willing to take a
performance hit over strict c++ in the range of 10%, if the implementation

A few commercial games out there have done this (Google Groups should turn
up a few links if someone doesn't post the specific games) so it's
definitely doable although I'm not sure of how much of a performance
overhead you'll incur - hopefully someone more knowledgeable will chime in.
At least one commercial game used the Stackless variant of Python so that
you can have literally thousands of "microthreads", each running a separate
game entity. You might also check out Pygame, although that's probably
farther down the path than you're thinking of going.
3] Redistributable end-user product development tools. I know and love
using wxWindows in C++. Basically, I need the ability to distribute
everything necessary for developers on the Internet (read: not average
users) to run wxWindows based Python apps on Win32 development
workstations. Licenses and convenience come into play. I don't mind a
large download for this crowd, but asking them to compile anything is
above and beyond.

Not a problem, especially for Win32. www.wxPython.org plus stuff like py2exe
or McMillian's Installer can give you whatever combination of half-baked or
fully-baked applications you need. On Windows you can install Python,
wxPython, and most other add-on libraries without requiring the user to have
a compiler, and licensing isn't an issue with Python or wxPython. Another
interesting twist is to use ctypes, which lets you call just about any API
in any Windows DLL, again without a compiler, and again easily
distributable.
Finally, is there any issues with me not distributing Python source if I
include a compiled DLL with commercial software? If I embed Python for
Win32, I have read that I need to dynamically link it.

No - see http://www.python.org/doc/Copyright.html which includes

"The gist of it is that Python is absolutely free, even for commercial use
(including resale). There is no GNU-like "copyleft" restriction."

Hope you have fun trying out Python,
Dave
 
T

Terry Reedy

Michael L. Labbe said:
Hello. I'm an experienced programmer who is evaluating learning Python if
it is applicable to a few projects.

Welcome to a community of generally friendly, helpful, enthusiasts --
some with a sense of humor, even if subtle.
I think I miss CPAN. Is this normal?

Yes, for people with prior Perl experience.
3] Redistributable end-user product development tools.... ....
Finally, is there any issues with me not distributing Python source if I
include a compiled DLL with commercial software?

People routinely distribute executables produced by py2exe that
combines interpreter, needed libraries, and custom source in one file.
Period.

The Python license is 'GPL compatible' but is intentionally different
from the GP and much more permissive. As I remember, there are
basically two provisos: give appropriate credit and take full
responsibility for the use you make of it. For instance, if you want
to sell software with a guarantee, then test until you are willing to
service said guarantee. Is this what you were asking about?
If I embed Python for
Win32, I have read that I need to dynamically link it.

AFAIK, this is a technical rather than legal issue.
If I do so with no modifications, am I free to not offer
source code for download?

Which source? CPython's or yours? ;-)

Terry J. Reedy
 
M

Michael L. Labbe

Welcome to a community of generally friendly, helpful, enthusiasts --
some with a sense of humor, even if subtle.

Thanks - all of the responses have been very helpful so far.
People routinely distribute executables produced by py2exe that combines
interpreter, needed libraries, and custom source in one file. Period.

The Python license is 'GPL compatible' but is intentionally different
from the GP and much more permissive. As I remember, there are
basically two provisos: give appropriate credit and take full
responsibility for the use you make of it. For instance, if you want to
sell software with a guarantee, then test until you are willing to
service said guarantee. Is this what you were asking about?


AFAIK, this is a technical rather than legal issue.


Which source? CPython's or yours? ;-)

I'm fine with accountability for my company's software. However, I cannot
rule out the possibility of closing the source code of the software I
produce, and not distributing any of the Python core code.

My situation is that a third party, perhaps a publisher, will be
interested in building a distribution of the software for end users. It
would seriously weaken my ability to reach a reasonable agreement if I
insisted upon any source code whatsoever being included. Publishers can
be like that.

So, to answer your question, can I amicably not distribute my source code or
Python's alongside the binary distribution? :)
 
P

Peter Hansen

Michael L. Labbe said:
So, to answer your question, can I amicably not distribute my source code or
Python's alongside the binary distribution? :)

Have you actually tried to read the license? If so, and you haven't
got an answer to the above question, perhaps you would be so good as
to post the relevant sections and try to explain what it is you don't
understand about them. That way at least someone could consider
improving the license (or maybe making some notes to go with it) for
a later time.

The last time I read the license, it was quite clear on the areas
touching on your question, so I'm surprised it wasn't equally clear
for you.

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top