Re: socket read timeout

2007-03-29 Thread Hendrik van Rooyen
[EMAIL PROTECTED] wrote: hg My issue with that is the effect on write: I only want a timeout on hg read ... but anyway ... So set a long timeout when you want to write and short timeout when you want to read. Are sockets full duplex? I know Ethernet isn't. - Hendrik --

Re: Mastering Python

2007-03-29 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Wed, 28 Mar 2007 07:55:20 +0200, Hendrik van Rooyen [EMAIL PROTECTED] declaimed the following in comp.lang.python: Pretty obvious of course, as is the pronounciation of the name: Cholmondely Is that a scottish Ch (as in LoCH Lomond),

Re: which methods to use?

2007-03-29 Thread s99999999s2003
On Mar 29, 12:56 pm, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 28 Mar 2007 18:16:31 -0700, ss2003 wrote: what do you mean by create new object when using list comprehensoin or list()? Does using slicing create a new object as well? Yes it does. alist = [1, 2, 4, 8, 16]

Re: which methods to use?

2007-03-29 Thread Alex Martelli
Steven D'Aprano [EMAIL PROTECTED] wrote: ... In general: - use a list comprehension when you need to calculate the list items - use slicing when you are copying an actual list, or if you don't care what type of object you get - use the list() function when your existing object might

Re: Finding User Profile path

2007-03-29 Thread Tim Golden
[EMAIL PROTECTED] wrote: Hi, I am trying to query our domain to get a list of our users profile locations. I thought I might be able to use WMI, but I can't get it to work. Can you be a bit more specific: did WMI itself not work? Or the Python WMI module? What were the problems? (All this,

Re: which methods to use?

2007-03-29 Thread Alex Martelli
[EMAIL PROTECTED] wrote: ... under what circumstances do we need to create a copy of a tuple :- btuple = atuple[:]. tuples are immutable, so wouldn't it be wasting memory? Nah -- btuple is atuple. The copy is a no-op, in this case. another query, in the docs, list(a) and a[:] does the

Re: Modal value of an array

2007-03-29 Thread Alex Martelli
Ben Finney [EMAIL PROTECTED] wrote: ... That's not the only case though. What do you expect to be returned for an input of [eggs, beans, beans, eggs, spam] ? Assuming you want *a* mode value, and any one will do (e.g. any of spam, eggs or beans is okay), I'd write it this way as a first

Re: gmpy floating point exception

2007-03-29 Thread Alex Martelli
Martin Manns [EMAIL PROTECTED] wrote: Hi, I am experiencing some trouble with gmpy v1.01. Multiplying an mpq with inf results in a floating point exception that exits python. Has this already been fixed in newer gmpy versions? No, I can reproduce the problem (on a Mac with an Intel CPU)

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread Duncan Booth
John Nagle [EMAIL PROTECTED] wrote: Strictly speaking, it's Microsoft's fault. title=!--http://www.microsoft.com/usability/information.mspx- is supposed to be an HTML comment. But it's improperly terminated. It should end with --. So all that following stuff is from what follows

Re: Hpw make lists that are easy to sort.

2007-03-29 Thread Anton Vredegoor
Terry Reedy wrote: If I understand correctly, you want to multiiply each of m numbers by each of n numbers, giving m*n products. That is O(m*n) work. Inserting (and extracting) each of these is a constant size m priority cue takes, I believe, O(log(m)) work, for a total of m*n*log(m).

Re: with timeout(...):

2007-03-29 Thread Hendrik van Rooyen
Nick Craig-Wood [EMAIL PROTECTED] wrote: Well, yes there are different levels of potential reliability with different implementation strategies for each! Gadzooks! Foiled again by the horses for courses argument. ; - ) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: with timeout(...):

2007-03-29 Thread Diez B. Roggisch
I beleive the convention is when calling an OS function which might block the global interpreter lock is dropped, thus allowing other python bytecode to run. So what? That doesn't help you, as you are single-threaded here. The released lock won't prevent the called C-code from taking as

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread Justin Ezequiel
On Mar 29, 4:08 pm, Duncan Booth [EMAIL PROTECTED] wrote: John Nagle [EMAIL PROTECTED] wrote: title=!--http://www.microsoft.com/usability/information.mspx- is supposed to be an HTML comment. But it's improperly terminated. It is an attribute value, and unescaped angle brackets are

