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

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?

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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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 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

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 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

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: 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

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__

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

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

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: 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: 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 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 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 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 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

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: 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

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: 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 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: 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: 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

converting u'11\xa022' to '11\xa022'

2007-02-20 Thread alf
Hi, is there a more elegant way to do that: ''.join([chr(ord(i)) for i in u'11\xa022' ]) -- thx, alf -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do a Decorator Here?

2007-02-20 Thread Matimus
On Feb 20, 12:20 pm, "Gregory Piñero" <[EMAIL PROTECTED]> wrote: > Need some decorator help. > > I have a class. And I want to add behavior to one of this class's > methods to be run before the class runs the actual method. Is this > what decorators are for? > > So the class I want to work with i

Re: setup.py installation and module search path

2007-02-20 Thread Russ
Larry Bates wrote: > 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 things work for me. But if I don't have root priviledge, t

Re: setup.py installation and module search path

2007-02-20 Thread Larry Bates
Russ wrote: > When I run setup.py to install a pure python package, is it supposed > to > automatically set my search path to find the installed modules? Or am > I > supposed to set my PYTHONPATH variable myself in my .bashrc file? > > And what if I don't have root priviledge? Then what is suppose

Re: Regex Speed

2007-02-20 Thread John Machin
On Feb 21, 8:29 am, [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 sam

setup.py installation and module search path

2007-02-20 Thread Russ
When I run setup.py to install a pure python package, is it supposed to automatically set my search path to find the installed modules? Or am I supposed to set my PYTHONPATH variable myself in my .bashrc file? And what if I don't have root priviledge? Then what is supposed to happen? Can anyone gi

Re: file io (lagged values) newbie question

2007-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2007 22:03:43 +0100, Bruno Desthuilliers wrote: [snip] >>>And that's not cruft? >> >> >> No. Why do you think it is crufty? > > Because it is ? *shrug* "Is not." "Is too." "Is not." Why is converting a list of integers to a string all at once more crufty than converting them

RE: f---ing typechecking

2007-02-20 Thread Delaney, Timothy (Tim)
Nick Craig-Wood wrote: > x += a > > does not equal > > x = x + a > > which it really should for all types of x and a Actually, this will *never* be the case for classes that do in-place augmented assignment. a = [1] b = [2] c = a + b print a, b, c a += b prin

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Paul Boddie
Jay Tee wrote: > > Paul, thanks for this, I didn't realize the scope of the situation. I > agree with your assessment to the extent that I understand what the > whole python 3.0 thing is about. I don't know if I've delimited the scope of any situation, really. However... [...] > The fact that t

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Steven Bethard
Jay Tee wrote: > Let's see if I can scare up something I wrote about ten years ago on a > now-dead language that I really wanted to use (wound up sticking with > python instead because "it was supported" ;-) > > === > to figure out how to work things. The fact that there are t

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Jay Tee
Hi, Paul, thanks for this, I didn't realize the scope of the situation. I agree with your assessment to the extent that I understand what the whole python 3.0 thing is about. Let's see if I can scare up something I wrote about ten years ago on a now-dead language that I really wanted to use (wou

pass variables via url with python?

2007-02-20 Thread Katrin Shafiepour
Hi I'm quite new to python and I'm trying to pass variables via url! was wondering if you can help me? ThanQ -- http://mail.python.org/mailman/listinfo/python-list

Regex Speed

2007-02-20 Thread garrickp
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 matter of seconds. The search we used

Re: ANN: PyDSTool now compatible with numpy 1.0.1, scipy 0.5.2 and 64-bit CPUs.

2007-02-20 Thread Stef Mientki
Sounds GREAT ! thank you ! I just took a quick look, the comparison to SimuLink looks good, now if someone could make a comparison with Modelica ;-) cheers, Stef Mientki Rob Clewley wrote: > We are pleased to announce version 0.84 of PyDSTool, an open-source > dynamical systems simulation, modeli

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

2007-02-20 Thread John Machin
On Feb 21, 3:44 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-02-20, John Machin <[EMAIL PROTECTED]> wrote: > > > On Feb 21, 2:05 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > >> On 2007-02-20, joanne matthews (RRes-Roth) <[EMAIL PROTECTED]> wrote: > > >> Don't use floating point if you e

Re: How to test if one dict is subset of another?

2007-02-20 Thread Jay Tee
Hi, thanks! the code lift from 2.3 to 2.2 worked (thank Guido et al for BACKWARDS COMPATIBILITY ;-)) ... unfortunately I was in a hurry to get the release out since a colleague's cluster was croaking under the load of the old, non-indexed version. Your solution is nicer looking than mine, and le

