Import removing first module component

2008-06-04 Thread koblas
Have the following line:
import notewave.runner.LMTP

Yeilding the following error:
ImportError: No module named runner.LMTP

For the life of me I don't understand why the first component
"notewave" is being stripped off, when the import is happening.

Thanks,
--
http://mail.python.org/mailman/listinfo/python-list


Re: Import removing first module component

2008-06-05 Thread koblas
On Jun 4, 2:48 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote:
> In article
> <[EMAIL PROTECTED]>,
>
>  koblas <[EMAIL PROTECTED]> wrote:
> > Have the following line:
> >         import notewave.runner.LMTP
>
> > Yeilding the following error:
> >         ImportError: No module named runner.LMTP
>
> > For the life of me I don't understand why the first component
> > "notewave" is being stripped off, when the import is happening.
>
> Does notewave contain a _module_ named runner.LMTP ?
> Probably not, since the error message says there's no
> such module.
>
> > Thanks,
>
> --
> David C. Ullrich

The following exist:
   .../notewave/runner/LMTP.py
inside of LMTP.py there is:
   class LMTPRunner(Runner) :

Another person pointed out that I should check on the __init__.py and
make sure lmtp is defined in the __all__ block.  I didn't have an
__init__.py at that level of the tree, which must have been causing
problems, but clearly I don't understand the full inheritance of
__init__.py and sub-directories.
--
http://mail.python.org/mailman/listinfo/python-list


Native Code vs. Python code for modules

2008-07-29 Thread koblas
Ruby has been getting pummeled for the last year or more on the
performance subject.  They've been working hard at improving it.  From
my arm chair perspective Python is sitting on it's laurels and not
taking this as seriously as it probably should.  In general it's
possible to make many comments that swirl around religion and
approach, one of the things that I've noticed is that wile Python has
a much more disciplined developer community they're not using this for
the greater good.

Specifically, in looking at a benchmark that was posted, python was an
order of magnitude (20 secs vs. 1 sec) slower than ruby.  In
investigating the performance bottleneck is the random module.  This
got me to think, why does python have "pickle" and "cPickle"?  Comes
down to lowest common denominator, or the inability for somebody to
write an optimized package that can mimic a python package.

To that end why would somebody write big try catch blocks to see if
modules exist and if they exist alias their names.  Wouldn't it be
better if there was a way that if I have an "interface compatible"
native (aka C) module that has better performance that there could be
a way that python would give it preference.

e.g.

  import random(version=1.2, lang=c)
or
  import random(version=1.2, lang=py)   # use the python version by
default
or
  import random #  use the latest version in the "fastest" code (C
given preference)

where there could be a nice set of "standard" key value pairs that
could provide addtional hints as to what language and version of a
library was to be used.
--
http://mail.python.org/mailman/listinfo/python-list