Re: Help with research

2005-02-18 Thread elena
Thanks for input. You're right. Programmers would probably look for the abolute value of an answer. That's one reason why people sometimes get annoyed with us (I guess I'm thinking of the product managers I've worked with). In any case, this is an existing instrument and was not developed specifica

Re: re.compile and very specific searches

2005-02-18 Thread John Machin
Diez B. Roggisch wrote: > > You could use another regular expressin, e.g. like this: > > > rex = re.compile(r"^((\d)|(1\d{1,2})|(2[0-5]\d))$") This approach would actually work without the need for subsequent validation, if implemented properly. Not only as you noted does it let "259" through, bu

xmlrpc.server.work() does not seem to handle multiple requests

2005-02-18 Thread john14
Hi, I have an xmlrpc server. I using the python package xmlrpc. Here is what I am doing: s = xmlrpc.server() s.addMethods(method_hash) s.bindAndListen(PORT) while 1: try: s.work() except: e = sys.exc_info() The problem is that when I send m

Re: re.compile and very specific searches

2005-02-18 Thread Diez B. Roggisch
> The OP wanted to "find" IP addresses -- unclear whether re.search or > re.match is required. Your solution doesn't address the search case. > For the match case, it needs some augmentation. It will fall apart if > presented with something like "..." or "comp.lang.python.announce". AND > while I'm

Re: help for xml parsing error

2005-02-18 Thread Diez B. Roggisch
Michael Zhang wrote: > I got a strange error of my python program. The > program is trying to load some data from server (also > built in Python). the data is in xml format. After You claim it is in xml format - but the parser error strongly suggest that it isn't. Please do show it to us, then

R*volume*raduis2 c3po "Theroy of everything"

2005-02-18 Thread zetasum
R*volume*raduis2 c3po "Theroy of everything" finding the multi-plex time and volume of the earth you can find the universe volume and time!! A.I =/2 You have to start all over agian with this t3echnology bulid A.I and a new quantium computer or supercomputer is the only way to get this to

Re: re.compile and very specific searches

2005-02-18 Thread Diez B. Roggisch
> > This approach would actually work without the need for subsequent > validation, if implemented properly. Not only as you noted does it let > "259" through, but also it doesn't cover 2-digit numbers starting with > 2. Assuming excess leading zeroes are illegal, the components required > are: D

Re: selecting dictionaries to maximize counts

2005-02-18 Thread John Machin
Steven Bethard wrote: > I have a list of dictionaries. Each dictionary holds counts of various > 'words', e.g.: > Basically, I use a greedy approach -- adding a dict each time if I can. > This leads to some suboptimal solutions given that, while the total > counts must not exceed MAX_VALUE, I

Re: Python, Matlab and AI question

2005-02-18 Thread Robert Kern
Alexander Schmolck wrote: Actually, I've written a highlevel matlab-python bridge (based on bugfixed and slightly extended version of the original pymat) which is quite up-to-date; by and large it makes using matlab from python as easy as if matlab were just some python library: Fantastic! I've add

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by both ends. So use pickle

Re: Font size

2005-02-18 Thread Adam
Thanks Fredrik, I got your program running (with a couple of tweaks) with just a quarter of an hour to spare before using it at our happy hour yesterday. The old ladies loved it. I can now adapt it for bingo. Thanking you Adam. -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode and socket

2005-02-18 Thread Irmen de Jong
Irmen de Jong wrote: aurora wrote: You could not. Unicode is an abstract data type. It must be encoded into octets in order to send via socket. And the other end must decode the octets to retrieve the unicode string. Needless to say the encoding scheme must be consistent and understood by bot

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-18 Thread Mike Meyer
Arich Chanachai <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>Whatever the intentions may be, the *act* is one of dictation. Since >>the point of the underlying OS is to increase the interconnections >>between applications (assuming I've found the correct web page and >>interpreted it correctl

Re: unicode and socket

2005-02-18 Thread Lion Kimbro
You probably want to use UTF-16 or UTF-8 on both sides of the socket. See http://www.python.org/moin/Unicode for more information. So, we have a Unicode string... >>> mystring=u'eggs and ham' >>> mystring u'eggs and ham' Now, we want to send it over: >>> to_send=mystring.encode('utf-8') >>> to_s

Re: re.compile and very specific searches

2005-02-18 Thread rbt
John Machin wrote: Diez B. Roggisch wrote: So I'd suggest you dump re and do it like this: address = "192.168.1.1" def validate_ip4(address): digits = address.split(".") if len(digits) == 4: for d in digits: if int(d) < 0 or int(d) > 255: return False re

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-18 Thread JanC
Robert Kern schreef: > And yet there is not one company that has someone devoted full-time to > developing Python. Except for 'future Python' aka PyPy... :) -- JanC "Be strict when sending and tolerant when receiving." RFC 1958

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-18 Thread A.B., Khalid
Ilias Lazaridis wrote: > The first step is to make a pyMinGW project. > You are mistaken. The first steps are the following: 1) Realizing that a project _must_ start not because you want it to, but because those who are willing to work on it think it is worth the extra effort for it to. 2) Reali