Re: How to do a Decorator Here?

2007-02-20 Thread Gregory Piñero
On 2/20/07, Tim Mitchell <[EMAIL PROTECTED]> wrote: > Hi Greg, > > Decorators would work fine if the the class you were working with was > _yours_ (ie. you wrote it), the problem here is that string.Template is > someone else's class that you're trying to modify. > > Here's how a decorator would wo

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Jeff Templon
yo, 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 taken seriously, the distros will have to include 2.x pyt

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Paul Boddie
Steven Bethard wrote: > > Well, Python 2.4 code will work on Python 2.6 and 2.7 so just because > your code isn't yet compatible with Python 3.0 doesn't mean you should > give up on Python. Perhaps the most important concern in the context of Python 3.0 is what the term "Python" will come to mean

Re: question with inspect module

2007-02-20 Thread Tool69
Thanks Miki, that's exactly what I need :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Jay Tee
Hi, On Feb 20, 8:59 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > You snipped the rest of that comment: > > "It's not even clear yet that your average 2.6 code will work on 3.0 -- > though there's a pretty large contingent trying to make this true." Thanks for pointing this out. I voted for th

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread BJörn Lindqvist
What a load of bull crap. Python is one of the simplest packages to have multiple version of installed. When Python 3.0 is released, all Linux distros will acquire a symlink at /usr/bin/python2 pointing to the latest Python 2.x version installed. Or something equivalent. Rest assured that Linux dis

Re: How to do a Decorator Here?

2007-02-20 Thread Goldfish
On Feb 20, 8:20 pm, "Gregory Piñero" <[EMAIL PROTECTED]> wrote: > Need some decorator help. > > I have a class. And I want to add behavior to one of this class's > methods to be run before the class runs the actual method. Is this > what decorators are for? > > So the class I want to work with is

Re: question with inspect module

2007-02-20 Thread Miki
Hello, > 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 written, not the inherited one. How can I do ? class A: def a_

Re: file io (lagged values) newbie question

2007-02-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Tue, 20 Feb 2007 07:08:02 -0800, John Machin wrote: > > >>>def write_series(data, f): >>>"""Write a time series data to file f. >>> >>>data should be a list of integers. >>>f should be an already opened file-like object. >>>""" >>># Convert data

Re: Sorting directory contents

2007-02-20 Thread Tim Williams
On 20/02/07, Wolfgang Draxinger <[EMAIL PROTECTED]> wrote: > H folks, > > I got, hmm not really a problem, more a question of elegance: > > In a current project I have to read in some files in a given > directory in chronological order, so that I can concatenate the > contents in those files into a

Re: wxPython: non-GUI thread launching new frame? Delegates?

2007-02-20 Thread Grant Edwards
On 2007-02-20, cyberco <[EMAIL PROTECTED]> wrote: > Ah! Great tip, thanks! > Now instead of calling: > > parent.onRequest(param) > > I call: > > wx.CallAfter(lambda x: parent.onRequest(x), param) How does that differ from this? wx.CallAfter(parent.onRequest, param) -- Grant Edwards

Re: wxPython: non-GUI thread launching new frame? Delegates?

2007-02-20 Thread Chris Mellon
On 20 Feb 2007 12:01:02 -0800, cyberco <[EMAIL PROTECTED]> wrote: > Ah! Great tip, thanks! > Now instead of calling: > > parent.onRequest(param) > > I call: > > wx.CallAfter(lambda x: parent.onRequest(x), param) > You don't need the lambda - you can use: wx.CallAfter(parent.OnRequest, param) --

