Re: do "some action" once a minute

2006-05-09 Thread Sybren Stuvel
Petr Jakes enlightened us with: > I would like to do "some action" once a minute. My code (below) > works, I just wonder if there is some more pythonic approach or some > "trick" how to do it differently. I'd use the Threading module, and the Timer object from that module to be more precise. There

Re: Memory leak in Python

2006-05-09 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > I have a python code which is running on a huge data set. After > starting the program the computer becomes unstable and gets very > diffucult to even open konsole to kill that process. What I am > assuming is that I am running out of memory. Before acting

Re: Multi-line lambda proposal.

2006-05-09 Thread Sybren Stuvel
Kaz Kylheku enlightened us with: > I've been reading the recent cross-posted flamewar, and read Guido's > article where he posits that embedding multi-line lambdas in > expressions is an unsolvable puzzle. > [...] > a = lambda(x, y), lambda(s, t), lambda(u, w): u + w > statement1 > statem

PythonWin's Check (any other Lint tool) ?

2006-05-09 Thread Davy
Hi all, I am using PythonWin from ActivePython. And I use the GUI button 'Check' to check the .py file. But the Check did not give out a check list. It just show "Check failed" or "Check successful". Is the Check list saved in other where or is there any other Lint tool? Any suggestions will be

Re: Import data from Excel

2006-05-09 Thread Dale Strickland-Clark
Try this: from win32com.client import GetObject, constants def GetExcelData(self, strFilePath): """ Extract the data from the Excel sheet. Returns tuple of tuples representing the rows and cells.""" # The following line extracts # all the data from sheet 1 of the spreadsheet

Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Davy
Hi all, I used to be a Matlab user. And want to use Python to replace some Matlab work. When I type 3.0/5.0, the result is 0.5... Is there some precision loss? And how to overcome it? Any suggestions will be appreciated! Best regards, Davy -- http://mail.python.org/mailman/listinfo/python

Re: how to construct a binary-tree using python?

2006-05-09 Thread Antoon Pardon
Op 2006-05-06, hankssong schreef <[EMAIL PROTECTED]>: > Hi everyone, I'm wondering whether it's possible to construct a > binary-tree using python. > Since python don't have pointer, it can't dynamically allocate memory > like C language. > But some important data structures like linked list, binar

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread michele . simionato
Ken Tilton wrote: > Python has a weak lambda, statements do not always > return values, it does not have macros, and I do not know if it has > special variables. I am pretty much ignorant of Common Lisp, but I have the impression they are the same as Scheme parameters, i.e. thread-local dynamicall

Re: Enumerating Regular Expressions

2006-05-09 Thread Dale Strickland-Clark
Any regular expression that has an asterisk in it has an infinite number of possible matches. If it has two asterisks, that's an infinite number squared and that's a really big number. You wouldn't want to print them out. [EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module th

Re: Import data from Excel

2006-05-09 Thread Mirco Wahab
Hi, > Is it possible to import data from Excel for > doing numerical analysis in Python? If so how? use John Machins glamouros 'xlrd' http://www.lexicon.net/sjmachin/xlrd.htm form his documentation: import xlrd book = xlrd.open_workbook("myfile.xls") print "The number of worksheets

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Dale Strickland-Clark
Have you looked at the decimal module? python Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import * >>> Decimal("3")/Decimal("5") Decimal("0.6") >>> I don't s

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Michele Simionato
Alex Martelli wrote: yes, if that was my only > choice, I'd much rather use small, simple Scheme than huge, complicated, > rich, powerful Common Lisp. ((But in this case I'm biased by early > experiences, since when I learned and used Lisp-ish languages there WAS > no Common Lisp, while Scheme wa

Re: Python's regular expression?

2006-05-09 Thread Mirco Wahab
Hi Duncan > Nick Craig-Wood wrote: >> Which translates to >> match = re.search('(blue|white|red)', t) >> if match: >> else: >> if match: >> else: >> if match: > > This of course gives priority to colours and only looks for garments or > footwear if the it hasn't matched o

Re: Is this a good use of __metaclass__?