Re: xmlrpc.server.work() does not seem to handle multiple requests

2005-02-18 Thread pythonUser_07
Unfortunately no because this is a single threaded http server. It's great for testing stuff out, but it doesn't scale unless you make it scale. I am assuming you could use the Zope application server to scale your code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unit Testing in Python

2005-02-18 Thread Lion Kimbro
No-nonsense PyUnit skeleton: http://www.python.org/moin/PyUnit Copy & Paste. Though there's a new module, [http://codespeak.net/py/current/doc/test.html py.test,] that's easier in many ways. -- http://mail.python.org/mailman/listinfo/python-list

Graph

2005-02-18 Thread bearophileHUGS
This is the first version of the graph module I was developing... In the meantime I've seen that there are already lots of graph implementations, even a compiled one: ftp://xray.imsb.au.dk/pub/python/packages/Python2.1/RPMS/python-kjbuckets-2.2-7.i686.rpm (This makes my work less important, but it

Re: selecting dictionaries to maximize counts

2005-02-18 Thread Steven Bethard
John Machin wrote: Steven Bethard wrote: I have a list of dictionaries. Each dictionary holds counts of various 'words'... ... Basically, I use a greedy approach -- adding a dict each time if I can. ... This leads to some suboptimal solutions given that, while the total counts must not exceed MAX

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Machin
John Lenton wrote: > On Thu, Feb 17, 2005 at 03:46:20PM -0800, Xah Lee wrote: > > here's another interesting algorithmic exercise, again from part of a > > larger program in the previous series. > > > > Here's the original Perl documentation: > > > > =pod > > > > merge($pairings) takes a list of p

Re: unicode encoding usablilty problem

2005-02-18 Thread Neil Hodgson
Martin v. Löwis: > Eventually, the primary string type should be the Unicode > string. If you are curious how far we are still off that goal, > just try running your program with the -U option. Tried both -U and sys.setdefaultencoding("undefined") on a couple of my most used programs and saw a

Re: selecting dictionaries to maximize counts

2005-02-18 Thread Brian Beck
Steven Bethard wrote: I have a list of dictionaries. Each dictionary holds counts of various 'words', e.g.: py> countdicts = [ ... dict(a=9, b=9, c=9), ... dict(a=8, b=7), ... dict(a=4, b=5, c=12)] I need to select dicts with the constraint that the number of each 'word' totalled ov

Re: unicode encoding usablilty problem

2005-02-18 Thread aurora
On Fri, 18 Feb 2005 20:18:28 +0100, Walter Dörwald <[EMAIL PROTECTED]> wrote: aurora wrote: > [...] In Java they are distinct data type and the compiler would catch all incorrect usage. In Python, the interpreter seems to 'help' us to promote binary string to unicode. Things works fine, u

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Lenton
On Fri, Feb 18, 2005 at 03:21:10PM -0800, John Machin wrote: > Not robust in the face of input like: > [[1,1]] > or > [[1,2], [1,2]] > or > [[1,2], [2,1]] > or > [[1,2], [2,3], [3,1]] oops, my bad. > > needs "if first == second: continue" here > > > if has_first and has_second: > >

Re: unicode encoding usablilty problem

2005-02-18 Thread aurora
On Fri, 18 Feb 2005 21:16:01 +0100, Martin v. Löwis <[EMAIL PROTECTED]> wrote: I'd like to point out the historical reason: Python predates Unicode, so the byte string type has many convenience operations that you would only expect of a character string. We have come up with a transition strateg

Re: [perl-python] exercise: partition a list by equivalence

2005-02-18 Thread Cyril BAZIN
Hello John, Try your python code on this example: merge([[1,2], [3,4], [1,2], [5,3]]) The result given by your function is: [[3, 4, 5]] Sorry... To Xah: next time you propose an exercise, write some UNIT TESTS!!! Then people will be able to test if there answers are correct or not. Cyril

Re: selecting dictionaries to maximize counts

2005-02-18 Thread Steven Bethard
Brian Beck wrote: Steven Bethard wrote: I have a list of dictionaries. Each dictionary holds counts of various 'words', e.g.: py> countdicts = [ ... dict(a=9, b=9, c=9), ... dict(a=8, b=7), ... dict(a=4, b=5, c=12)] I need to select dicts with the constraint that the number of each

