Re: converting u'11\xa022' to '11\xa022'

2007-02-20 Thread Jean-Paul Calderone
On Tue, 20 Feb 2007 18:12:42 -0600, alf <[EMAIL PROTECTED]> wrote: >Hi, >is there a more elegant way to do that: > >''.join([chr(ord(i)) for i in u'11\xa022' ]) > u'11\xa022'.encode('charmap') Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Bypassing __setattr__ for changing special attributes

2007-02-20 Thread Fuzzyman
On Feb 20, 12:57 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 19 Feb 2007 23:18:02 -0800, Ziga Seilnacht wrote: > > George Sakkis wrote: > >> I was kinda surprised that setting __class__ or __dict__ goes through > >> the __setattr__ mechanism, like a normal attribute: > > >> class Foo(o

Re: Regex Speed

2007-02-20 Thread Alejandro Dubrovsky
[EMAIL PROTECTED] wrote: > While creating a log parser for fairly large logs, we have run into an > issue where the time to process was relatively unacceptable (upwards > of 5 minutes for 1-2 million lines of logs). In contrast, using the > Linux tool grep would complete the same search in a matte

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread BJörn Lindqvist
On 2/20/07, Jeff Templon <[EMAIL PROTECTED]> wrote: > Bjorn, I am not sure I see why my post is bull crap. I think all you > are doing is agreeing with me. My post was entitled "Python 3.0 unfit > for serious work", you just indicated that the Linux distros will > agree with me, in order to be ta

Re: Regex Speed

2007-02-20 Thread garrickp
On Feb 20, 4:15 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > What is an "exclusionary set"? It would help enormously if you were to > tell us what the regex actually is. Feel free to obfuscate any > proprietary constant strings, of course. My apologies. I don't have specifics right now, but it'

Re: question with inspect module

2007-02-20 Thread Gabriel Genellina
En Tue, 20 Feb 2007 16:04:33 -0300, Tool69 <[EMAIL PROTECTED]> escribió: > I would like to retrieve all the classes, methods and functions of a > module. > I've used the inspect module for this, but inside a given class > (subclass of some other one), I wanted to retrieve only the methods > I've

code-object

2007-02-20 Thread LG
Hi, All, >>>code = compile('print "hello everyone, how are you? "', '', 'exec') >>>exec code hello everyone, how are you? >>>print code ", line 1> how to print the code object ? like the one on .pyc Regards LG -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread John Nagle
Steven Bethard wrote: > So as a Python programmer, the path is clear. As soon as possible, you > should make your code compatible with Python 3.0. There's always the possiblity that Python 3 won't happen. Look at what happened with Perl 6. That's been talked about for seven years now. Th

Re: Regex Speed

2007-02-20 Thread Steve Holden
John Machin wrote: [...] > > To help you, we need either (a) basic information or (b) crystal > balls. [...] How on earth would having glass testicles help us help him? regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com S

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > There's always the possiblity that Python 3 won't happen. Look at > what happened with Perl 6. That's been talked about for > seven years now. The user base just wasn't interested. > Perl 5 was good enough, and users migrated to PHP for the > little

Re: Regex Speed

2007-02-20 Thread Alejandro Dubrovsky
Steve Holden wrote: > John Machin wrote: > [...] >> >> To help you, we need either (a) basic information or (b) crystal >> balls. > [...] > > How on earth would having glass testicles help us help him? > John, of course, meant spheres of doped single crystal silicon on which we could simulate

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Steven Bethard
Steven Bethard wrote: > So as a Python programmer, the path is clear. As soon as possible, you > should make your code compatible with Python 3.0. John Nagle wrote: > There's always the possiblity that Python 3 won't happen. That's not really a possibility. Unlike Perl 6, Python 3 is not a

Re: Regex Speed

2007-02-20 Thread Gabriel Genellina
En Tue, 20 Feb 2007 21:40:40 -0300, <[EMAIL PROTECTED]> escribió: > My apologies. I don't have specifics right now, but it's something > along the line of this: > > error_list = re.compile(r"error|miss|issing|inval|nvalid|math") > > Yes, I know, these are not re expressions, but the requirements f

Re: converting u'11\xa022' to '11\xa022'

2007-02-20 Thread alf
Jean-Paul Calderone wrote: > u'11\xa022'.encode('charmap') thx a lot. one more question, once a unicode object is created e.g. u=unicode('hello', 'iso-8859-1') is there any way to find: 1-original encoding of u 2-list of supported encodings? A. -- http://mail.python.org/mailma

Re: code-object

2007-02-20 Thread Gabriel Genellina
En Tue, 20 Feb 2007 22:39:43 -0300, LG <[EMAIL PROTECTED]> escribió: code = compile('print "hello everyone, how are you? "', '', > 'exec') exec code > hello everyone, how are you? print code > ", line 1> > > how to print the code object ? > like the one on .pyc Do you want the sour

outlook bar like widget

2007-02-20 Thread Jaime Casanova
Hi, i'm trying to make an outlook bar like widget basically buttons that when pressed extends to lists... any idea where to start? -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying

getting a thread out of sleep

2007-02-20 Thread mark
Right now I have a thread that sleeps for sometime and check if an event has happened and go back to sleep. Now instead I want the thread to sleep until the event has occured process the event and go back to sleep. How to do this? thanks mark class eventhndler(threading.Thread): def __init__

Re: code-object

2007-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2007 20:39:43 -0500, LG wrote: > Hi, All, > code = compile('print "hello everyone, how are you? "', '', > 'exec') exec code > hello everyone, how are you? print code > ", line 1> > > how to print the code object ? You just did. > like the one on .pyc What do you mea

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread John Nagle
Paul Rubin wrote: > John Nagle <[EMAIL PROTECTED]> writes: > >> There's always the possiblity that Python 3 won't happen. Look at >>what happened with Perl 6. That's been talked about for >>seven years now. The user base just wasn't interested. >>Perl 5 was good enough, and users migrated t

Re: getting a thread out of sleep

2007-02-20 Thread placid
On Feb 21, 3:08 pm, mark <[EMAIL PROTECTED]> wrote: > Right now I have a thread that sleeps for sometime and check if an > event has happened and go back to sleep. Now instead I want the thread > to sleep until the event has occured process the event and go back to > sleep. How to do this? > thank

eval('000052') = 42?

2007-02-20 Thread Astan Chee
Hi, I just tried to do eval('00052') and it returned 42. Is this a known bug in the eval function? Or have I missed the way eval function works? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: getting a thread out of sleep

2007-02-20 Thread mark
On 20 Feb 2007 20:47:57 -0800, placid <[EMAIL PROTECTED]> wrote: > On Feb 21, 3:08 pm, mark <[EMAIL PROTECTED]> wrote: > > Right now I have a thread that sleeps for sometime and check if an > > event has happened and go back to sleep. Now instead I want the thread > > to sleep until the event has

Re: eval('000052') = 42?

2007-02-20 Thread Erik Max Francis
Astan Chee wrote: > I just tried to do > eval('00052') and it returned 42. > Is this a known bug in the eval function? Or have I missed the way eval > function works? String literals beginning with a 0 are in octal. Besides, using eval for such a narrow case is extremely unwise. Instead use i

Re: getting a thread out of sleep

2007-02-20 Thread placid
On Feb 21, 4:12 pm, mark <[EMAIL PROTECTED]> wrote: > On 20 Feb 2007 20:47:57 -0800, placid <[EMAIL PROTECTED]> wrote: > > > On Feb 21, 3:08 pm, mark <[EMAIL PROTECTED]> wrote: > > > Right now I have a thread that sleeps for sometime and check if an > > > event has happened and go back to sleep. N

Re: getting a thread out of sleep

2007-02-20 Thread placid
On Feb 21, 4:21 pm, "placid" <[EMAIL PROTECTED]> wrote: > On Feb 21, 4:12 pm, mark <[EMAIL PROTECTED]> wrote: > > > > > On 20 Feb 2007 20:47:57 -0800, placid <[EMAIL PROTECTED]> wrote: > > > > On Feb 21, 3:08 pm, mark <[EMAIL PROTECTED]> wrote: > > > > Right now I have a thread that sleeps for som

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread greg
John Nagle wrote: > It's a bit > embarassing that the main implementation of Python is still a > pure interpreter. Even Javascript has a JIT compiler now. Pure interpreted Python has always seemed more responsive to me than any Java application I've tried to use. So I can't help feeling that this

Re: eval('000052') = 42?

2007-02-20 Thread John Machin
On Feb 21, 3:09 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I just tried to do > eval('00052') and it returned 42. > Is this a known bug in the eval function? Or have I missed the way eval > function works? > Thanks Eight fives are forty. Forty plus two is forty two. I see no bug here, only

Re: How to do a Decorator Here?

2007-02-20 Thread Michele Simionato
On Feb 20, 9:20 pm, "Gregory Piñero" <[EMAIL PROTECTED]> wrote: > Or is this not what decorators do? I'm trying to avoid subclassing if I can. Your problem, overriding a method, is what inheritance was made for. If you want to know more about decorators, see Dr Mertz's last article http://www-12

ANN: pyraknet 0.1.4

2007-02-20 Thread Gerald Kaszuba
I just released a new version of pyraknet - a UDP game network library. http://pyraknet.slowchop.com/ The changes are: * Changed license to LGPL * Mac OS X binaries for Python 2.4 (thanks to Simon Howe for testing) * Added Peer.is_active(...) * Added Peer.get_max_connections(...) * setup.py will

Re: f---ing typechecking

2007-02-20 Thread Hendrik van Rooyen
"Nick Craig-Wood" <[EMAIL PROTECTED]> wrote: > > Ie > > x += a > > does not equal > > x = x + a > > which it really should for all types of x and a One would hope so , yes. However, I think that the first form is supposed to update in place, while the second is free to bind a new

Re: Weird result returned from adding floats depending on order I add them

2007-02-20 Thread Hendrik van Rooyen
"joanne matthews (RRes-Roth)" <[EMAIL PROTECTED]> wrote: 8< > Can anyone tell me whats going on > and how I can avoid the problem. Thanks Don't know about the first question. Would avoid it by using ints and asking for percentages... - Hendrik -- htt

Re: setup.py installation and module search path

2007-02-20 Thread Gabriel Genellina
En Tue, 20 Feb 2007 20:56:13 -0300, Russ <[EMAIL PROTECTED]> escribió: >> I'm no expert, but I think what normally happens is the module gets >> installed into ../pythonxx/lib/site-packages/ and if it >> installs __init__.py file there they get automatically searched. >> At least that the way th

Re: converting u'11\xa022' to '11\xa022'

2007-02-20 Thread Gabriel Genellina
En Wed, 21 Feb 2007 00:31:32 -0300, alf <[EMAIL PROTECTED]> escribió: > one more question, once a unicode object is created e.g. > > u=unicode('hello', 'iso-8859-1') > > is there any way to find: > 1-original encoding of u No. It's like, if you have variable "a" with value 10, you can't kno

Re: Regex Speed

2007-02-20 Thread John Machin
On Feb 21, 11:40 am, [EMAIL PROTECTED] wrote: > On Feb 20, 4:15 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > > > What is an "exclusionary set"? It would help enormously if you were to > > tell us what the regex actually is. Feel free to obfuscate any > > proprietary constant strings, of course. >

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Jay Tee
On Feb 21, 1:41 am, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: [ citing me ] > "if 2.4 code doesn't run on 3.0, it's rather likely that strong > pressure will be applied to port *away* from Python into something > less capricious." > > Who are these people that are applying the strong pressure?

ctypes and DLL exceptions

2007-02-20 Thread Uri Nix
Hi all, Is there a method to deal with exceptions originating from a DLL creatively? After experimentation, I've observed that calling a ctypes wrapped DLL exception raises WindowsError, and an accompanying code. Does the code mean something? Can I throw an object from C++ and somehow catch i

<    1   2