2006-05-09 Thread Joel Hedlund
Hi! Thanks for taking the time to answer. I will definitely have a look at writing dispatchers. > The problem you have with your metaclass version, is the infamous > metaclass conflict. I think I solved the problem of conflicting metaclasses in this case and I posted it as a reply to Bruno D

Re: Is this a good use of __metaclass__?

2006-05-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > Hi! > > Thank you for a quick and informative response! > > >>I'd go for 'manually decorating' anyway. Metaclasses can be really handy >>for framework-like stuff, but for the use case you describe, I think the >>explicit decorator option is much more, well, explicit -

Re: Is this a good use of __metaclass__?

2006-05-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I played around with my old code before I saw your post, and I believe > I've found a solution that's a bit neater than what I had before. I > thought I could just as well post it if you're interested and have the > time. This one uses multiple inheritance, but it's legal

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Antoon Pardon
Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: > > Joe Marshall wrote: >> Alex Martelli wrote: >> Most languages allow `unnamed numbers'. The `VAT_MULTIPLIER' argument >> is a >> strawman. Would you want to have to use a special syntax to name the >> increment >> in loop? >> >> defnu

clear memory? how?

2006-05-09 Thread N/A
Hi all, I am learning Python. Just wondering how to clear saved memory in Python? Like in Matlab I can simply use "clear all" to clear all saved memory. Thank u! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Mirco Wahab
Hi Davy > When I type 3.0/5.0, the result is 0.5... try: >>> print (3.0/5.0) 0.6 > Is there some precision loss? And how to overcome it? Make sure the result gets piped through some floating point con- version (like print, %s etc.) BTW, the 0.59998 value is the "exact" calcul

Re: combined files together

2006-05-09 Thread Eric Deveaud
Gary Wessle wrote: > > I need to traverse those files in the order they were created > chronologically. listdir() does not do it, is there a way besides > build a list then list.sort(), then for element in list_of_files open > element? are the name of the files describing the cration date, or

Re: Memory leak in Python

2006-05-09 Thread Peter Tillotson
1) Review your design - You say you are processing a large data set, just make sure you are not trying to store 3 versions. If you are missing a design, create a flow chart or something that is true to the code you have produced. You could probably even post the design if you are brave enough. 2)

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Rob Warnock
Pisin Bootvong <[EMAIL PROTECTED]> wrote: +--- | No matter how scalable your language is, you cannot make a 100MHz/128MB | server serve 100,000 client a second over the internet. +--- Sure you can! That's ~1000 CPU cycles/request, which [assuming at least a 100BASE-TX NIC]

Re: Enumerating Regular Expressions

2006-05-09 Thread blair . bethwaite
Dale Strickland-Clark wrote: > Any regular expression that has an asterisk in it has an infinite number of > possible matches. > > If it has two asterisks, that's an infinite number squared and that's a > really big number. > > You wouldn't want to print them out. We've been over this already. Wh

Re: Is this a good use of __metaclass__?

2006-05-09 Thread Michele Simionato
Joel Hedlund wrote: > It's not that I'm hellbent on using > metaclasses - I'm just curious how people think they should be used. There are very few good use cases for metaclasses. *You should use a metaclass only when you want the additional metaclass-induced behavior to be inherited in the childr

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Jeremy Sanders
Davy wrote: > Is there some precision loss? And how to overcome it? See http://docs.python.org/tut/node16.html for some useful information. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python

2006-05-09 Thread gavinpaterson
Dear Pythoners, I am writing as I am having trouble embedding a Python program into a Win XP C++ console application. I have written a script file for importing and I am trying to use the example for "Pure Embedding" found in the product documentation. The program fails to successfully execute p

Re: utility functions within a class?

2006-05-09 Thread bruno at modulix
John Salerno wrote: > John Salerno wrote: > >> [EMAIL PROTECTED] wrote: >> >>> Even if you don't end up referring to self or any instance >>> attributes within the method >> >> >> Hmm, follow-up: I *do* plan to refer to instance attributes inside >> these methods (self.something), but does that re

Embedding Python in C++ Problem

2006-05-09 Thread gavinpaterson
Dear Pythoners, I am trying to embed a Python script into a C++ application for the first time. Although I have used the example 5.3 Pure Embedding I am having problems with calling the function defined in my program. If I define function multiply in module "multiply.py" def multiply(a,b):