Re: which methods to use?

2007-03-29 Thread Florian Leitner
* Alex Martelli wrote, On 3/29/07 9:46 AM: [EMAIL PROTECTED] wrote: another query, in the docs, list(a) and a[:] does the same thing (a = [1,2,3] for example), but besides the speed of slicing is faster than list(), what advantage is there for using list(a) in this case ? Readability (a

Re: PyPy 1.0: JIT compilers for free and more

2007-03-29 Thread Robin Becker
Christian Tismer wrote: ... something special, I am unable to dream of? Or is it purely academic project to create Python VM in Python? It will eventually give you a GIL-free VM, and it already gives you a lot more than you have dreamt of. There is one feature missing that is

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread Justin Ezequiel
On Mar 29, 6:11 pm, Justin Ezequiel [EMAIL PROTECTED] wrote: FWIW, seehttp://tinyurl.com/yjtzjz hmm. not quite right. http://tinyurl.com/ynv4ct or http://www.crummy.com/software/BeautifulSoup/documentation.html#Customizing%20the%20Parser --

YouTube showing repr() of a tuple

2007-03-29 Thread Leif K-Brooks
Thought this might amuse some of you: http://youtube.com/results?search_query=korect+my+speling I'd heard that YouTube uses Python, but it's fun to see proof of that, even if it comes in the form of a minor bug. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about extending tuple

2007-03-29 Thread abcd
I hope you see now why it is consistent. Georg yea that clears it up. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: with timeout(...):

2007-03-29 Thread Nick Craig-Wood
Hendrik van Rooyen [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: Well, yes there are different levels of potential reliability with different implementation strategies for each! Gadzooks! Foiled again by the horses for courses argument. ; - ) ;-) I'd like

Re: newbi question on python rpc server, how it works?

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 11:25:38 +0530, krishnakant Mane [EMAIL PROTECTED] wrote: hello all, I have downloaded the entire twisted library. I am also trying to read the documentation but I have a couple of problems right now. firstly, I did not find any thing in twisted documentation that

Re: socket read timeout

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 07:29:35 +0200, Hendrik van Rooyen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: hg My issue with that is the effect on write: I only want a timeout on hg read ... but anyway ... So set a long timeout when you want to write and short timeout when you want

Weird behavior in search in a list

2007-03-29 Thread Su Y
hi all, I can't understand how this code work, its behavior is really weird for me... I want find the first number in extend[] which is larger than num, so I wrote: def find(num): count=0 for elem in extend: if elemnum: count+=1 return count I found that if

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread Duncan Booth
Justin Ezequiel [EMAIL PROTECTED] wrote: On Mar 29, 4:08 pm, Duncan Booth [EMAIL PROTECTED] wrote: John Nagle [EMAIL PROTECTED] wrote: title=!--http://www.microsoft.com/usability/information.mspx- is supposed to be an HTML comment. But it's improperly terminated. It is an attribute

Re: Weird behavior in search in a list

2007-03-29 Thread Su Y
On 3月29日, 下午7时51分, Su Y [EMAIL PROTECTED] wrote: hi all, I can't understand how this code work, its behavior is really weird for me... I want find the first number in extend[] which is larger than num, soI wrote: def find(num): count=0 for elem in extend: if elemnum:

Re: PyPy 1.0: JIT compilers for free and more

2007-03-29 Thread Duncan Booth
Robin Becker [EMAIL PROTECTED] wrote: I am hugely encouraged by this C:\Python\devel\pypy-1.0.0\python24\python \python\lib\test \pystone.py Pystone(1.1) time for 5 passes = 1.49586 This machine benchmarks at 33425.6 pystones/second C:\Python\devel\pypy-1.0.0.\pypy-c.exe

Re: Weird behavior in search in a list

2007-03-29 Thread Amit Khemka
On 29 Mar 2007 04:51:00 -0700, Su Y [EMAIL PROTECTED] wrote: hi all, I can't understand how this code work, its behavior is really weird for me... I want find the first number in extend[] which is larger than num, so I wrote: def find(num): count=0 for elem in extend: if

Re: Weird behavior in search in a list

