On May 1, 4:24 pm, Arnaud Delobelle wrote:
> It's a challenge to do it in a list comprehension, but here it is!
> >>> data
> 'AAABCDD'
> >>> field_sizes
> [3, 5, 9, 2]
> >>> [data[i:j] for j in [0] for s in field_sizes for i, j in [(j, j+s)]]
> ['AAA', 'B', 'C', 'DD']
Ugh.
Dale Amon writes:
> Now I can move on to parsing those pesky Fortran card
> images... There wouldn't happen to be a way to take n
> continguous slices from a string (card image) where each
> slice may be a different length would there? Fortran you
> know. No spaces between input fields. :-)
>
>
alex23 wrote:
On Apr 30, 5:33 pm, "Gabriel Genellina"
wrote:
(doesn't work as written, because [...]
Man, I don't get Python... I can write a program that runs properly on
the first try but every time I post untested code to c.l.p I regret
it...
Which is why I either cut&paste working code
En Thu, 30 Apr 2009 21:10:12 -0300, alex23 escribió:
On Apr 30, 5:33 pm, "Gabriel Genellina" wrote:
(doesn't work as written, because [...]
Man, I don't get Python... I can write a program that runs properly on
the first try but every time I post untested code to c.l.p I regret
it...
Most
On Apr 30, 5:33 pm, "Gabriel Genellina"
wrote:
> (doesn't work as written, because [...]
Man, I don't get Python... I can write a program that runs properly on
the first try but every time I post untested code to c.l.p I regret
it...
Thanks, Gabriel :)
--
http://mail.python.org/mailman/listinfo
Terry Reedy wrote:
Dale Amon wrote:
Now I can move on to parsing those pesky Fortran card
images... There wouldn't happen to be a way to take n
continguous slices from a string (card image) where each slice may be
a different length would there? Fortran you know. No spaces between
input field
Terry Reedy wrote:
Dale Amon wrote:
Now I can move on to parsing those pesky Fortran card
images... There wouldn't happen to be a way to take n
continguous slices from a string (card image) where each slice may be
a different length would there? Fortran you know. No spaces between
input field
Dale Amon wrote:
Now I can move on to parsing those pesky Fortran card
images... There wouldn't happen to be a way to take n
continguous slices from a string (card image) where each
slice may be a different length would there? Fortran you
know. No spaces between input fields. :-)
I know a wa
Gabriel gave me the key to a fine solution, so
just to put a bow tie on this thread:
#!/usr/bin/python
import sys
sys.path.extend (['../lib', '../bin'])
from VLMLegacy.CardReader import CardReader
rdr = CardReader ("../example/B767.dat","PRINTABLE")
iotypes = ["WINGTL","VLMPC","VLM4997"]
fo
Dale Amon wrote:
On Thu, Apr 30, 2009 at 08:32:31AM +0200, Jeroen Ruigrok van der Werven wrote:
-On [20090430 02:21], Dale Amon (a...@vnl.com) wrote:
import sys
sys.path.extend (['../lib', '../bin'])
>from VLMLegacy.CardReader import CardReader
rdr = CardReader ("../example/B767.dat","PRINTAB
On Thu, Apr 30, 2009 at 04:33:57AM -0300, Gabriel Genellina wrote:
> En Thu, 30 Apr 2009 03:04:40 -0300, alex23 escribió:
>> Are you familiar with __import__?
>>
>> iotypes = ["WINGTL","VLMPC","VLM4997"]
>> for iotype in iotypes:
>> packagename = "VLMLegacy." + iotype + ".Conditions"
>> classn
On Thu, Apr 30, 2009 at 02:38:03AM -0400, Dave Angel wrote:
> As Scott David Daniels says, you have two built-in choices, depending on
> Python version. If you can use __import__(), then realize that
> mod = __import__("WINGTL")
>
> will do an import, using a string as the import name. I do
On Thu, Apr 30, 2009 at 08:32:31AM +0200, Jeroen Ruigrok van der Werven wrote:
-On [20090430 02:21], Dale Amon (a...@vnl.com) wrote:
>>import sys
>>sys.path.extend (['../lib', '../bin'])
>>
>>from VLMLegacy.CardReader import CardReader
>>rdr = CardReader ("../example/B767.dat","PRINTABLE")
>>
>>iot
En Thu, 30 Apr 2009 03:04:40 -0300, alex23 escribió:
On Apr 30, 1:10 pm, Dale Amon wrote:
I do not really see any other way to do what I want. If
there is a way to get rid of the exec in the sample code
I have used, I would love to know... but I can't see how
to import something where part of
Dale Amon wrote:
On Wed, Apr 29, 2009 at 10:02:46PM -0400, Dave Angel wrote:
The dot syntax works very
predictably, and quite flexibly. The problem was that by using the same
name for module and class, you didn't realize you needed to include both.
It is one of the hazards of worki
-On [20090430 02:21], Dale Amon (a...@vnl.com) wrote:
>import sys
>sys.path.extend (['../lib', '../bin'])
>
>from VLMLegacy.CardReader import CardReader
>rdr = CardReader ("../example/B767.dat","PRINTABLE")
>
>iotypes = ["WINGTL","VLMPC","VLM4997"]
>for iotype in iotypes:
>packagename =
Dale Amon writes:
> I do not really see any other way to do what I want. If
> there is a way to get rid of the exec in the sample code
> I have used, I would love to know... but I can't see how
> to import something where part of the name comes from user
> command line input without interpreting
On Apr 30, 1:10 pm, Dale Amon wrote:
> I do not really see any other way to do what I want. If
> there is a way to get rid of the exec in the sample code
> I have used, I would love to know... but I can't see how
> to import something where part of the name comes from user
> command line input wit
Dale Amon wrote:
On Wed, Apr 29, 2009 at 10:02:46PM -0400, Dave Angel wrote:
Please don't sink to exec or eval to solve what is really a
straightforward problem.
I do not really see any other way to do what I want. If
there is a way to get rid of the exec in the sample code
I have used, I wou
On Wed, Apr 29, 2009 at 10:02:46PM -0400, Dave Angel wrote:
> The dot syntax works very
> predictably, and quite flexibly. The problem was that by using the same
> name for module and class, you didn't realize you needed to include both.
It is one of the hazards of working in many very differ
Dale Amon wrote:
The point I take away from this is that packages and
modules have dotted names, but Classes do not and there
is no way to do exactly what I wanted to do.
The dot syntax would have been quite nice (I quite like the
"::" syntax in Perl) and would have made the code much
clearer.
On Wed, Apr 29, 2009 at 04:06:23PM -0700, Scott David Daniels wrote:
> Dale Amon wrote:
>>
>> The point I take away from this is that packages and
>> modules have dotted names, but Classes do not and there
>> is no way to do exactly what I wanted to do.
> Nope. You have not been clear with w
Well, I've managed to get close to what I want,
and just so you can see:
#!/usr/bin/python
import sys
sys.path.extend (['../lib', '../bin'])
from VLMLegacy.CardReader import CardReader
rdr = CardReader ("../example/B767.dat","PRINTABLE")
iotypes = ["WINGTL","VLMPC","VLM4997"]
for iotype in
Dale Amon wrote:
The point I take away from this is that packages and
modules have dotted names, but Classes do not and there
is no way to do exactly what I wanted to do.
Nope. You have not been clear with what you want, and part
of the lack of clarity is your imprecision about names.
If
On Wed, Apr 29, 2009 at 03:06:13PM -0700, Scott David Daniels wrote:
> You did not answer the question above, and I think the answer is the root
> of your misunderstanding. A class and a module are _not_the_same_thing_.
> sys is not a package, it is a module.
>>> Just because you put a class insid
Dale Amon wrote:
On Wed, Apr 29, 2009 at 01:12:33PM -0700, Scott David Daniels wrote:
Dale Amon wrote:
I am trying to get to the heart of what it is I am
missing. Is it the case that if you have a module C in a package A:
A.C
that there is no way to load it such that you can use
Actually, the parethesis mean "calling" the object.
"Callable" objects can be of different types :
-functions - in which case they get executed
-classes (or metaclasses) - in which case they get "instantiated" (with
all the protocol : __new__(), __init__()...)
-other objects - in which case the
On Wed, Apr 29, 2009 at 04:34:03PM -0400, Dale Amon wrote:
> type = "VLM4997"
> type.Header(args)
> type.Plan(args)
> type.Conditions(args)
> Where the type might change from execution to execution
> or even on different iterations.
Actually let me make that reflect more ac
On Wed, Apr 29, 2009 at 01:12:33PM -0700, Scott David Daniels wrote:
> Dale Amon wrote:
>> I am trying to get to the heart of what it is I am
>> missing. Is it the case that if you have a module C in a package A:
>> A.C
>> that there is no way to load it such that you can use:
>> x = A.C(
Dale Amon wrote:
I am trying to get to the heart of what it is I am
missing. Is it the case that if you have a module C in a
package A:
A.C
that there is no way to load it such that you can use:
x = A.C()
in your code?
OK, here's a simple question. What do you expect from:
I am trying to get to the heart of what it is I am
missing. Is it the case that if you have a module C in a
package A:
A.C
that there is no way to load it such that you can use:
x = A.C()
in your code? This is just a simpler case of what I'm
trying to do now, which has a module
Dale Amon wrote:
I am going around in circles right now and have to
admit I do not understand what is going on with
import of hierarchical packages/modules. Perhaps someone
can get me on the road again. Here is a subset of what I
am trying to accomplish:
The package directory set up:
I am going around in circles right now and have to
admit I do not understand what is going on with
import of hierarchical packages/modules. Perhaps someone
can get me on the road again. Here is a subset of what I
am trying to accomplish:
The package directory set up:
VLMLegacy/
33 matches
Mail list logo