Re: selecting dictionaries to maximize counts

2005-02-18 Thread Brian Beck
Steven Bethard wrote: > Anyway, do you know what name this problem is usually discussed under? If I knew what to google for, I could probably find at least a few simple heuristics to try... I think the closest thing would be the 'knapsack problem' or the 'subset sum problem.' http://en.wikipedi

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Machin
John Lenton wrote: > On Fri, Feb 18, 2005 at 03:21:10PM -0800, John Machin wrote: > > Not robust in the face of input like: > > [[1,1]] > > or > > [[1,2], [1,2]] > > or > > [[1,2], [2,1]] > > or > > [[1,2], [2,3], [3,1]] > > oops, my bad. > > > > > needs "if first == second: continue" here > > > >

Re: Python, Matlab and AI question

2005-02-18 Thread Alexander Schmolck
Robert Kern <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > >> Actually, I've written a highlevel matlab-python bridge (based on bugfixed >> and >> slightly extended version of the original pymat) which is quite up-to-date; >> by >> and large it makes using matlab from python as easy a

www.bidfraud.com "Grand Opening" -- Read Inside for capabilities

2005-02-18 Thread bidfraud
www.bidfraud.com "Grand Opening" -- Read Inside for capabilities After 1000 plus hours in development - Bidfraud.com is "breathing." http://www.bidfraud.com Features: Capable of archiving ebay auction transactions locally on our server. This is important, as ebay deletes transactions every few

Re: [perl-python] exercise: partition a list by equivalence

2005-02-18 Thread Brian Beck
Xah Lee wrote: merge($pairings) takes a list of pairs, each pair indicates the sameness of the two indexes. Returns a partitioned list of same indexes. For example, if the input is merge( [ [1,2], [2,4], [5,6] ] ); that means 1 and 2 are the same. 2 and 4 are the same. Therefore 1==2==4. The result

Re: [perl-python] exercise: partition a list by equivalence

2005-02-18 Thread Brian Beck
Brian Beck wrote: > [code] Whoops, that should say: def merge(pairs): pairs = set(tuple(sorted(p)) for p in pairs) merged = [] # Each loop will result in a new, complete sublist in the result. while pairs: p = set(pairs.pop()) remove = set([]) for pair in pai

Re: [perl-python] exercise: partition a list by equivalence

2005-02-18 Thread Brian Beck
Brian Beck wrote: Brian Beck wrote: > [code] Ah heck, nevermind... it worked for my small test cases but the algorithm is just wrong. -- Brian Beck Adventurer of the First Order -- http://mail.python.org/mailman/listinfo/python-list

Can I get message filename from a Maildir mailbox stream?

2005-02-18 Thread noah
Is there a way to figure out what filename an email object points to in a qmail style Maildir directory? Hmmm... I don't think so, but I'm hoping I wrong. I instantiated a Maildir mailbox and I'm iterating through the messages. When I find a special message I want to move it or delete it or somet

Matplotlib, py2exe and pytz

2005-02-18 Thread scott
I am trying to convert a python app that uses matplotlib to a standalone executable using py2exe. After running py2exe and executing my app I get the following stack trace: Traceback (most recent call last): File "gcToCsv.py", line 5, in ? File "plot_output.pyc", line 1, in ? File "pylab.py

Re: Trouble with mysql-python 1.2.0 on Solaris 8 sparc

2005-02-18 Thread Michael Hoffman
Alec Wysoker wrote: I need to be able to access mySQL 4.0 and 4.1 databases from python. I was hoping to find mysql-python 1.2.0 already built for Sparc, but no such luck. Try version 1.0.1. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: exercise: partition a list by equivalence

2005-02-18 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "John Machin" <[EMAIL PROTECTED]> wrote: > You don't need to think. This problem has been extensively picked over > by folk who are a lot smarter than us, starting from 30 years ago. > Google for "disjoint set" and "union-find". One gets the impression > that the b

Report

2005-02-18 Thread herring
Your message was not delivered due to the following reason: Your message was not delivered because the destination server was not reachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there

Re: [perl-python] exercise: partition a list by equivalence

2005-02-18 Thread Brian Beck
Well, it looks like David posted a good solution, but I haven't tested it (I'm assuming his works fine). I fixed mine up anyway... it actually works now. If you're not using 2.4 you'll have to import sets.Set as set. def merge(pairList): pairList = set(tuple(sorted(p)) for p in pairList)

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Lenton
On Fri, Feb 18, 2005 at 04:52:46PM -0800, John Machin wrote: > > > needs "if rev[first] == rev[second]: continue" here > > > > an 'is' is enough, and better. > > Good point. You're redeeming yourself :-) this, together with you saying that it is hard to explain, makes me think that you aren't com