2007-03-29 Thread Amit Khemka
On 29 Mar 2007 04:51:00 -0700, Su Y [EMAIL PROTECTED] wrote: snip I want find the first number in extend[] which is larger than num, so snip On 3/29/07, Amit Khemka [EMAIL PROTECTED] wrote: Btw a concise way could be: def getfirstbigger(num): for i,x in enumerate(extend): if

Re: Python automatic testing: mocking an imported module?

2007-03-29 Thread [EMAIL PROTECTED]
On Mar 27, 9:13 pm, Chris Lasher [EMAIL PROTECTED] wrote: On Mar 27, 6:18 pm, Silfheed [EMAIL PROTECTED] wrote: Heyas So we have the following situation: we have a testee.py that we want to automatically test out and verifiy that it is worthy of being deployed. We want our tester.py to

Re: Weird behavior in search in a list

2007-03-29 Thread Josh
Su Y [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3ÔÂ29ÈÕ, ÏÂÎç7ʱ51·Ö, Su Y [EMAIL PROTECTED] wrote: hi all, I can't understand how this code work, its behavior is really weird for me... I want find the first number in extend[] which is larger than num, soI wrote: def

Re: Weird behavior in search in a list

2007-03-29 Thread Michael Bentley
On Mar 29, 2007, at 6:51 AM, Su Y wrote: I want find the first number in extend[] which is larger than num, so I wrote: def find(num): count=0 for elem in extend: if elemnum: count+=1 return count I found that if extend[] is monotonous, like [1.1, 2.3,

Re: Weird behavior in search in a list

2007-03-29 Thread Amit Khemka
On 3/29/07, Michael Bentley [EMAIL PROTECTED] wrote: On Mar 29, 2007, at 6:51 AM, Su Y wrote: I want find the first number in extend[] which is larger than num, so snip def find(num): # check to make sure there *is* a value greater than num if max(extend) num:

Re: Weird behavior in search in a list

2007-03-29 Thread Su Y
On 3月29日, 下午8时22分, Michael Bentley [EMAIL PROTECTED] wrote: On Mar 29, 2007, at 6:51 AM, Su Y wrote: I want find the first number in extend[] which is larger than num, so I wrote: def find(num): count=0 for elem in extend: if elemnum: count+=1

Re: PDB does not allow jumping to first statement?

2007-03-29 Thread [EMAIL PROTECTED]
On Mar 28, 6:05 pm, Chris Lasher [EMAIL PROTECTED] wrote: I have submitted this as a bug via SourceForge: https://sourceforge.net/tracker/? func=detailatid=105470aid=1689458group_id=5470 or if munged http://tinyurl.com/2nwxsf ThePythonfolks would like a test case and/or a patch. This is

Re: Long way around UnicodeDecodeError, or 'ascii' codec can't decode byte

2007-03-29 Thread Paul Boddie
On 29 Mar, 06:26, Oleg Parashchenko [EMAIL PROTECTED] wrote: Hello, I'm working on an unicode-aware application. I like to use print to debug programs, but in this case it was nightmare. The most popular result of print was: UnicodeDecodeError: 'ascii' codec can't decode byte 0xXX in

Re: Finding User Profile path

2007-03-29 Thread kyosohma
On Mar 29, 2:50 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, I am trying to query our domain to get a list of our users profile locations. I thought I might be able to use WMI, but I can't get it to work. Can you be a bit more specific: did WMI itself not work?

Re: Modal value of an array

2007-03-29 Thread bearophileHUGS
Alex Martelli: foo = [spam, eggs, spam, spam, spam, beans, eggs] max(foo, key=foo.count) It's a very nice solution, the shortest too. But I think it's better to develop your own well tested and efficient stats module (and there is one already done that can be found around) and import it when

Weird gcc behaviour with function pointer types

2007-03-29 Thread greg
In my quest to eliminate C compiler warnings from Pyrex output, I've discovered some utterly bizarre behaviour from gcc 3.3. The following code: void g(struct foo *x) { } void f(void) { void (*h)(struct foo *); h = g; } produces the following warning: blarg.c: In

Re: YouTube showing repr() of a tuple

2007-03-29 Thread Daniel Nogradi
Thought this might amuse some of you: http://youtube.com/results?search_query=korect+my+speling I'd heard that YouTube uses Python, but it's fun to see proof of that, even if it comes in the form of a minor bug. But their web frontend is (probably) in php:

Re: how can I clear a dictionary in python

2007-03-29 Thread Larry Bates
Aahz wrote: In article [EMAIL PROTECTED], Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I create a dictionary like this myDict = {} and I add entry like this: myDict['a'] = 1 but how can I empty the whole dictionary? just point myDict to an empty dictionary again

Re: Finding User Profile path

2007-03-29 Thread Tim Golden
[EMAIL PROTECTED] wrote: One of my co-workers thought I could do something like this: c = wmi.WMI() for i in c.Win32_UserAccount(Name=user): # Get user paths somehow. I messed around with that, but I think he was mistaken. It has lots of good info, but not what I need. I

Problem with class variables

2007-03-29 Thread Dag
I have a problem which is probaly very simple to solve, but I can't find a nice solution. I have the following code class Test: def __init__(self): self.a=[1,2,3,4] self.b=self.a def swap(self): self.a[0],self.a[3]=self.a[3],self.a[0] def prnt(self):

gettext files manager

2007-03-29 Thread [EMAIL PROTECTED]
Does anyone know if Python gettext module or something else in Python can manage po/mo files - list all strings from po/mo, show untranslated, fuzzy strings ? I need something like that for a translations manager :) -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib timeout issues

2007-03-29 Thread supercooper
On Mar 27, 4:50 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 27 Mar 2007 17:41:44 -0300, supercooper [EMAIL PROTECTED] escribió: On Mar 27, 3:13 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Tue, 27 Mar 2007 16:21:55 -0300, supercooper [EMAIL PROTECTED] escribió: I

Re: Problem with class variables

2007-03-29 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Dag wrote: I have a problem which is probaly very simple to solve, but I can't find a nice solution. I have the following code class Test: def __init__(self): self.a=[1,2,3,4] self.b=self.a self.b = list(self.a) BTW this is about

Re: Finding User Profile path

2007-03-29 Thread kyosohma
On Mar 29, 8:23 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: One of my co-workers thought I could do something like this: c = wmi.WMI() for i in c.Win32_UserAccount(Name=user): # Get user paths somehow. I messed around with that, but I think he was mistaken.

Re: Problem with class variables

2007-03-29 Thread kyosohma
On Mar 29, 8:43 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], Dag wrote: I have a problem which is probaly very simple to solve, but I can't find a nice solution. I have the following code class Test: def __init__(self): self.a=[1,2,3,4]

