luis wrote:
> I'm using ctypes to call a fortran dll from python. I have no problems
> passing integer and double arryas, but I have an error with str arrys.
> For example:
[snip]
I do not know about Microsoft Fortran compilers (your mention
of dll indicates you are probably using MS), nor much ab
Paul Rubin wrote:
>
> from itertools import izip
> pos = map(dict(izip(l2, count())).__getitem__, l1)
or probably less efficiently ...
>>> l1 = [ 'abc', 'ghi', 'mno' ]
>>> l2 = [ 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr']
>>> pos = [ l2.index(i) for i in l1 ]
>>> print pos
[0, 2, 4]
Charles
hiro wrote:
> bare in mind that I have a little over 10 million objects in my list
> (l2) and l1 contains around 4 thousand
> objects.. (i have enough ram in my computer so memory is not a
> problem)
Glad to see you solved the problem with the trailing space.
Just one minor point, I did say
> o
Chris wrote:
>
> But does anyone know why the Tkinter program is doing this to the
> terminal in the first place? I don't want to have to tell users of my
> program that they must recover their terminal's sanity each time after
> running my program.
>
I don't know about Tkinter, but my g
Thomas Dybdahl Ahle wrote:
> Hi, I'm writing a program with a large data stream to which modules can
> connect using regular expressions.
>
> Now I'd like to not have to test all expressions every time I get a line,
> as most of the time, one of them having a match means none of the others
> ca
Chris wrote:
> ... Quitting by typing 'sys.exit()' in the interpreter
> also works fine. Only quitting via the GUI seems to cause the
> problem.
As previously stated, I know nothing about Tkinter,
but it definitely looks like there is some cleanup being skipped
on a GUI exit that is in fac
Grant Edwards wrote:
> Assuming the python interpreter free()s the memory, my
> understanding is that on Unixes the memory is returned to the
> pool used by malloc(), but is not returned to the OS since
> there isn't a practical way to ensure that the memory at the
> "end" of the data segment is no
Gabriel Genellina wrote:
[snip]
> if x elif x>maxvalue: yield top
> else: yield (x-minvalue)*top/(maxvalue-minvalue)
[snip]
Personally, I find
yield min(top,max(0,(x-minvalue)*top/(maxvalue-minvalue)))
or
scaled_value = (x-minvalue)*top/(maxvalue-minvalue)
yiel
Diez B. Roggisch wrote:
> I fail to see where laziness has anything to do with this.
> In C++, this problem can be remedied with the so called
> temporary base class idiom.
I have seen this referred to as lazy evaluation in C++,
so I suspect that Diez and Sturia are using "Lazy evaluatio
Roel Schroeven wrote:
>
> I might be wrong of course, but can't you just use atan2? Only problem
> is that it returns negative angles for quadrants 3 and 4, but that is
> easily solved. In Python:
>
> from math import atan2, pi, fmod
> def vectorAngle(x, y):
> return fmod(atan2(y, x) + 2*pi
Michael Tobis wrote:
> Here is the bloated mess I came up with. I did see that it had to be
> recursive, and was proud of myself for getting it pretty much on the
> first try, but the thing still reeks of my sorry old fortran-addled
> mentality.
Recursion is not necessary, but is much, much cleare
Hrvoje Niksic wrote:
> I often have the need to match multiple regexes against a single
> string, typically a line of input, like this:
>
> if (matchobj = re1.match(line)):
> ... re1 matched; do something with matchobj ...
> elif (matchobj = re2.match(line)):
> ... re2 matched; do something wi
[EMAIL PROTECTED] wrote:
> On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]>
> wrote:
[snip]
>> or even this monstrosity ...
>>
>> def permute2( s, n ):
>>return [ ''.join([ s[int(i/len(s)**j)%len(s)]
>> for j in range(n-1,-1,-1)
Ant wrote:
>
> What method of executing code snippets in a Python shell do other Vim
> users use? Other than just copy/paste?
>
Not vim, but good old vi so should work in vim
1. Mark the start of the fragment, for exampls ms (to mark
with label s). Labels a through z are available.
2. Move to t
Torsten Bronger wrote:
> Hallöchen!
[...]
>>>
>>> Example string: u"Hollo", escaped positions: [4]. Thus, the
>>> second "o" is escaped and must not be found be the regexp
>>> searches.
>>>
>>> Instead of re.search, I call the function guarded_search(pattern,
>>> text, offset) which takes care of
Doug Phillips wrote:
>> It also works the other way around, at least on the non-empty
>> set of systems that contains my workstation. export simply
>> marks the variable name for automatic export to the
>> environment of subsequent commands. The value at that time
>> doesn't matter. What matter
Dave Hansen wrote:
>
> The date is about right (actually, a little early: ASR-33, 1965; C,
> about 1970), but you can't program C on an ASR-33. Keywords are all
> lower case, and always have been. "IF" is a syntax error...
>
But the Unix terminal drivers of the day for
upper case only
I am not sure if this is the right forum to ask this. If it is not,
could someone pleas point me to a more appropriate newsgroup.
I am attempting to install dap.plugins.netcdf using easy_install
on HP-UX 11. As a user, I do not have access to root so have
followed the easy_install recommendation
[EMAIL PROTECTED] wrote:
> On Apr 12, 10:16�pm, "Jia Lu" <[EMAIL PROTECTED]> wrote:
>> Hi all.
>> �I want to create a large list like:
>>
>> ~
>>
>> Is there any good algorithm to do this?
>
> Sure.
> test = '01'
>
> for m in test:
> for n in test:
> for o in test:
>
Paul Rubin wrote:
[snip]
>
> def a(n):
> if n==0:
> yield ''
> return
> for c in s:
> for r in a(n-1):
> yield c+r
>
> print list(a(3))
Of course, obvious in retrospect, recursion instead of iteration.
I have yet to comp
Michael Hoffman wrote:
> schnupfy wrote:
>
>> I am not used to python and I am wondering about this thing:
>
> This is not a Python question. It is a question about how to use bash.
>
[snip]
Michael is correct, it is a bash thing, nothing to do with python.
bash (and other *nix like shells) gen
schnupfy wrote:
>
> ok, thanks for the answers. I try to hand over the 3rd part (the long
> trap) as one cmd argument. I will ask in a shell ng. Thanks again.
>
> Cheers
Should be as simple as removing the backslashes
/root/mk/services.py $HOST $SEVERITY "$TRAP"
should pass TRAP as a s
22 matches
Mail list logo