Re: unicode and socket

2005-02-18 Thread zyqnews
It's really funny, I cannot send a unicode stream throuth socket with python while all the other languages as perl,c and java can do it. then, how about converting the unicode string to a binary stream? It is possible to send a binary through socket with python? -- http://mail.python.org/mailman/

Re: exercise: partition a list by equivalence

2005-02-18 Thread David Eppstein
In article <[EMAIL PROTECTED]>, David Eppstein <[EMAIL PROTECTED]> wrote: > It can be solved by union-find > (e.g. with UnionFind from ): Here's a cleaned up version, after I added a proper iter() method to the UnionFind data structure: import UnionFind

Re: Probably over my head... Trying to get Font Names

2005-02-18 Thread Samantha
Thank you Pierre, that worked. I am still going to try and get the TTFQuery+Fonttools to work just out of curiosity. Thanks again to everyone!!! S "Pierre Quentel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Samantha" <[EMAIL PROTECTED]> wrote in message > news:<[EMAIL PROTEC

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-18 Thread ? the Platypus {aka David Formosa}
Ilias Lazaridis <[EMAIL PROTECTED]> writes: > Duncan Booth wrote: [...] > > It is GPL licensed with an amendment which prevents the GPL > > spreading to other open source software with which it is linked. > > "In accordance with section 10 of the GPL, Red Hat, Inc. permits > > programs whose sour

newbie question on python 2.4 and tkinter

2005-02-18 Thread David Joyner
Hi: I'm trying to compile python 2.4 with tkinter. (I'm trying to write a gui interface which calls a program called GAP - I'm hoping to use subprocess, a python 2.4 module, since I was getting deadlocks using popen). The instructions at the python web site said basically to edit the /Modules/Setup

Re: xmlrpc.server.work() does not seem to handle multiple requests

2005-02-18 Thread Adonis
john14 wrote: Hi, I have an xmlrpc server. I using the python package xmlrpc. Here is what I am doing: s = xmlrpc.server() s.addMethods(method_hash) s.bindAndListen(PORT) while 1: try: s.work() except: e = sys.exc_info() The problem is that wh

Re: Variables.

2005-02-18 Thread Terry Hancock
On Wednesday 16 February 2005 03:34 am, administrata wrote: > sry, I mean the problem is... about lining > > it doesn't look like this... > > Allen woke up early in the morning. But, it was unusal by Allen. > Allen's pillow was with Allen. Allen didn't want to wake up But, Allen > tried my best a

Re: Test for structure

2005-02-18 Thread Terry Hancock
On Wednesday 16 February 2005 09:08 am, alex wrote: > how can I check if a variable is a structure (i.e. a list)? For my > special problem the variable is either a character string OR a list of > character strings line ['word1', 'word2',...] > > So how can I test if a variable 'a' is either a sing

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Machin
John Lenton wrote: > On Fri, Feb 18, 2005 at 04:52:46PM -0800, John Machin wrote: > > > > needs "if rev[first] == rev[second]: continue" here > > > > > > an 'is' is enough, and better. > > > > Good point. You're redeeming yourself :-) > > this, together with you saying that it is hard to explain,

Re: combining several lambda equations

2005-02-18 Thread Paddy
Steve, Thanks for the info but I do know about that.. What I am doing is taking a set of inputted functions that don't take arguments and programmatically analysing them and combining them to create new functions that are further analysed. During testing I keep the numbers low, and am only dealing

Re: exercise: partition a list by equivalence

2005-02-18 Thread John Lenton
On Fri, Feb 18, 2005 at 09:57:59PM -0800, John Machin wrote: > > > > this, together with you saying that it is hard to explain, makes me > > think that you aren't comfortable thinking of lists as mutable > > objects. > > How so? There is no connection between is/== and mutability. Let me > amplify

Re: Chart Director?

2005-02-18 Thread Vincent Wehren
[EMAIL PROTECTED] wrote: Does anyone here have experience with Chart Director (http://www.advsofteng.com/index.html)? I'm thinking about purchasing it and looking for any feedback from the Python community. Thanks Since ChartDirector is not exactly open source nor found its origin in a Python s

lambda closure question

2005-02-18 Thread Ted Lilley
What I want to do is pre-load functions with arguments by iterating through a list like so: >>>class myclass: ...pass >>>def func(self, arg): ...print arg >>>mylist = ["my", "sample", "list"] >>>for item in mylist: ...setattr(myclass, item, lamdba self: func(self, item)) This attaches

<    1   2