Re: Finding User Profile path

2007-03-29 Thread Tim Golden
[EMAIL PROTECTED] wrote: On Mar 29, 8:23 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: One of my co-workers thought I could do something like this: c = wmi.WMI() for i in c.Win32_UserAccount(Name=user): # Get user paths somehow. I messed around with that, but I think

Re: upgrading python (and other modules)

2007-03-29 Thread kyosohma
On Mar 29, 1:14 am, Astan Chee [EMAIL PROTECTED] wrote: Forget I asked this question. I've solved it using wxPython 2.6.3.3 Cheers Astan Chee wrote: Hi, I was once using python 2.4 in win2k with wxPython 2.4.2.4 (if im not mistaken) with it. Now i've upgraded to winXP and am using

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread Paul McGuire
On Mar 29, 1:50 am, John Nagle [EMAIL PROTECTED] wrote: Here's a construct with which BeautifulSoup has problems. It's from http://support.microsoft.com/contactussupport/?ws=support;. This is the original: a href=http://www.microsoft.com/usability/enroll.mspx; id=L_75998

Re: Problem with class variables

2007-03-29 Thread Thomas Krüger
Dag schrieb: I have a problem which is probaly very simple to solve, but I can't find a nice solution. I have the following code class Test: def __init__(self): self.a=[1,2,3,4] self.b=self.a def swap(self): self.a[0],self.a[3]=self.a[3],self.a[0]

Re: YouTube showing repr() of a tuple

2007-03-29 Thread Leif K-Brooks
Leif K-Brooks wrote: Thought this might amuse some of you: http://youtube.com/results?search_query=korect+my+speling Better example: http://youtube.com/results?search_query=korect+my+speling%C2%A1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding User Profile path

2007-03-29 Thread kyosohma
On Mar 29, 9:05 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Mar 29, 8:23 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: One of my co-workers thought I could do something like this: c = wmi.WMI() for i in c.Win32_UserAccount(Name=user): #

Re: Creating a new data structure while filtering its data origin.

