My previous message just went up -- sorry for the mangled formatting. Here it
is properly formatted:
I want to write a list of 64-bit integers to a binary file. Every example I
have seen in my research converts it to .txt, but I want it in binary. I wrote
this code, based on some earlier wor
once.
Thanks for your help.
Oct 2, 2023, 17:47 by die...@handshake.de:
> Jen Kris wrote at 2023-10-2 00:04 +0200:
> >Iwant to write a list of 64-bit integers to a binary file. Everyexample I
> >have seen in my research convertsit to .txt, but I want it in binary. I
>
the extra overhead, and it's more
difficult yet if I'm using the Python integer output in a C program. Your
solution solves those problems.
Oct 2, 2023, 17:11 by python-list@python.org:
> On 2023-10-01 23:04, Jen Kris via Python-list wrote:
>
>>
>> Iwant to write
Iwant to write a list of 64-bit integers to a binary file. Everyexample I have
seen in my research convertsit to .txt, but I want it in binary. I wrote this
code,based on some earlier work I have done:
buf= bytes((len(qs_array)) * 8)
foroffset in range(len(qs_array)):
item_to_write= byt
Thanks to everyone who answered this question. Your answers have helped a lot.
Jen
Mar 27, 2023, 14:12 by m...@wichmann.us:
> On 3/26/23 17:53, Jen Kris via Python-list wrote:
>
>> I’m asking all these question because I have worked in a procedural style
>> for many
now I’m
studying classes in more depth. The three answers I have received today,
including yours, have helped a lot.
Thanks very much.
Jen
Mar 26, 2023, 22:45 by c...@cskk.id.au:
> On 26Mar2023 22:36, Jen Kris wrote:
>
>> At the final line it calls "satisfy"
the choose_method in the UrnaryConstraint
class because of "super(BinaryConstraint, self).__init__(strength)" in step 2
above?
Thanks for helping me clarify that.
Jen
Mar 26, 2023, 18:55 by hjp-pyt...@hjp.at:
> On 2023-03-26 19:43:44 +0200, Jen Kris via Python-list wrote:
&g
Thanks to Richard Damon and Peter Holzer for your replies. I'm working through
the call chain to understand better so I can post a followup question if
needed.
Thanks again.
Jen
Mar 26, 2023, 19:21 by rich...@damon-family.org:
> On 3/26/23 1:43 PM, Jen Kris via Python-li
The base class:
class Constraint(object):
def __init__(self, strength):
super(Constraint, self).__init__()
self.strength = strength
def satisfy(self, mark):
global planner
self.choose_method(mark)
The subclass:
class UrnaryConstraint(Constraint):
def __init__
I wrote my previous message before reading this. Thank you for the test you
ran -- it answers the question of performance. You show that re.finditer is
30x faster, so that certainly recommends that over a simple loop, which
introduces looping overhead.
Feb 28, 2023, 05:44 by li...@tompass
Using str.startswith is a cool idea in this case. But is it better than regex
for performance or reliability? Regex syntax is not a model of simplicity, but
in my simple case it's not too difficult.
Feb 27, 2023, 18:52 by li...@tompassin.net:
> On 2/27/2023 9:16 PM, avi.e.gr...@gmail.com
hings that are far from the same such as matching two
> repeated words of any kind in any case including "and and" and "so so" or
> finding words that have multiple doubled letter as in the stereotypical
> bookkeeper. In those cases, you may want even more than offset
(match.start(), match.end())
4 18
26 40
I don't insist on terseness for its own sake, but it's cleaner this way.
Jen
Feb 27, 2023, 16:55 by c...@cskk.id.au:
> On 28Feb2023 01:13, Jen Kris wrote:
>
>> I went to the re module because the specified string may appear mo
string.count() only tells me there are N instances of the string; it does not
say where they begin and end, as does re.finditer.
Feb 27, 2023, 16:20 by bobmellow...@gmail.com:
> Would string.count() work for you then?
>
> On Mon, Feb 27, 2023 at 5:16 PM Jen Kris via Python-list <
e first instance, but not the second one.
The re code finds both instances. If I knew that the substring occurred only
once then the str.find would be best.
I changed my re code after MRAB's comment, it now works.
Thanks much.
Jen
Feb 27, 2023, 15:56 by c...@cskk.id.au:
> On
Yes, that's it. I don't know how long it would have taken to find that detail
with research through the voluminous re documentation. Thanks very much.
Feb 27, 2023, 15:47 by pyt...@mrabarnett.plus.com:
> On 2023-02-27 23:11, Jen Kris via Python-list wrote:
>
>>
When matching a string against a longer string, where both strings have spaces
in them, we need to escape the spaces.
This works (no spaces):
import re
example = 'abcdefabcdefabcdefg'
find_string = "abc"
for match in re.finditer(find_string, example):
print(match.start(), match.end())
Tha
Yes, in fact I asked my original question – "I discovered something about
Python array handling that I would like to clarify" -- because I saw that
Python did it that way.
Jan 14, 2023, 15:51 by ros...@gmail.com:
> On Sun, 15 Jan 2023 at 10:32, Jen Kris via Python-list
>
a)
> 3
> sys.getrefcount(b)
> 3
> c = b
> d = a
> sys.getrefcount(a)
> 5
> sys.getrefcount(d)
> 5
> del(a)
> sys.getrefcount(d)
> 4
> b = "something else"
> sys.getrefcount(d)
> 3
>
> So, in theory, you could carefully write your code to C
34
> >>> b=1234
> >>> a is b
> False
>
> Not sure what happens if you manipulate the data referenced by 'b' in the
> first example thinking you are changing something referred to by 'a' ... but
> you might be smart to NOT th
other data
> structure. Of course, if anything else is accessing the result in the
> original in between, it won't work.
>
> Just FYI, a similar analysis applies to uses of the numpy and pandas and
> other modules if you get some kind of object holding indices to a series s
e precise, an operation on one name will be reflected in the other name.
The difference is in the names, not the pointers. Each name has the same
pointer in my example, but operations can be done in Python using either name.
Jan 11, 2023, 09:13 by r...@roelschroeven.net:
> Op 11/01/2
ct (memory block) so I have to be
aware of that when handing this kind of situation.
Jan 10, 2023, 17:31 by greg.ew...@canterbury.ac.nz:
> On 11/01/23 11:21 am, Jen Kris wrote:
>
>> where one object derives from another object (a = b[0], for example), any
>> operation tha
matrix operations, you might use NumPy. Its
> arrays and matrices are heavily optimized for fast processing and provide
> many useful operations on them. No use calling out to C code yourself when
> NumPy has been refining that for many years.
>
> On 1/10/2023 4:10 PM
> On Wed, 11 Jan 2023 at 07:14, Jen Kris via Python-list
> wrote:
>
>>
>> I am writing a spot speedup in assembly language for a short but
>> computation-intensive Python loop, and I discovered something about Python
>> array handling that I would like to clarify.
I am writing a spot speedup in assembly language for a short but
computation-intensive Python loop, and I discovered something about Python
array handling that I would like to clarify.
For a simplified example, I created a matrix mx1 and assigned the array arr1 to
the third row of the matrix:
Thanks for your reply. Victor's article didn't mention ctypes extensions, so I
wanted to post a question before I build from source.
Nov 14, 2022, 14:32 by ba...@barrys-emacs.org:
>
>
>> On 14 Nov 2022, at 19:10, Jen Kris via Python-list
>> wrote:
>>
>
In September 2021, Victor Stinner wrote “Debugging Python C extensions with
GDB”
(https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#getting_started_with_python_3_9).
My question is: with Python 3.9+, can I debug into a C extension written in
pure C and call
That's great. It clarifies things a lot for me, particularly re ref count for
new references. I would have had trouble if I didn't decref it twice.
Thanks very much once again.
Sep 30, 2022, 12:18 by pyt...@mrabarnett.plus.com:
> On 2022-09-30 17:02, Jen Kris wrote:
>
&
ndom == 0x0){
PyErr_Print();
Leaks here because of the refcount
Assuming pMod_random is not null, why would this leak?
Thanks again for your input on this question.
Jen
Sep 29, 2022, 17:33 by pyt...@mrabarnett.plus.com:
> On 2022-09-30 01:02, MRAB wrote:
>
>> On 2022-09-
anks again to MRAB for helpful comments.
Jen
Sep 29, 2022, 15:31 by pyt...@mrabarnett.plus.com:
> On 2022-09-29 21:47, Jen Kris wrote:
>
>> To update my previous email, I found the problem, but I have a new problem.
>>
>> Previously I cast PyObject * value_ptr = (PyOb
>
> So I incremented the reference to all objects in Get_LibModules, but I still
> get the same segfault at PyObject_CallFunctionObjArgs. Unfortunately,
> reference counting is not well documented so I’m not clear what’s wrong.
>
>
>
>
> Sep 29, 2022, 10:06 by p
cremented the reference to all objects in Get_LibModules, but I still
get the same segfault at PyObject_CallFunctionObjArgs. Unfortunately,
reference counting is not well documented so I’m not clear what’s wrong.
Sep 29, 2022, 10:06 by pyt...@mrabarnett.plus.com:
> On 2022-09-29 16:5
Recently I completed a project where I used PyObject_CallFunctionObjArgs
extensively with the NLTK library from a program written in NASM, with no
problems. Now I am on a new project where I call the Python random library. I
use the same setup as before, but I am getting a segfault with random
e uses the append method. But my
PyList_Append is not doing the job so that's where I'm looking now.
Thanks very much for your reply.
Mar 12, 2022, 15:36 by ros...@gmail.com:
> On Sun, 13 Mar 2022 at 10:30, Jen Kris wrote:
>
>>
>>
>> Chris, you were right t
-- hence pDictData is
empty. I tried with PyList_SetItem but that doesn't work. Do you know of way
to "extend" a list in the C API.
Thanks very much.
Jen
Mar 12, 2022, 13:57 by ros...@gmail.com:
> On Sun, 13 Mar 2022 at 08:54, Jen Kris wrote:
>
>>
>>
>
pDictData, despite the name, is a list of 2-tuples where each 2-tuple is a
dictionary object and a string.
Mar 12, 2022, 13:41 by ros...@gmail.com:
> On Sun, 13 Mar 2022 at 08:25, Jen Kris via Python-list
> wrote:
>
>> PyObject* slice = PySlice_New(PyLong_FromLong(0)
s.com:
> On 2022-03-12 21:24, Jen Kris via Python-list wrote:
>
>> I have a C API project where I have to slice a list into two parts.
>> Unfortunately the documentation on the slice objects is not clear enough for
>> me to understand how to do this, and I haven’t found e
I have a C API project where I have to slice a list into two parts.
Unfortunately the documentation on the slice objects is not clear enough for me
to understand how to do this, and I haven’t found enough useful info through
research. The list contains tuple records where each tuple consists
(this is the REPR of pWTok):
"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
Thanks again to both of you.
Jen
Mar 7, 2022, 11:03 by pyt...@mrabarnett.plus.com:
> On 2022-03-07 17:05, Jen Kris wrote:
>
The PyObject str_sentence is a string representation of a list. I need to
convert the list to a string like "".join because that's what the library call
takes.
Mar 7, 2022, 09:09 by ros...@gmail.com:
> On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
> wrote:
&g
the same way as ‘’.join, and if not then (2) how can I
strip characters from a string object in the C API?
Thanks.
Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:
> On 2022-03-07 00:32, Jen Kris via Python-list wrote:
>
>> I am using the C API in Python 3.8 with the nltk
I am using the C API in Python 3.8 with the nltk library, and I have a problem
with the return from a library call implemented with
PyObject_CallFunctionObjArgs.
This is the relevant Python code:
import nltk
from nltk.corpus import gutenberg
fileids = gutenberg.fileids()
sentences = gutenberg
Yes, that works. This is my first day with C API dictionaries. Now that
you've explained it, it makes perfect sense. Thanks much.
Jen
Feb 14, 2022, 17:24 by ros...@gmail.com:
> On Tue, 15 Feb 2022 at 12:07, Jen Kris via Python-list
> wrote:
>
>>
>> I created a
I created a dictionary with the Python C API and assigned two keys and values:
PyObject* this_dict = PyDict_New();
const char *key = "key1";
char *val = "data_01";
PyObject* val_p = PyUnicode_FromString(val);
int r = PyDict_SetItemString(this_dict, key, val_p);
// Add another k-v pair
key = "
Thank you for that suggestion. It allowed me to replace six lines of code with
one. :)
Feb 10, 2022, 12:43 by pyt...@mrabarnett.plus.com:
> On 2022-02-10 20:00, Jen Kris via Python-list wrote:
>
>> With the help of PyErr_Print() I have it solved. Here is the final code
erday.
Thanks much for your help.
Jen
Feb 9, 2022, 18:43 by pyt...@mrabarnett.plus.com:
> On 2022-02-10 01:37, Jen Kris via Python-list wrote:
>
>> I'm using Python 3.8 so I tried your second choice:
>>
>> pSents = PyObject_CallFunctionObjArgs(pSentMod, pListItem);
>
om PyErr_Print. I'm not far enough along in my C_API work to
understand why, but it doesn't work.
Thanks very much for your help on this.
Jen
Feb 9, 2022, 17:40 by songofaca...@gmail.com:
> On Thu, Feb 10, 2022 at 10:37 AM Jen Kris wrote:
>
>>
>> I
I'll do that and post back tomorrow. The office is closing and I have to leave
now (I'm in Seattle). Thanks again for your help.
Feb 9, 2022, 17:40 by songofaca...@gmail.com:
> On Thu, Feb 10, 2022 at 10:37 AM Jen Kris wrote:
>
>>
>> I'm using Python
. Can be
> used with Python <3.9 too.
> pSents = PyObject_CallFunctionObjArgs(pSentMod, pListItem);
>
> On Thu, Feb 10, 2022 at 10:15 AM Jen Kris wrote:
>
>>
>> Right you are. In that case should I use Py_BuildValue and convert to tuple
>> (because it won'
Right you are. In that case should I use Py_BuildValue and convert to tuple
(because it won't return a tuple for a one-arg), or should I just convert
pListStr to tuple? Thanks for your help.
Feb 9, 2022, 17:08 by songofaca...@gmail.com:
> On Thu, Feb 10, 2022 at 10:05 AM Jen Kri
/vrut/python/ext/buildValue.html, PyBuildValue
"builds a tuple only if its format string contains two or more format units"
and that doc contains examples.
Feb 9, 2022, 16:52 by songofaca...@gmail.com:
> On Thu, Feb 10, 2022 at 9:42 AM Jen Kris via Python-list
> wrote:
>
This is a follow-on to a question I asked yesterday, which was answered by
MRAB. I'm using the Python C API to load the Gutenberg corpus from the nltk
library and iterate through the sentences. The Python code I am trying to
replicate is:
from nltk.corpus import gutenberg
for i, fileid in en
Thank you for clarifying that. Now on to getting the iterator from the method.
Jen
Feb 8, 2022, 18:10 by pyt...@mrabarnett.plus.com:
> On 2022-02-09 01:12, Jen Kris via Python-list wrote:
>
>> I am using the Python C API to load the Gutenberg corpus from the nltk
>> l
I am using the Python C API to load the Gutenberg corpus from the nltk library
and iterate through the sentences. The Python code I am trying to replicate is:
from nltk.corpus import gutenberg
for i, fileid in enumerate(gutenberg.fileids()):
sentences = gutenberg.sents(fileid)
et
y is also not.
>
> -Original Message-
> From: Dennis Lee Bieber
> To: python-list@python.org
> Sent: Wed, Feb 2, 2022 12:30 am
> Subject: Re: Data unchanged when passing data to Python in multiprocessing
> shared memory
>
>
> On Wed, 2 Feb 2022 00:40:22 +0100
Feb 1, 2022, 21:30 by wlfr...@ix.netcom.com:
> On Wed, 2 Feb 2022 00:40:22 +0100 (CET), Jen Kris
> declaimed the following:
>
>>
>> breakup = int.from_bytes(byte_val, "big")
>>
> >print("this is breakup " + str(breakup))
>
>>
>>
>
ig endian.
However, if anyone on this list knows how to pass data from a non-Python
language to Python in multiprocessing.shared_memory please let me (and the
list) know.
Thanks.
Feb 1, 2022, 14:20 by ba...@barrys-emacs.org:
>
>
>> On 1 Feb 2022, at 20:26, Jen Kris via Pyth
I am using multiprocesssing.shared_memory to pass data between NASM and Python.
The shared memory is created in NASM before Python is called. Python connects
to the shm: shm_00 =
shared_memory.SharedMemory(name='shm_object_00',create=False).
I have used shared memory at other points in thi
h ctypes. If I use it as a C extension then I
want the Python code on a separate thread because I can't have two instances of
the Python interpreter running on one thread, and one instance will already be
running on the main thread, albeit "suspended" by the call from ctypes.
@barrys-emacs.org:
>
>
>> On 6 Dec 2021, at 17:09, Jen Kris via Python-list
>> wrote:
>>
>> I can't find any support for your comment that "Fork creates a new
>> process and therefore also a new thread." From the Linux man pages
>> htt
t;).
You may be confused by the fact that threads are called light-weight processes.
Or maybe I'm confused :)
If you have other information, please let me know. Thanks.
Jen
Dec 5, 2021, 18:08 by hjp-pyt...@hjp.at:
> On 2021-12-06 00:51:13 +0100, Jen Kris via Python-list wrote:
>
e Python code than
with C API code.
I hope that clarifies what I'm doing.
Jen
Dec 5, 2021, 15:19 by ba...@barrys-emacs.org:
>
>
>
>
>> On 5 Dec 2021, at 17:54, Jen Kris wrote:
>>
>>
>> Thanks for your comments.
>>
>> I put the Pyth
s.org:
>
>
>> On 1 Dec 2021, at 16:01, Jen Kris <>> jenk...@tutanota.com>> > wrote:
>>
>> Thanks for your comment re blocking.
>>
>> I removed pipes from the Python and C programs to see if it blocks without
>> them, and it does.
>>
>
>
>
>
>> On 29 Nov 2021, at 22:31, Jen Kris <>> jenk...@tutanota.com>> > wrote:
>>
>> Thanks to you and Cameron for your replies. The C side has an epoll_ctl
>> set, but no event loop to handle it yet. I'm putting that in now with a
>
hat's nonblocking by default.
The child will become more complex, but not in a way that affects polling. And
thanks for the tip about the c-string termination.
Nov 29, 2021, 14:12 by ba...@barrys-emacs.org:
>
>
>> On 29 Nov 2021, at 20:36, Jen Kris via Python-list
>&
I have a C program that forks to create a child process and uses execv to call
a Python program. The Python program communicates with the parent process (in
C) through a FIFO pipe monitored with epoll().
The Python child process is in a while True loop, which is intended to keep it
running w
Hi Python Users,
Would like to request how to install GDAL in my Enthought Python
Distribution (64-bit). I am having some problems making GDAL work. Or can
you point me into a blog that describes how to set up GDAL in Enthought
Python Distribution.
Thanks for any help.
-Leo
--
https://mail.pytho
Hi ALL,
Just wanted to ask if somebody could guide me in installing GDAL in my
Python installed using Canopy. Could you give me some steps how to
successfully install this package? I got it running using my previous
Python Installation, but I removed it and used Canopy Python now.
btw: my python
Hi Python Users,
Good day!
I am currently using ENVI for my image processing/remote sensing work, but
would love to divert into open source python programming for remote
sensing. Can you give me some good sites where I can see practical examples
of how python is used for remote sensing specially
-gdal-and-ogr-for-python-on-windows/
>
> Asim
>
> On Tue, Feb 10, 2015 at 9:11 PM, Leo Kris Palao
> wrote:
>
>> Hi Python Users,
>>
>> I currently installed the Python 2.7.9 and installed the GDAL package.
>> First, I tried to install GDAL using PIP but it
Hi Python Users,
I currently installed the Python 2.7.9 and installed the GDAL package.
First, I tried to install GDAL using PIP but it throws an error - I cannot
remember the exact error message. So, I install it using easy_install
command. But when I import the package I am getting this message,
the Classes and __init__ still don't make much sense actually. i have tried and
tried again to make it generate numbers between 0 and 5 in a while statement
but it just doesn't seem to be working.
import random
class Player():
hp = 10
def __init__(self, patt):
self.att = rando
import random
class player():
hp = 10
attack = random.randint(0,5)
class monster():
hp = 10
attack = random.randint(0,4)
def battle():
print ("a wild mosnter appered!")
print ("would you like to battle?")
answer = input()
if answer == ("yes"):
while monst
darn i was hoping i could put off learning classes for a bit, but it seems that
is not the case. i have tested it a bit and it seems to be working correctly
now.
import random
class player():
hp = 10
speed = 5
attack = random.randint(0,5)
print (player.
the idea was to store variables for later use, but you are correct i don't
understand functions or if that is even the best way to do it. i guess i'd want
to be able to call the HP and ATTACK variables of player for when the battle
gets called. i would then use the variables in battle to figure
import random
def player():
hp = 10
speed = 5
attack = random.randint(0,5)
def monster ():
hp = 10
speed = 4
def battle(player):
print ("a wild mosnter appered!")
print ("would you like to battle?")
answer = input()
if answer == ("yes"):
return player(
WOW as if it was something as easy as that,i had been looking for awhile on
what i was doing wrong. as it seems i just don't know my way around if
statements at all, thank a bunch for this. makes everything else i have been
code work
thanks again
--
http://mail.python.org/mailman/listinfo/pyt
I have a program that is blocked and all threads are blocked on a
Queue.Queue.get or Queue.Queue.put method (on the same Queue.Queue
object).
1 thread shows the below as its last entry in the stack:
File: "c:\python27\lib\Queue.py", line 161, in get
self.not_empty.acquire()
2 threads show the b
castironpi wrote:
On Aug 24, 9:52 am, Kris Kennaway <[EMAIL PROTECTED]> wrote:
castironpi wrote:
Hi,
I've got an "in-place" memory manager that uses a disk-backed memory-
mapped buffer. Among its possibilities are: storing variable-length
strings and structure
open-source it. Any interest?
Just do it. That way users can come along later.
Kris
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
Kris Kennaway wrote:
Peter Otten wrote:
[EMAIL PROTECTED] wrote:
On Aug 10, 10:10 pm, Kris Kennaway <[EMAIL PROTECTED]> wrote:
jlist wrote:
I think what makes more sense is to compare the code one most
typically writes. In my case, I always use range() and nev
tricky and not something I
want to trust to projects that have not had significant experience and
auditing.
Kris
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
[EMAIL PROTECTED] wrote:
On Aug 10, 10:10 pm, Kris Kennaway <[EMAIL PROTECTED]> wrote:
jlist wrote:
I think what makes more sense is to compare the code one most
typically writes. In my case, I always use range() and never use psyco.
But I guess for most of my wor
Diez B. Roggisch wrote:
Kris Kennaway schrieb:
I would like to MIME encode a message from a large file without first
loading the file into memory. Assume the file has been pre-encoded on
disk (actually I am using encode_7or8bit, so the encoding should be
null). Is there a way to construct
yet, where
performance starts to matter.
Hopefully when you do you will improve your programming practices to not
make poor choices - there are few excuses for not using xrange ;)
Kris
--
http://mail.python.org/mailman/listinfo/python-list
What is the standard deviation on those numbers? What is the confidence
level that they are distinct? In a thread complaining about poor
benchmarking it's disappointing to see crappy test methodology being
used to try and demonstrate flaws in the test.
Kris
--
http://mail.python.org/mailman/listinfo/python-list
streamed from the file as needed instead of being resident in
memory? Do I have to subclass the MIMEBase class myself?
Kris
--
http://mail.python.org/mailman/listinfo/python-list
ameters you are passing in are safe.
Kris
--
http://mail.python.org/mailman/listinfo/python-list
Benjamin Kaplan wrote:
The only problem I can see is that 32-bit programs can't access 64-bit
dlls, so the OP might have to install the 32-bit version of Python for
it to work.
Anyway, all of this is beside the point, because the multiprocessing
module works fine on amd64 systems.
on a single CPU at a time. Depending on what
modules you use they may be able to operate independently on multiple
CPUs. The term to research is "GIL" (Global Interpreter Lock). There
are many webpages discussing it, and the alternative strategies you can use.
Kris
--
http://mail.
J. Cliff Dyer wrote:
On Wed, 2008-07-09 at 12:29 -0700, samwyse wrote:
On Jul 8, 11:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote:
samwyse wrote:
You might want to look at Plex.
http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/
"Another advantage of Plex is that it compiles
wer like Python's re to search the remainder of
the line for 'bar.*zot'.
If it was just strings, then sure...with regexps it might be possible to
make it work, but it doesn't sound particularly maintainable. I will
stick with my shell script until python gets a regexp
samwyse wrote:
On Jul 8, 11:01 am, Kris Kennaway <[EMAIL PROTECTED]> wrote:
samwyse wrote:
You might want to look at Plex.
http://www.cosc.canterbury.ac.nz/greg.ewing/python/Plex/
"Another advantage of Plex is that it compiles all of the regular
expressions into a single DFA.
Jeroen Ruigrok van der Werven wrote:
-On [20080709 14:08], Kris Kennaway ([EMAIL PROTECTED]) wrote:
It's compiler/build output.
Sounds like the FreeBSD ports build cluster. :)
Yes indeed!
Kris, have you tried a PGO build of Python with your specific usage? I
cannot guarantee it
,
postscript paper and C source findable from Gonzalo Navarro's home-
page.
Thanks, looks interesting but I don't think it is the best fit here. I
would like to avoid spawning hundreds of processes to process each file
(since I have tens of thousands of them to process).
Kris
--
http://mail.python.org/mailman/listinfo/python-list
ger compilation time (over a
minute). If the matching was fast then I could possibly pickle the
lexer though (but it's not).
Kris
Kris
--
http://mail.python.org/mailman/listinfo/python-list
a time proportional to the number of characters to be
scanned, and independent of the number or complexity of the regular
expressions. Python's existing regular expression matchers do not have
this property. "
Very interesting! Thanks very much for the pointer.
Kris
--
http://mail.python.org/mailman/listinfo/python-list
ed in but
I can and do :-)
It's a major problem that regular expression parsing in python has
exponential complexity when polynomial algorithms (for a subset of
regexp expressions, e.g. excluding back-references) are well-known.
It rules out using python for entire classes of applicatio
Scott David Daniels wrote:
Kris Kennaway wrote:
Thanks for the pointers, I think a C extension will end up being the
way to go, unless someone has beaten me to it and I just haven't found
it yet.
Depending on the pattern length you are targeting, it may be fastest to
increase the out-of
1 - 100 of 117 matches
Mail list logo