How to do a Decorator Here?

2007-02-20 Thread Gregory Piñero
Need some decorator help. I have a class. And I want to add behavior to one of this class's methods to be run before the class runs the actual method. Is this what decorators are for? So the class I want to work with is string.Template Let's say I have this: from string import Template a=Templ

Re: wxPython: non-GUI thread launching new frame? Delegates?

2007-02-20 Thread cyberco
Ah! Great tip, thanks! Now instead of calling: parent.onRequest(param) I call: wx.CallAfter(lambda x: parent.onRequest(x), param) Way cool. 2B > This is rather out of date. wxPython provides a wx.CallAfter function, > which will call the passed callable on the next spin through the event > l

ANN: PyDSTool now compatible with numpy 1.0.1, scipy 0.5.2 and 64-bit CPUs.

2007-02-20 Thread Rob Clewley
We are pleased to announce version 0.84 of PyDSTool, an open-source dynamical systems simulation, modeling, and analysis package. This long-overdue release is primarily intended to bring existing PyDSTool functionality up to date with the latest numpy and scipy releases (previous versions required

Re: Python 3.0 unfit for serious work?

2007-02-20 Thread Steven Bethard
Jay Tee wrote: > Yo, > > On Feb 16, 6:07 am, Steven Bethard <[EMAIL PROTECTED]> wrote: >> Python 3.0 is determined not to be hampered by backwards incompatibility >> concerns. It's not even clear yet that your average 2.6 code will work > > Then Python is pretty much determined to remove itself f

Re: How to test if one dict is subset of another?

2007-02-20 Thread Paul Rubin
"Jay Tee" <[EMAIL PROTECTED]> writes: > Python 2.2.3 (#1, Oct 26 2003, 11:49:53) > ImportError: No module named sets Hmm, well I think the sets module in 2.3 is written in Python, so you could drop it into your application for use in 2.2. Better would be to use the C version from 2.4 if you can.

Re: threading and multicores, pros and cons

2007-02-20 Thread Paul Boddie
Nikita the Spider wrote: > > Hmmm, I hadn't thought about that since I've never used the Cheese Shop > myself. What benefits does Cheese > Shop confer to someone looking for a package? I ask because from my > perspective it just adds overhead to package maintenance. The Python Package Index, as I

Re: builtin set literal

2007-02-20 Thread Steven Bethard
Steven Bethard: > While Python 3.0 is not afraid to break backwards > compatibility, it tries to do so only when there's a very substantial > advantage. [EMAIL PROTECTED] wrote: > I understand, but this means starting already to put (tiny) > inconsistencies into Python 3.0... Well, there's goi

Re: How to test if one dict is subset of another?

2007-02-20 Thread Jay Tee
On Feb 20, 6:44 pm, Paul Rubin wrote: > They are sets, not lists. > >from sets import Set as set # use in 2.3 and earlier > >l1= set([3, 4, 7, 2]) >l2 = set([2, 3]) >l2 = set([2, 3, 99]) >print l1 & l2 Thanks Paul, but: bosui:~> python Python 2.2.3

Re: Sorting directory contents

2007-02-20 Thread Wolfgang Draxinger
Larry Bates wrote: > 3) You didn't handle the possibility that there is s > subdirectory >in the current directory. You need to check to make sure it >is a file you are processing as os.listdir() returns files >AND directories. Well, the directory the files are in is not supposed to

Re: PLY for standard library

2007-02-20 Thread Fuzzyman
On Feb 20, 6:29 pm, "Alan Isaac" <[EMAIL PROTECTED]> wrote: > Is PLY destined for the standard library? I've never heard it suggested... but +1 Fuzzyman http://www.voidspace.org.uk/python/articles.shtml > If not, what module providing substantially similar functionality is? > > Thank you, > Alan

question with inspect module

2007-02-20 Thread Tool69
Hi, 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 written, not the inherited one. How can I do ? Thanks. -- http://mail.python.

Re: builtin set literal

2007-02-20 Thread Alan Isaac
Paul Rubin wrote: > There's even a sentiment in some pythonistas to get rid of the [] and {} > notations for lists and dicts, using list((1,2,3)) and dict((1,2),(3,4)) > for [1,2,3] and {1:2, 3:4} respectively. Well then for consistency they must want tuple((1,2,3)) for (1,2,3). Oh oh, that must

Re: Pep 3105: the end of print?

2007-02-20 Thread Beliavsky
On Feb 16, 10:17 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 16 Feb 2007 09:49:03 -0500, Jean-Paul Calderone wrote: > > On Sat, 17 Feb 2007 01:32:21 +1100, Steven D'Aprano > >> [snip] > > >>I don't think that follows at all. print is only a problem if you expect > >>your code to work u

Re: threading and multicores, pros and cons

2007-02-20 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Nikita the Spider <[EMAIL PROTECTED]> writes: > > note, there a (sort of) new module available that allows interprocess > > communication via shared memory and semaphores with Python. You can find > > it here: > > h

PLY for standard library

2007-02-20 Thread Alan Isaac
Is PLY destined for the standard library? If not, what module providing substantially similar functionality is? Thank you, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: CherryPy/Turbogears on server not controlled by me

2007-02-20 Thread Eddie Corns
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >Brian Blais wrote: >> Hello, >> >> I was wondering if there is a way to run CherryPy/Turbogears on a server >> that I don't >> have root access to. If I just choose a random port, I think the security >> guys on >> the server would get annoyed at

Re: Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Sick Monkey
Do you mean epoch time? if so, the below example would work. import time,datetime t = datetime.datetime.now() print t 2007-02-20 13:09:34.851000 print "Epoch Seconds:", time.mktime(t.timetuple()) Epoch Seconds: 1171994974.0 # go the other way epochtime = 1171994974 now = datetime.datetime.

Re: ocaml to python

2007-02-20 Thread Laurent Pointal
Gigs_ wrote: > Is there any way to convert ocaml code to python? but not manually For Python and ocaml, my bookmark contains this link: http://www.programs4all.net/programs/Pycaml-Python-Embedding-API-for-Ocaml.htm But no ocaml to Python compiler... -- http://mail.python.org/mailman/listinfo/

Re: Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Diez B. Roggisch
Vishal Bhargava schrieb: > Is there an inbuilt library in Python which you can use to convert time in > seconds to hh:mm:ss format? Module datetime. Did you even _bother_ to google or skim the docs? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Steve Holden
Vishal Bhargava wrote: > Is there an inbuilt library in Python which you can use to convert time in > seconds to hh:mm:ss format? > Thanks, > Vishal > Please don't ask a question by editing a reply to an existing thread: your question is now filed on many people's computers under "How to test if

Re: Help Required for Choosing Programming Language

2007-02-20 Thread Jordan
On Feb 18, 7:35 pm, Dave Cook <[EMAIL PROTECTED]> wrote: > On 2007-02-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > i have read about Python, Ruby and Visual C++. but i want to go > > through with GUI based programming language like VB.net > > You might take a look athttp://dabodev.com > >

Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Vishal Bhargava
Is there an inbuilt library in Python which you can use to convert time in seconds to hh:mm:ss format? Thanks, Vishal -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if one dict is subset of another?

2007-02-20 Thread Paul Rubin
"Jay Tee" <[EMAIL PROTECTED]> writes: > >>> l1= [3, 4, 7, 2] > >>> l2 = [2, 3] > >>> l2 = [2, 3, 99] > >>> l1 & l2 > Traceback (most recent call last): > File "", line 1, in ? > TypeError: unsupported operand type(s) for &: 'list' and 'list' > > what am I missing? They are sets, not lists.

Re: How to test if one dict is subset of another?

2007-02-20 Thread Jay Tee
Hi your post had the following construct: > for j in (index['user']['jeff'] & index['state']['running']): > do_something() but Python 2.3.4 (#1, Oct 11 2006, 06:18:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more informat

Re: How to test if one dict is subset of another?

2007-02-20 Thread Paul Rubin
"Jay Tee" <[EMAIL PROTECTED]> writes: > it looks very cool, except that one of the constraints mentioned is > that the solution has to work properly on pythons 2.2 and 2.3. That thing doesn't really deeply depend on defaultdict, it's just convenient. You can add a few more lines of code in the pr

Re: How to test if one dict is subset of another?

2007-02-20 Thread Jay Tee
On Feb 20, 9:12 am, Paul Rubin wrote: > do_something() > > you'd just write: > > for j in (index['user']['jeff'] & index['state']['running']): > do_something() Hi, it looks very cool, except that one of the constraints mentioned is that the solution h

Python 3.0 unfit for serious work?

2007-02-20 Thread Jay Tee
Yo, On Feb 16, 6:07 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Python 3.0 is determined not to be hampered by backwards incompatibility > concerns. It's not even clear yet that your average 2.6 code will work Then Python is pretty much determined to remove itself from consideration from vari

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

2007-02-20 Thread Grant Edwards
On 2007-02-20, John Machin <[EMAIL PROTECTED]> wrote: > On Feb 21, 2:05 am, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-02-20, joanne matthews (RRes-Roth) <[EMAIL PROTECTED]> wrote: >> >> > I'm getting different results when I add up a list of floats depending >> > on the order that I list

Re: file io (lagged values) newbie question

2007-02-20 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Would it be less crufty if I wrote it as a cryptic one liner without > comments? > > f.write(str(data)[1:-1].replace(',', '') + '\n') That doesn't look terribly cryptic to me, but maybe I'm used to it. > > Try this: f.write(' '.join(str(x) for x in d

Re: builtin set literal

2007-02-20 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Unrelated: Ruby and Lisp use ? and ! at the end of the function/method > names to denote a predicate or a function that mutates in place (With > them the list.sort() may be called list.sort!() ). Using Python I > usually put an Q at the end of the name for this purpose.

Re: file io (lagged values) newbie question

2007-02-20 Thread Steven D'Aprano
On Tue, 20 Feb 2007 07:08:02 -0800, John Machin wrote: >> def write_series(data, f): >> """Write a time series data to file f. >> >> data should be a list of integers. >> f should be an already opened file-like object. >> """ >> # Convert data into a string for writing. >>

Re: builtin set literal

2007-02-20 Thread bearophileHUGS
Steven Bethard: > While Python 3.0 is not afraid to break backwards > compatibility, it tries to do so only when there's a very substantial > advantage. I understand, but this means starting already to put (tiny) inconsistencies into Python 3.0... Unrelated: Ruby and Lisp use ? and ! at the end o

Re: Found a product for running Python-based websites off CDROM -have anybody tried it?

2007-02-20 Thread Don Taylor
David Wishnie wrote: > Hello, > > Recently I've found a product that allows to create CDs or DVDs with > mod_python -based websites > (and CGI python of course) so that apache-based webserver, python and > mod_python are run directly > off CD on Windows, MacOS X and Linux at the same time (a

Re: Python-list Digest, Vol 41, Issue 286

2007-02-20 Thread Paul Boddie
On 20 Feb, 11:59, KoDer <[EMAIL PROTECTED]> wrote: > > Subject: Can I reverse eng a .pyc back to .py? [...] > https://svn.cs.pomona.edu/sys/src/konane/pyunparse.py > > Need add new AST nodes if You want to use it with python2.5. The above code seems to need to parse a source file, since it uses

Re: Sorting directory contents

2007-02-20 Thread Rob Wolfe
Wolfgang Draxinger wrote: > However this code works (tested) and behaves just like listdir, > only that it sorts files chronologically, then alphabetically. > > def listdir_chrono(dirpath): > import os > files_dict = dict() > for fname in os.listdir(dirpath): >

Re: wxPython: non-GUI thread launching new frame? Delegates?

2007-02-20 Thread Chris Mellon
On 2/20/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > cyberco wrote: > > > In my wxPython app a non-GUI thread (that reads info from the network) > > tries to open a frame to show the new info. This results in my app > > hanging (which is not too surprising). Coming from a C# environment I > >

  1   2   >