Re: utility functions within a class?

2006-05-09 Thread bruno at modulix
John Salerno wrote: > [EMAIL PROTECTED] wrote: > >> I'm having trouble deciphering what this bit means - "but these >> functions will be called from another method in the class, not from the >> instance itself", I don't think it makes sense. > > > Yeah, I'm starting to see that as I tried to imp

Re: utility functions within a class?

2006-05-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > John Salerno wrote: > >>What I originally meant was that they would not be called from an >>instance *outside* the class itself, i.e. they won't be used when >>writing another script, they are only used by the class itself. > > > Yep, so you want to encapsulate the fun

Re: PythonWin's Check (any other Lint tool) ?

2006-05-09 Thread [EMAIL PROTECTED]
Hello, There're a pylint (http://www.logilab.org/projects/pylint) and pychecker (http://pychecker.sourceforge.net/) projects. Eugene -- http://mail.python.org/mailman/listinfo/python-list

Re: utility functions within a class?

2006-05-09 Thread bruno at modulix
John Salerno wrote: > John Salerno wrote: > >> [EMAIL PROTECTED] wrote: >> >>> John Salerno wrote: >>> What I originally meant was that they would not be called from an instance *outside* the class itself, i.e. they won't be used when writing another script, they are only used by th

RE: Import data from Excel

2006-05-09 Thread Tim Golden
[Dale Strickland-Clark] | from win32com.client import GetObject, constants | | def GetExcelData(self, strFilePath): | """ Extract the data from the Excel sheet. | Returns tuple of tuples representing the rows and cells.""" | # The following line extracts | # all the data from she

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Pisin Bootvong
Rob Warnock wrote: > Pisin Bootvong <[EMAIL PROTECTED]> wrote: > +--- > | No matter how scalable your language is, you cannot make a 100MHz/128MB > | server serve 100,000 client a second over the internet. > +--- > > Sure you can! That's ~1000 CPU cycles/request, which [ass

Re: clear memory? how?

2006-05-09 Thread Diez B. Roggisch
N/A wrote: > Hi all, > I am learning Python. Just wondering how to clear saved memory in > Python? Like in Matlab I can simply use "clear all" to clear all saved > memory. You don't - python does it for you. It is called garbage collection. All you have to to is get into granny-mode(tm): forget a

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Stefan Nobis
[EMAIL PROTECTED] (Alex Martelli) writes: > if anonymous functions are available, they're used in even more > cases where naming would help Yes, you're right. But don't stop here. What about expressions? Many people write very complex expression, that are hard to understand. A good language shoul

Re: Python's regular expression?

2006-05-09 Thread bruno at modulix
Davy wrote: > Hi all, > (snip) > Does Python support robust regular expression like Perl? Yes. > And Python and Perl's File content manipulation, which is better? >From a raw perf and write-only POV, Perl clearly beats Python (regarding I/O, Perl is faster than C - or it least it was the last

Re: hyperthreading locks up sleeping threads

2006-05-09 Thread Robin Becker
[EMAIL PROTECTED] wrote: > Below are 2 files. The first is a Python program that isolates the > problem within less than 1 hour (often just a few minutes). The second > is a C++ program that shows that the Win32 Sleep() function works as > expected (ran from Friday afternoon until Monday morning)

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Rob Warnock
Pisin Bootvong <[EMAIL PROTECTED]> wrote: +--- | Rob Warnock wrote: | > | No matter how scalable your language is, you cannot make a | > | 100MHz/128MB server serve 100,000 client a second over the internet. | > +--- | > | > Sure you can! That's ~1000 CPU cycles/request, whi

Re: do "some action" once a minute

2006-05-09 Thread Petr Jakes
Thanks for your comment. It is mainly English issue (I am not native English speaker). OK, to be more specific, I would like to run the code, when the value of seconds in the timestamp become say "00". The whole code will run in the infinitive loop and other actions will be executed as well, so it

two of pylab.py

