newbie: Python vs VB

dsavitsk dsavitsk at e-coli.net
Thu Jan 17 23:58:01 EST 2002


"Rob" <robpy2002 at yahoo.com> wrote in message
news:fab5b961.0201171843.175cb654 at posting.google.com...
> Hello,
>
> I am currently using VB to create COM components.  I have become very
> interested in using Python and have a few questions I'm hoping someone
> can answer...
>
> 1. What are some of the benefits to using Python over VB for creating
> COM components?

these are probably the same benefits of generally using python over vb.
they also include the ability to have one com component as an interface
which can work with the python libs directly. i find this very useful.

> 2. Can I create Com components in Python which support object pooling?
> (cant do this in VB)
>
i think there was an earlier post on this, but afaik it should be possible.

> 3. Any limitations in Python with regards to creating COM components.
>
i have found some weirdness when working with Python com objects from VB.
if an error occurs in a python objects while running a program in the vb
ide, the python objects stay around.  thus fixing the python code and
restarting the program isn't good enough, you have to close and restart vb
to clear its memory.  same goes for simply changing an object. also, setting
and resetting values in python variables from vb doesn't always work in the
ide though it does while the program runs compiled.  this makes debugging a
pain.

another one (that i have not seen verified elsewhere) that happens to me a
lot is that python objects will delete all but the first argument sent to
them if the argument is a variable. so if o_py is a python com object, doing
something like

x = 1
y = 2
call o_py(x, y)

will leave y with a null value.  i find i have to do things like.

x = 1
y = 2
z = y
call o_py(x, z)

for y to hold its value.

that said, i rewrote an old vb program (that took me over a year originally)
as a vb interface with a python dcom backend in a few weeks. it is installed
on a few dozen computers, and once installed dubugging and feature adding is
much easier with python.

-d






More information about the Python-list mailing list