2007-03-29 Thread FlipFish2007
On Mar 28, 4:44 pm, [EMAIL PROTECTED] wrote: Hi everyone. I'm trying to work with very simple data structures but I'm stuck in the very first steps. If someone has the luxury of a few minutes and can give an advice how to resolve this, I'll really appreciate it. 1- I have a list of tuples

make RE more cleaver to avoid inappropriate : sre_constants.error: redefinition of group name

2007-03-29 Thread aspineux
I want to parse '[EMAIL PROTECTED]' or '[EMAIL PROTECTED]' and get the email address [EMAIL PROTECTED] the regex is r'[EMAIL PROTECTED]|[EMAIL PROTECTED]' now, I want to give it a name r'(?Pemail[EMAIL PROTECTED])|(?Pemail[EMAIL PROTECTED])' sre_constants.error: redefinition of group name

A nice way to use regex for complicate parsing

2007-03-29 Thread aspineux
My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests=[ 'MAIL FROM:[EMAIL PROTECTED]', 'MAIL FROM:[EMAIL PROTECTED]', 'MAIL FROM:[EMAIL PROTECTED]

Islam, the Religion of Ease

2007-03-29 Thread moslim
Excuse me!! Would you stop for a moment?! O...man...Haven't you thought-one day- about yourself ? Who has made it? Have you seen a design which hasn't a designer ?! Have you seen a wonderful,delicate work without a worker ?! It's you and the whole universe!.. Who has made them all ?!! You know who

Re: how can I clear a dictionary in python

2007-03-29 Thread Bruno Desthuilliers
Larry Bates a écrit : Aahz wrote: In article [EMAIL PROTECTED], Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I create a dictionary like this myDict = {} and I add entry like this: myDict['a'] = 1 but how can I empty the whole dictionary? just point myDict to an empty

Re: A nice way to use regex for complicate parsing

2007-03-29 Thread Shane Geiger
It would be worth learning pyparsing to do this. aspineux wrote: My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests=[ 'MAIL FROM:[EMAIL PROTECTED]',

Re: Why doesnt __getattr__ with decorator dont call __get_method in decorator

2007-03-29 Thread glomde
To get python to run the __get__ method I think you have to call __getattr__ explicitly: a.__getattr__('test') If you do: a.test python follows a different routine: it checks for the existence of the attribute, then check if there is a __getattr__ attribute. Now the speculative bit: then

Re: XML/encoding/prolog/python hell...

2007-03-29 Thread fscked
Here is what I currently have. Still missing prolog information and namespace info. Encoding is irritating me also. :) import os,sys import csv from elementtree.ElementTree import Element, SubElement, ElementTree, tostring def indent(elem, level=0): i = \n + level* if len(elem):

What are OOP's Jargons and Complexities

2007-03-29 Thread Xah Lee
What are OOP's Jargons and Complexities Xah Lee, 20050128 Classes, Methods, Objects In computer languages, often a function definition looks like this: subroutine f (x1, x2, ...) { variables ... do this or that } In advanced languages such as LISP family, it is not uncommon to define

inf class (was: gmpy floating point exception)

2007-03-29 Thread Martin Manns
On Thu, 29 Mar 2007 00:57:03 -0700 [EMAIL PROTECTED] (Alex Martelli) wrote: Martin Manns [EMAIL PROTECTED] wrote: 2) Is there any inf type around with a + inf == inf inf a (as long as a != inf) etc. that works with any other type? You mean something like: class inf(object):

Re: make RE more cleaver to avoid inappropriate : sre_constants.error: redefinition of group name

2007-03-29 Thread attn . steven . kuo
On Mar 29, 7:22 am, aspineux [EMAIL PROTECTED] wrote: I want to parse '[EMAIL PROTECTED]' or '[EMAIL PROTECTED]' and get the email address [EMAIL PROTECTED] the regex is r'[EMAIL PROTECTED]|[EMAIL PROTECTED]' now, I want to give it a name r'(?Pemail[EMAIL PROTECTED])|(?Pemail[EMAIL

What is the timeout value of HTTP

2007-03-29 Thread ken
Can you please tell me what is the timeout value of httplib.HTTP? i.e. how long python will wait for a response in the below code? h = httplib.HTTP(self.url, 8080) h.putrequest('GET', '/sample/?url=' + self.url) h.endheaders() Thank you. --