2006-05-09 Thread Gary Wessle
Hi I use debian/testing linux Linux debian/testing 2.6.15-1-686 I found some duplicate files in my system, I don't if the are both needed, should I delete one of the groups below and which one? -rw-r--r-- 1 root root 80375 2006-01-24 00:28 /usr/lib/python2.3/site-packages/matplotlib/pylab.py -

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Pisin Bootvong
Antoon Pardon wrote: > Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: > > Is this a Slippery Slope fallacious argument? > > (http://c2.com/cgi/wiki?SlipperySlope) > > No it is not. > > [...] > > So the question I have is: Why is requiring me to give this function > a name considered a

Re: Memory leak in Python

2006-05-09 Thread bruno at modulix
[EMAIL PROTECTED] wrote: > I have a python code which is running on a huge data set. After > starting the program the computer becomes unstable and gets very > diffucult to even open konsole to kill that process. What I am assuming > is that I am running out of memory. > > What should I do to make

Controlling non-python programs with python

2006-05-09 Thread Wesley Brooks
Dear All,Tried to post once before but it seemed to get trapped in the system due to a suspect heading.I would like to create and pass keyboard, mouse, and analogue device events another program in order to control it, perhaps over a network if it requires too much processing power to be done on th

Re: two of pylab.py

2006-05-09 Thread Diez B. Roggisch
Gary Wessle wrote: > Hi > > I use debian/testing linux Linux debian/testing 2.6.15-1-686 > > I found some duplicate files in my system, I don't if the are both > needed, should I delete one of the groups below and which one? Do you have any problems related to pylab? Or are you concerned about

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-09 Thread Christophe
Fredrik Lundh a écrit : > Christophe wrote: > > >>I think you've made a mistake in your example. > > > >>> constant A = [] > >>> def foo(var): > ... var.append('1') > ... print var > ... > >>> b = A > >>> foo(b) > >>> foo(b) > > >>>and this ? >>

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Chris Uppal
Alex Martelli wrote: > I think it's reasonable to make a name a part of functions, classes and > modules because they may often be involved in tracebacks (in case of > uncaught errors): to me, it makes sense to let an error-diagnosing > tracebacks display packages, modules, classes and functions/m

Re: Python's regular expression?

2006-05-09 Thread Duncan Booth
Mirco Wahab wrote: > If you wouldn't need dictionary lookup and > get away with associated categories, all > you'd have to do would be this: > >$PATTERN = qr/ >(blue |white |red)(?{'Colour'}) > | (socks|tights)(?{'Garment'}) > | (boot |shoe |trainer)(?{'Footwear'}

Re: Using time.sleep() in 2 threads causes lockup whenhyper-threading is enabled

2006-05-09 Thread Serge Orlov
Dennis Lee Bieber wrote: > On 8 May 2006 15:44:04 -0700, "Serge Orlov" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > The test program in question doesn't require a dedicated machine and it > > doesn't consume a lot of CPU resources since it sleeps most of the > > time.

wxPython IEHtmlWindow mystery - dependencies?

2006-05-09 Thread gjzusenet
Hi I've been using an IEHtmlWindow in my script with no problems, but it seems that for people with a clean installation of XP SP2 it fails like such: Traceback (most recent call last): File "htmlloader.py", line 509, in load File "PythonCard\model.pyo", line 340, in __init__ File "PythonCa

wxPython IEHtmlWindow mystery - dependencies?

2006-05-09 Thread gjzusenet
Hi I've been using an IEHtmlWindow in my script with no problems, but it seems that for people with a clean installation of XP SP2 it fails like such: Traceback (most recent call last): File "htmlloader.py", line 509, in load File "PythonCard\model.pyo", line 340, in __init__ File "PythonCa

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Antoon Pardon
Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: > > Antoon Pardon wrote: >> Op 2006-05-09, Pisin Bootvong schreef <[EMAIL PROTECTED]>: >> > Is this a Slippery Slope fallacious argument? >> > (http://c2.com/cgi/wiki?SlipperySlope) >> >> No it is not. >> >> [...] >> >> So the question I ha

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread Chris Uppal
Pisin Bootvong wrote: > Slippery Slope:: >"Argumentation that A is bad, because A might lead to B, and B > to C, and we all know C is very bad." For the Slippery Slope criticism to be applicable, there would have to be some suggestion that removing anonymous functions /would actually/ (te

Re: Econometrics in Panel data?

2006-05-09 Thread DeepBlue
so are you saying that Python is not an appropriate language for doing econometrics stuff? Dennis Lee Bieber wrote: > On Tue, 09 May 2006 05:58:10 +0800, DeepBlue <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > >> Hi all, >> >> I am new to Python. Just wondering can Python

Re: Embedding Python

2006-05-09 Thread Serge Orlov
gavinpaterson wrote: > Dear Pythoners, > > I am writing as I am having trouble embedding a Python program into a > Win XP C++ console application. > > I have written a script file for importing and I am trying to use the > example for "Pure Embedding" found in the product documentation. > > The pro

Re: advanced number recognition in strings?

2006-05-09 Thread Dan Sommers
On Mon, 8 May 2006 17:16:20 + (UTC), [EMAIL PROTECTED] (Roy Smith) wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> we want extract numbers from strings and wonder if there is already a >> module around for doing this. An example in our case would look like >> this: >> >> 0.032 +/- 0.

Re: A critic of Guido's blog on Python's lambda

2006-05-09 Thread David C.Ullrich
On Mon, 08 May 2006 18:46:57 -0400, Ken Tilton <[EMAIL PROTECTED]> wrote: > > >David C. Ullrich wrote: >> On 08 May 2006 12:53:09 -0700, [EMAIL PROTECTED] (Thomas >> F. Burdick) wrote: >> >> >>>Ken Tilton <[EMAIL PROTECTED]> writes: >>> >>> No, you do not want on-change handlers propagating

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
[Serge] > def search_key(s): > de_str = unicodedata.normalize("NFD", s) > return ''.join(cp for cp in de_str if not >unicodedata.category(cp).startswith('M')) Lovely bit of code - thanks for posting it! You might want to use "NFKD" to normalize things like LATIN SMALL

Re: do "some action" once a minute

2006-05-09 Thread Diez B. Roggisch
Petr Jakes wrote: > Thanks for your comment. It is mainly English issue (I am not native > English speaker). > > OK, to be more specific, I would like to run the code, when the value > of seconds in the timestamp become say "00". > The whole code will run in the infinitive loop and other actions

Re: Tkfont.families does not list all installed fonts

2006-05-09 Thread Eric Brunel
On 7 May 2006 23:55:05 -0700, Atul <[EMAIL PROTECTED]> wrote: > Hi, > > I have installed a truetype font (.ttf) on a linux machne (SUSE linux > 10, KDE) by copying it to my .fonts folder. I can use the font in all > applications like open-office and firefox browser. > > However, I cannot use the f

installing numpy

2006-05-09 Thread Gary Wessle
Hi I am trying to install NumPy in my debian/testing linux 2.6.15-1-686. with no numpy for debian/testing, I am left alone, since the experimental version available by debian will result in a dependency nightmares, so after unpacking the downloaded file "numpy-0.9.6.tar.gz" which crated a direc

Re: Is there any plan to port python to ACCESS Palm Linux Platform?

2006-05-09 Thread Diez B. Roggisch
heidan wrote: > Another quick question about python and palm? > > As we all have known that ACCESS has planned to build Palm OS on top of I didn't know. > Linux, is there any plan to port python to THIS future PALM OS? How is anybody going to plan something that requires something that is just

Re: installing numpy

2006-05-09 Thread Christoph Haas
On Tue, May 09, 2006 at 09:03:31PM +1000, Gary Wessle wrote: > I am trying to install NumPy in my debian/testing linux > 2.6.15-1-686. > > with no numpy for debian/testing, I am left alone, since the > experimental version available by debian will result in a dependency > nightmares, What about

Re: Enumerating Regular Expressions

2006-05-09 Thread Diez B. Roggisch
> I thought that was the case, I've found a paper on the topic at least. > Maybe once I've finished some other work I'll give it a shot. It seems > like a fairly useful thing to be able to do with a regular expression > so I just guessed that somebody must have done it already. Just wandering: w

Re: Problem - Serving web pages on the desktop (SimpleHTTPServer)

2006-05-09 Thread Paul Boddie
Ben wrote: > > Perhaps someone can help me. For some reason, when my Python script runs > and loads an HTML page in a new browser window at the local host > (desktop), the links to my stylesheet and all the images are broken. I > did check the HTML file by itself...everything loaded fine ;) I've j

Python editor recommendation.

2006-05-09 Thread DeepBlue
Hi all, Can any one please recommend me an editor for coding Python. Thank u. I have Komodo (www.activestate.com) in my mind. Is the editor any good? regards. -- http://mail.python.org/mailman/listinfo/python-list

Re: installing numpy

2006-05-09 Thread Gary Wessle
Christoph Haas <[EMAIL PROTECTED]> writes: > On Tue, May 09, 2006 at 09:03:31PM +1000, Gary Wessle wrote: > > I am trying to install NumPy in my debian/testing linux > > 2.6.15-1-686. > > > > with no numpy for debian/testing, I am left alone, since the > > experimental version available by debia

Re: Python editor recommendation.

2006-05-09 Thread Fabio Zadrozny
Check http://wiki.python.org/moin/IntegratedDevelopmentEnvironments. I'd reccommend pydev (http://pydev.sf.net) or the pydev extensions if you're willing to spend some bucks (http://www.fabioz.com/pydev). -- FabioOn 5/9/06, DeepBlue <[EMAIL PROTECTED]> wrote: Hi all,Can any one please recommend m

Re: Python editor recommendation.

2006-05-09 Thread imcs ee
free and vim or wingide On 5/9/06, DeepBlue <[EMAIL PROTECTED]> wrote: Hi all,Can any one please recommend me an editor for coding Python. Thank u.I have Komodo ( www.activestate.com) in my mind. Is the editor any good?regards.--http://mail.python.org/mailman/listinfo/python-list -- http://mail.p

eval and exec in an own namespace

2006-05-09 Thread Jens
Hi, has anyone an idea why the following code does not work. s = """ def a(n): return n*n def b(t): return a(t) """ ns = {} exec(s, {}, ns) eval("b(2)", ns, {}) executing this script raises an exception (NameError: global name 'a' is not defined) in the last line. Hope for your help. --

Re: ascii to latin1

2006-05-09 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Richie Hindle escreveu: > [Serge] >> def search_key(s): >> de_str = unicodedata.normalize("NFD", s) >> return ''.join(cp for cp in de_str if not >>unicodedata.category(cp).startswith('M')) > > Lovely bit of code - thanks fo

What to use for adding syntax for hierarcical trees, metaclasses, tokenize.py or PLY?

2006-05-09 Thread glomde
Hi I would like to extend python so that you could create hiercical tree structures (XML, HTML etc) easier and that resulting code would be more readable. The syntax i would like is something like the below: # Example creating html tree '*!*' is an operator that creates an new node '*=*' is an o

Re: Multi-line lambda proposal.

2006-05-09 Thread Antoon Pardon
Op 2006-05-09, Scott David Daniels schreef <[EMAIL PROTECTED]>: > Kaz Kylheku wrote: >> I've been reading the recent cross-posted flamewar, and read Guido's >> article where he posits that embedding multi-line lambdas in >> expressions is an unsolvable puzzle. >> >> So for the last 15 minutes I ap

Re: installing numpy

2006-05-09 Thread Christoph Haas
On Tue, May 09, 2006 at 09:43:50PM +1000, Gary Wessle wrote: > Christoph Haas <[EMAIL PROTECTED]> writes: > > > On Tue, May 09, 2006 at 09:03:31PM +1000, Gary Wessle wrote: > > > I am trying to install NumPy in my debian/testing linux > > > 2.6.15-1-686. > > > > > > with no numpy for debian/test

Re: Enumerating Regular Expressions

2006-05-09 Thread Tim Chase
> Why are people getting stuck on infinite regular > languages? I've made it quite clear that I'm only really > interested in doing this for finite languages, but that > shouldn't matter anyway. The power of regular expressions is that they define a consice means to encapsulate an infinite numb

Re: Econometrics in Panel data?

2006-05-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, DeepBlue <[EMAIL PROTECTED]> wrote: >so are you saying that Python is not an appropriate language for doing >econometrics stuff? > > >Dennis Lee Bieber wrote: >> On Tue, 09 May 2006 05:58:10 +0800, DeepBlue <[EMAIL PROTECTED]> declaimed >> the >> following in comp

Re: Python's DSLs

2006-05-09 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: >Cameron Laird <[EMAIL PROTECTED]> wrote: > ... >> On this one isolated matter, though, I'm confused, Alex: I sure >> think *I* have been writing DSLs as specializations of Python, >> and NOT as "a language in its own right

Deferred Evaluation in Recursive Expressions?

2006-05-09 Thread birchb
While working on type expressions I am rather stuck for a way to express recursive types. A simple example of this is a singly-linked list of integers. In some languages you have compiler syntax which suspends evaluation so you can have recursive types. e.g. typedef Linked_List := int, Linked_

import in execv after fork

2006-05-09 Thread Rotem
Hello, We have been encountering several deadlocks in a threaded Python application which calls subprocess.Popen (i.e. fork()) in some of its threads. This has occurred on Python 2.4.1 on a 2.4.27 Linux kernel. Perliminary analysis of the hang shows that the child process blocks upon entering th

Re: List of lists of lists of lists...

2006-05-09 Thread bruno at modulix
Ángel Gutiérrez Rodríguez wrote: > I would like to have a list of lists N times deep, and my solution is (in > pseudocode): > > def deep(x): > a=[x] > return a Hint : what's exactly the difference between deep(x) and [x] ? > mylist=[] > for N: mylist=deep(mylist) > > Is there a more elegant

Re: installing numpy

2006-05-09 Thread Christoph Haas
(Replying to my own posting... how I hate that...) On Tue, May 09, 2006 at 02:07:15PM +0200, Christoph Haas wrote: > On Tue, May 09, 2006 at 09:43:50PM +1000, Gary Wessle wrote: > > Christoph Haas <[EMAIL PROTECTED]> writes: > > > > > On Tue, May 09, 2006 at 09:03:31PM +1000, Gary Wessle wrote: >

Re: What to use for adding syntax for hierarcical trees, metaclasses, tokenize.py or PLY?

2006-05-09 Thread Michele Simionato
glomde wrote: You should look at the compiler package and at the new AST in Python 2.5. For easy things tokenize could be enough, though. Notice that in Python 2.5 tokenize grew a new 'untokenize' function which is pretty useful. See http://docs.python.org/dev/lib/module-tokenize.html for example

Re: import in execv after fork

2006-05-09 Thread Rotem
Another workaround could be re-assigning a new lock to import_lock (such a thing is done with the global interpreter lock) at PyOS_AfterFork or pthread_atfork. -- http://mail.python.org/mailman/listinfo/python-list

Re: installing numpy

2006-05-09 Thread Raymond L. Buvel
Gary Wessle wrote: > Hi > > I am trying to install NumPy in my debian/testing linux > 2.6.15-1-686. > When installing from source on a Debian system, you want the installed package to wind up in /usr/local/lib/python2.x/site-packages (where x represents the version of Python you are running th

Re: Why list.sort() don't return the list reference instead of None?

2006-05-09 Thread bruno at modulix
Lawrence Oluyede wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > >>However, I wonder why L.sort() don't return the reference L, the >>performance of return L and None may be the same. > > > It's not "the same". sort() does not return anything. Yes it does : it returns the None ob

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
[Luis] > When I used the "NFD" option, I came across many errors on these and > possibly other codes: \xba, \xc9, \xcd. What errors? This works fine for me, printing "Ecoute": import unicodedata def search_key(s): de_str = unicodedata.normalize("NFD", s) return ''.join([cp for cp in de_

Re: Why list.sort() don't return the list reference instead of None?

2006-05-09 Thread bruno at modulix
vbgunz wrote: > to throw fire on the fuel (:P), you can get the value back to an > in-place mutable change with a single expression... > > mylist = [2,3,4,1] > print mylist.sort() or mylist > > might not be too pythonic or maybe it is. I guess depends on what side > of the glass you might wish to

Accessing std::wstring in Python using SWIG

2006-05-09 Thread Shankar
Hello, I have a C++ dll with one class which has one public function. This function returns an std::list as an argout. I am using SWIG to generate Python extensions for this dll. I have the following code in python to access the string from the list. . . for item in myList: print str(item)

Re: ascii to latin1

2006-05-09 Thread Serge Orlov
Richie Hindle wrote: > [Serge] > > def search_key(s): > > de_str = unicodedata.normalize("NFD", s) > > return ''.join(cp for cp in de_str if not > >unicodedata.category(cp).startswith('M')) > > Lovely bit of code - thanks for posting it! Well, it is not so good. Please

Re: ascii to latin1

2006-05-09 Thread Serge Orlov
Luis P. Mendes wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Richie Hindle escreveu: > > [Serge] > >> def search_key(s): > >> de_str = unicodedata.normalize("NFD", s) > >> return ''.join(cp for cp in de_str if not > >>unicodedata.category(cp).startswith('M

Re: Python editor recommendation.

2006-05-09 Thread BartlebyScrivener
I'm on Windows XP, and I like Komodo a lot. It does php, html, perl, python, ruby etc. It's just a tad slow to load (takes about 10 seconds on my AMD Athlon 2700), but I usually leave it on all day, so I don't notice. If you're on Linux you might ask others. rpd -- http://mail.python.org/mailma

Re: Enumerating Regular Expressions

2006-05-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module that allows you to enumerate all the > strings a particular regular expression describes? > > Cheers, > -Blair > By hand write down a generator that will solve the simplest case of '.*' as a regexp, and filter the output of th

Re: Deferred Evaluation in Recursive Expressions?

2006-05-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > While working on type expressions I am rather stuck for a > way to express recursive types. A simple example of this is a > singly-linked list of integers. In some languages you have compiler > syntax > which suspends evaluation so you can have recursive types. e.g. >

Re: How can I do this with python ?

2006-05-09 Thread Harold Fellermann
Better go for the subprocess module. It is supposed to replace os.popen and has a much nicer interface. - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: hyperthreading locks up sleeping threads

2006-05-09 Thread Roel Schroeven
[EMAIL PROTECTED] schreef: > Below are 2 files. The first is a Python program that isolates the > problem within less than 1 hour (often just a few minutes). The second > is a C++ program that shows that the Win32 Sleep() function works as > expected (ran from Friday afternoon until Monday mornin

Re: Python editor recommendation.

2006-05-09 Thread Dale Strickland-Clark
Vim. Everything else is Notepad. DeepBlue wrote: > Hi all, > > Can any one please recommend me an editor for coding Python. Thank u. > I have Komodo (www.activestate.com) in my mind. Is the editor any good? > > regards. -- Dale Strickland-Clark Riverhall Systems www.riverhall.co.uk We're rec

Re: do "some action" once a minute

2006-05-09 Thread Irmen de Jong
Petr Jakes wrote: > OK, to be more specific, I would like to run the code, when the value > of seconds in the timestamp become say "00". > The whole code will run in the infinitive loop and other actions will > be executed as well, so it can not "sleep" for 60 seconds :). Have a look at my 'Kronos

Re: clear memory? how?

2006-05-09 Thread Andrew Gwozdziewycz
Glad to see you're trying Python instead of Matlab. Python was never meant to be a replacement for Matlab. It's a general purpose programming language like Java, or C#. Though it has very little in common with either of those languages. Since Python is a general purpose language, if you wan

Re: ascii to latin1

2006-05-09 Thread Richie Hindle
[Serge] > I have to admit that using > normalize is a far from perfect way to implement search. The most > advanced algorithm is published by Unicode guys: > If you read it you'll understand > it's not so easy. I only have to look at the length of the docum

Re: Enumerating Regular Expressions

2006-05-09 Thread Mirco Wahab
Hi blair.bethwaite > I want a tool that can enumerate a regex, > with support for generating each string > described by the regex in some predefined order. If you run the regex against some target string, this is gonna be easy (but maybe not what you want). If you have the string 'Python' and

  1   2   3   >