Re: Why and how there is only one way to do something?

2005-12-15 Thread John Hazen
* Chris Mellon [EMAIL PROTECTED] [2005-12-15 06:09]: (Am I dating myself? Do teenagers still put studs on their jackets?) No. They put studs in their lips, tongues, eyebrows, navels, and sexual organs. Oh, and ears. (How quaint.) -- http://mail.python.org/mailman/listinfo/python-list

regexp non-greedy matching bug?

2005-12-03 Thread John Hazen
I want to match one or two instances of a pattern in a string. According to the docs for the 're' module ( http://python.org/doc/current/lib/re-syntax.html ) the '?' qualifier is greedy by default, and adding a '?' after a qualifier makes it non-greedy. The *, +, and ? qualifiers are all

Re: regexp non-greedy matching bug?

2005-12-03 Thread John Hazen
[John Hazen] I want to match one or two instances of a pattern in a string. s = 'foobarbazfoobar' foofoo = re.compile(r'^(foo)(.*?)(foo)?(.*?)$') foofoo.match(s).group(1) 'foo' foofoo.match(s).group(3) [Tim Peters] Your problem isn't that (foo)? is not greedy

Re: regexp non-greedy matching bug?

2005-12-03 Thread John Hazen
[Mike Meyer] The thing to understand is that regular expressions are *search* functions, that return the first parsing that matches. They search a space of possible matches to each term in the expression. If some term fails to match, the preceeding term goes on to its next match, and you try

Re: Background process for ssh port forwarding

2005-10-04 Thread John Hazen
Hi Jesse- def hostforward(): #This is based on the assumption that the passfile is the gnus #authinfo file, or has a similar format... f = open(PASS_FILE, r) f_list = f.read().split(' ') f.close() #Now, we get the entry after password (be slicker to make it a

Re: Struggling with this concept please help

2005-09-26 Thread John Hazen
* George [EMAIL PROTECTED] [2005-09-25 16:20]: Hello everyone I know many have helped but I cannot get this to work out correctly. snip Please help I have never done python before and I can't seem to get the hang of it. You posted code. Is what's in the docstring actual output? If so, what

Re: How am I doing?

2005-09-19 Thread John Hazen
* Jason [EMAIL PROTECTED] [2005-09-19 16:28]: I've restructured my code with the assistance of George and Mike which is now as follows... import random class HiScores: def __init__(self,hiScores): self.hiScores=[(entry[:5],entry[5:]) for entry in hiScores] With your

Re: Sockets: code works locally but fails over LAN

2005-09-01 Thread John Hazen
* n00m [EMAIL PROTECTED] [2005-08-31 05:45]: import socket, thread host, port = '192.168.0.3', 1434 s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect((host, 1433)) s1.bind((host, port)) I think the problem is that you're

Re: To the python-list moderator

2005-08-31 Thread John Hazen
This is probably a fairly bad way of contacting the python-list admins... Perhaps. Feel free to forward if you know a better way. I tried sending a question to [EMAIL PROTECTED], and got another 'don't call us, we'll maybe call you'. Maybe [EMAIL PROTECTED] But public posting allows

Re: Why is this?

2005-08-11 Thread John Hazen
[[]]*2 [[], []] [[], []] == [[]]*2 True Same effect. But try the 'is' operator, to see if they are actually the same instances of 'empty list': [[], []] is [[]]*2 True Just curious, did you actually cut and paste this from a real interactive session? (I think not.) My

Re: subscribe

2005-07-26 Thread John Hazen
* Brian Lee [EMAIL PROTECTED] [2005-07-26 06:34]: Subscribe OK. You're now subscribed to thousands of spam lists. Congratulations! ;) You can subscribe to the python-list here: http://mail.python.org/mailman/listinfo/python-list Good luck- John --

Re: socket programming

2005-07-19 Thread John Hazen
* Helge Aksdal [EMAIL PROTECTED] [2005-07-19 11:23]: if i then change to a console window, and telnet to this server it sends me to another one. That's probably why my program dies, how can i get my code to handle this? Trying xxx.xxx.xxx.xxx telnet: connect to address xxx.xxx.xxx.xxx:

Re: Python Programming Contest

2005-07-17 Thread John Hazen
* Brian Quinlan [EMAIL PROTECTED] [2005-07-15 02:08]: You can find the first problem here: http://www.sweetapp.com/pycontest/contest1 I have one question about the problem. Is the cost we are to minimize the cost of arriving in the target city at all, or the cost of arriving at the target

Re: poker card game revisited (code included)

2005-06-08 Thread John Hazen
[Erik Max Francis] Searching for straights and flushes is much better done by masks. Interesting. I've been thinking about playing with this stuff too, but hadn't considered masks. So each card has a representation: n bits for rank, then m bits for suit. 10 0001 = 2 clubs

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread John Hazen
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2005-05-02 05:10]: Any hints on level 6 ? There is zip in the page source, ZIp in the image data, but have no clue what to do with them - tried many things :). Have you found the zip file yet? (I did, and I still can't figure it out. I'm wondering if

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread John Hazen
* Reinhold Birkenfeld [EMAIL PROTECTED] [2005-05-02 06:19]: John Hazen wrote: Have you found the zip file yet? (I did, and I still can't figure it out) It's best when you use the zipfile module. Cool. I had just unzipped the zipfile, and was looking at the files directly

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread John Hazen
* Dan Bishop [EMAIL PROTECTED] [2005-05-02 21:09]: Dan Christensen wrote: Reinhold Birkenfeld [EMAIL PROTECTED] writes: Dan Christensen wrote: Roel Schroeven [EMAIL PROTECTED] writes: There's no level 12 yet though. Now there's a 12 and a 13 (at least!). Anyone solved

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 11)

2005-04-14 Thread John Hazen
* Dave Brueck [EMAIL PROTECTED] [2005-04-14 07:49]: [Roel Schroeven] Not that it really matters, but does anybody know why the weekly Python news always arrives twice? Does it only happen to me, or does it happen to others too? It's not that it irritates me or anything, I'm just being