Re: Creating a new data structure while filtering its data origin.

2007-03-29 Thread attn . steven . kuo
On Mar 28, 1:44 pm, [EMAIL PROTECTED] wrote: Hi everyone. I'm trying to work with very simple data structures but I'm stuck in the very first steps. If someone has the luxury of a few minutes and can give an advice how to resolve this, I'll really appreciate it. 1- I have a list of tuples

Re: Finding User Profile path

2007-03-29 Thread Tim Golden
[resending as the original seems to have got lost; apologies if it appears as a duplicate] At the risk of insulting your intelligence, here's a rough-and-ready non-AD solution (culled from some code I had somewhere): code import win32net import win32netcon dc = win32net.NetGetAnyDCName (None,

Re: What is the timeout value of HTTP

2007-03-29 Thread Alex Martelli
ken [EMAIL PROTECTED] wrote: Can you please tell me what is the timeout value of httplib.HTTP? i.e. how long python will wait for a response in the below code? h = httplib.HTTP(self.url, 8080) h.putrequest('GET', '/sample/?url=' + self.url) h.endheaders() HTTP per se

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Alex Martelli
Joshua J. Kugler [EMAIL PROTECTED] wrote: still be nicely portable. It just seems that since Python is gathering that information anyway, it should make it available without me having to walk the directory tree. Sorry, where is Python gathering that information anyway? Unless I'm mistaken,

Re: A nice way to use regex for complicate parsing

2007-03-29 Thread Paul McGuire
On Mar 29, 9:42 am, Shane Geiger [EMAIL PROTECTED] wrote: It would be worth learning pyparsing to do this. Thanks to Shane and Steven for the ref to pyparsing. I also was struck by this post, thinking this is pyparsing written in re's and dicts. The approach you are taking is *very* much like

Re: manually implementing staticmethod()?

2007-03-29 Thread Alex Martelli
7stud [EMAIL PROTECTED] wrote: Hi, Can someone show me how to manually implement staticmethod()? Here is Simplest way: class smethod(object): def __init__(self, f): self.f=f def __call__(self, *a, **k): return self.f(*a, **k) Alex --

File deletion after 72 hours of creation

2007-03-29 Thread [EMAIL PROTECTED]
I'm looking for a simple method to delete a folder after 72 Business hours (saturday/sunday doesnt count) since its creation. Note that This is on a linux system and I realize that it will be the last modified time. These files wont be modified since their creation. Im very confused on how to

Re: Weird gcc behaviour with function pointer types

2007-03-29 Thread attn . steven . kuo
On Mar 29, 6:05 am, greg [EMAIL PROTECTED] wrote: In my quest to eliminate C compiler warnings from Pyrex output, I've discovered some utterly bizarre behaviour from gcc 3.3. The following code: void g(struct foo *x) { } void f(void) { void (*h)(struct foo *); h = g;

Re: make RE more cleaver to avoid inappropriate : sre_constants.error: redefinition of group name

2007-03-29 Thread aspineux
On 29 mar, 16:22, aspineux [EMAIL PROTECTED] wrote: I want to parse '[EMAIL PROTECTED]' or '[EMAIL PROTECTED]' and get the email address [EMAIL PROTECTED] the regex is r'[EMAIL PROTECTED]|[EMAIL PROTECTED]' now, if I want to give it a name r'(?Pemail[EMAIL PROTECTED])|(?Pemail[EMAIL

Re: pattern search

2007-03-29 Thread Fabian Braennstroem
Hi Paul, Paul McGuire schrieb am 03/27/2007 07:19 PM: On Mar 27, 3:13 pm, Fabian Braennstroem [EMAIL PROTECTED] wrote: Hi to all, Wojciech Mu?a schrieb am 03/27/2007 03:34 PM: Fabian Braennstroem wrote: Now, I would like to improve it by searching for different 'real' patterns just like

Re: File deletion after 72 hours of creation

2007-03-29 Thread skip
Alex I'm looking for a simple method to delete a folder after 72 Alex Business hours (saturday/sunday doesnt count) since its Alex creation. Note that This is on a linux system and I realize that Alex it will be the last modified time. These files wont be modified Alex since

Re: Finding User Profile path

2007-03-29 Thread kyosohma
On Mar 29, 10:30 am, Tim Golden [EMAIL PROTECTED] wrote: [resending as the original seems to have got lost; apologies if it appears as a duplicate] At the risk of insulting your intelligence, here's a rough-and-ready non-AD solution (culled from some code I had somewhere): code import

Re: PyPy 1.0: JIT compilers for free and more

2007-03-29 Thread Bart Ogryczak
On 28 mar, 23:36, Jarek Zgoda [EMAIL PROTECTED] wrote: Carl Friedrich Bolz napisa³(a): Welcome to the PyPy 1.0 release - a milestone integrating the results of four years of research, engineering, management and sprinting efforts, concluding the 28 months phase of EU co-funding! So it

Re: with timeout(...):

2007-03-29 Thread Nick Craig-Wood
Diez B. Roggisch [EMAIL PROTECTED] wrote: I beleive the convention is when calling an OS function which might block the global interpreter lock is dropped, thus allowing other python bytecode to run. So what? That doesn't help you, as you are single-threaded here. The released

Re: how can I clear a dictionary in python

2007-03-29 Thread Larry Bates
Bruno Desthuilliers wrote: Larry Bates a écrit : Aahz wrote: In article [EMAIL PROTECTED], Larry Bates [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I create a dictionary like this myDict = {} and I add entry like this: myDict['a'] = 1 but how can I empty the whole dictionary?

Re: dynamic module does not define init function (initpsycopgmodule)

2007-03-29 Thread Gabriel Genellina
En Wed, 28 Mar 2007 17:16:43 -0300, kickslop [EMAIL PROTECTED] escribió: Clearly I am doing something braindead here with psycopg 1.1.21 (psycopg2 is not an option). Any ideas? I get the same results when I build it with Red Hat's GCC 3.4.6 setup as well as our in-house GCC 3.3.5 setup.

Re: BeautifulSoup vs. Microsoft

2007-03-29 Thread John Nagle
Duncan Booth wrote: John Nagle [EMAIL PROTECTED] wrote: Strictly speaking, it's Microsoft's fault. title=!--http://www.microsoft.com/usability/information.mspx- is supposed to be an HTML comment. But it's improperly terminated. It should end with --. So all that following stuff is

Re: What is the timeout value of HTTP

2007-03-29 Thread Facundo Batista
ken wrote: i.e. how long python will wait for a response in the below code? h = httplib.HTTP(self.url, 8080) h.putrequest('GET', '/sample/?url=' + self.url) h.endheaders() For ever. In Py=2.5, httplib.HTTP doesn't have a timeout, so you have to do something like:

Re: PyPy 1.0: JIT compilers for free and more

2007-03-29 Thread Carl Friedrich Bolz
Duncan Booth wrote: Robin Becker [EMAIL PROTECTED] wrote: I am hugely encouraged by this C:\Python\devel\pypy-1.0.0\python24\python \python\lib\test \pystone.py Pystone(1.1) time for 5 passes = 1.49586 This machine benchmarks at 33425.6 pystones/second

Re: with timeout(...):

2007-03-29 Thread Jean-Paul Calderone
On Thu, 29 Mar 2007 11:30:04 -0500, Nick Craig-Wood [EMAIL PROTECTED] wrote: Diez B. Roggisch [EMAIL PROTECTED] wrote: I beleive the convention is when calling an OS function which might block the global interpreter lock is dropped, thus allowing other python bytecode to run. So what?

encoding confusions

2007-03-29 Thread Tim Arnold
I have the contents of a file that contains French documentation. I've iterated over it and now I want to write it out to a file. I'm running into problems and I don't understand why--I don't get how the encoding works. My first attempt was just this: snipped code for classes, etc; fname is

Best way to wait for string input

2007-03-29 Thread kevinliu23
Hi guys, Python newbie here for some expert help. So basically I want to design a menu system that waits for a string input. I'm not sure what the best way of going about this is. The current system waits for a single character input using msvcrt.kbhit( ) and msvcrt.getch( ). Is there something

Question about details of __import__

2007-03-29 Thread Mitko Haralanov
Hi all, I am going to do my best to describe the issue that I am having and hopefully someone can shed some light on it: I have three modules that a comprising the problem: ./core.py ./log.py ./resources/simple/__init__.py core.py looks something like this (simplified version): import log

Re: which methods to use?

2007-03-29 Thread Gabriel Genellina
En Thu, 29 Mar 2007 01:56:15 -0300, Steven D'Aprano [EMAIL PROTECTED] escribió: By the way, id(obj) == id(another_object) is just a long way of writing obj is another_object. Just as a side note: that's not true, testing by id() only works if both objects are alive at the same time. py

Re: Best way to wait for string input

2007-03-29 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], kevinliu23 wrote: Python newbie here for some expert help. So basically I want to design a menu system that waits for a string input. I'm not sure what the best way of going about this is. The current system waits for a single character input using msvcrt.kbhit( ) and

Re: encoding confusions

2007-03-29 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Tim Arnold wrote: I have the contents of a file that contains French documentation. I've iterated over it and now I want to write it out to a file. I'm running into problems and I don't understand why--I don't get how the encoding works. My first attempt was just

Any consumer review generators available?

2007-03-29 Thread aralsky
I am looking for a fake consumer review generator that could generate realistic looking reviews for any products, kind of like on amazon.com but generated by Artificial Intelligence. Is there a package available in your favorite programing language... thx alan --

Re: Any consumer review generators available?

2007-03-29 Thread Paul McGuire
On Mar 29, 1:19 pm, [EMAIL PROTECTED] wrote: I am looking for a fake consumer review generator that could generate realistic looking reviews for any products, kind of like on amazon.com but generated by Artificial Intelligence. Is there a package available in your favorite programing

Re: with timeout(...):

2007-03-29 Thread John Nagle
Diez B. Roggisch wrote: Nick Craig-Wood wrote: Did anyone write a contextmanager implementing a timeout for python2.5? And have it work reliably and in a cross platform way! Cross platform isn't the issue here - reliability though is. To put it simple: can't be done that way. You could

Re: Question about details of __import__

2007-03-29 Thread Gabriel Genellina
En Thu, 29 Mar 2007 14:42:33 -0300, Mitko Haralanov [EMAIL PROTECTED] escribió: I have three modules that a comprising the problem: ./core.py ./log.py ./resources/simple/__init__.py Surely there is a ./resources/__init__.py too? The problem that I am seeing is that 'global_info' in the

Re: Question about details of __import__

2007-03-29 Thread Mitko Haralanov
On Thu, 29 Mar 2007 15:43:46 -0300 Gabriel Genellina [EMAIL PROTECTED] wrote: Surely there is a ./resources/__init__.py too? There sure is: ./resources/__init__.py is: __all__ = ['simple', 'other'] You may check if this is the case, looking at sys.modules I did look at sys.modules but I

Re: Any consumer review generators available?

2007-03-29 Thread Peter Otten
Paul McGuire wrote: On Mar 29, 1:19 pm, [EMAIL PROTECTED] wrote: I am looking for a fake consumer review generator that could generate realistic looking reviews for any products, kind of like on amazon.com but generated by Artificial Intelligence. Is there a package available in your

Re: Any consumer review generators available?

2007-03-29 Thread Uri Guttman
a == aralsky [EMAIL PROTECTED] writes: a I am looking for a fake consumer review generator that could a generate realistic looking reviews for any products, kind of like a on amazon.com but generated by Artificial Intelligence. Is there a a package available in your favorite programing

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Joshua J. Kugler
On Thursday 29 March 2007 07:33, Alex Martelli wrote: Joshua J. Kugler [EMAIL PROTECTED] wrote: still be nicely portable. It just seems that since Python is gathering that information anyway, it should make it available without me having to walk the directory tree. Sorry, where is

Re: PyPy 1.0: JIT compilers for free and more

2007-03-29 Thread [EMAIL PROTECTED]
On Mar 28, 5:36 pm, Jarek Zgoda [EMAIL PROTECTED] wrote: Carl Friedrich Bolz napisa³(a): Welcome to the PyPy 1.0 release - a milestone integrating the results of four years of research, engineering, management and sprinting efforts, concluding the 28 months phase of EU co-funding! So it

How can I get the content of a web site using http library

2007-03-29 Thread [EMAIL PROTECTED]
I am trying to get the content of a web site like this: But my question is how can I do a 'GET' request without putting the '/ index.html'' h = httplib.HTTP('www.yahoo.com') # it takes 2 arguments here, but I don't know if the site has '/index.html' , how can I leave this out?

  1   2   >