do "some action" once a minute

2006-05-08 Thread Petr Jakes
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. minutes=time.localtime()[4] while 1: min, sec = time.localtime()[4:6] if sec==0 and minutes!=min: # first occur of sec==0

Re: Import data from Excel

2006-05-08 Thread N/A
sorry, can you say it more clearly? In Matlab, I can easily import data from Excel just simply use 'xlsread' command. How to do that in Python environment? thank u! Paddy wrote: > The CSV module? > -- http://mail.python.org/mailman/listinfo/python-list

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

2006-05-08 Thread Ketil Malde
[EMAIL PROTECTED] (Alex Martelli) writes: >> Any time you want an anonymous function (or class, or type, or number) >> it would be because that thing is sufficiently small and simple that the >> best name for it is the code itself. > In the real world, people don't choose anonymous functions only

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

2006-05-08 Thread Pisin Bootvong
Kaz Kylheku wrote: > > Now imagine you had to do this with every object. > > def add_five(x) > # return x + 5 <-- anonymous integer literal, not allowed!!! >five = 5 # define it first >return x + five > I mentioned that as Slippery slope fallacious argument in other reply. > [

Re: Import data from Excel

2006-05-08 Thread Paddy
The CSV module? -- http://mail.python.org/mailman/listinfo/python-list

Import data from Excel

2006-05-08 Thread N/A
Hi, Is it possible to import data from Excel for doing numerical analysis in Python? If so how? Thank u! -- http://mail.python.org/mailman/listinfo/python-list

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

2006-05-08 Thread Alex Martelli
M Jared Finder <[EMAIL PROTECTED]> wrote: ... > Any time you want an anonymous function (or class, or type, or number) > it would be because that thing is sufficiently small and simple that the > best name for it is the code itself. In one game I worked on, there was That's not what I see happ

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
Michael J. Fromberger wrote: > > You see the difficulty don't you? How will the computer know in advance > > that the regex matches only a finite set of possible strings? > > You don't. Hence, you want something that behaves like a generator, and > will produce the strings one at a time. Preferab

Sorry, I didn't mean to spam...

2006-05-08 Thread Ben
I posted more than once by mistake...I was trying to configure Thunderbird. -- http://mail.python.org/mailman/listinfo/python-list

Re: the print statement

2006-05-08 Thread Tim Roberts
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Sun, 07 May 2006 00:09:06 GMT, Tim Roberts <[EMAIL PROTECTED]> declaimed >the following in comp.lang.python: > >> [EMAIL PROTECTED] wrote: >> >> >6) Would it be correct to infer that the print statement is aware of >> >characters beyond the 128 cha

Problem - Serving web pages on the desktop (SimpleHTTPServer)

2006-05-08 Thread Ben
Hi there, 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 ;) Here's my scr

Delivery failure notification

2006-05-08 Thread Symantec_Mail_Security_for_SMTP
Your message with Subject: could not be delivered to the following recipients: [EMAIL PROTECTED] Please do not resend your original message. Delivery attempts will continue to be made for 5 day(s). -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating Regular Expressions

2006-05-08 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > James Stroud wrote: > > > >>You mean like re.compile(r'.*') ? > > > > > > No. I mean like: > > > regex = re.compile(r'a|b') > regex.enumerate() > > > > a > > b > > You see the dif

Problem - Serving web pages on the desktop (SimpleHTTPServer)

2006-05-08 Thread test
Hi there, 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 ;) Here's my script

Problem - Serving web pages on the desktop (SimpleHTTPServer)

2006-05-08 Thread test
Hi there, 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 ;) Here's my script

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

2006-05-08 Thread M Jared Finder
Alex Martelli wrote: > Joe Marshall <[EMAIL PROTECTED]> wrote: >... >> If you language allows unnamed integers, unnamed strings, unnamed >> characters, unnamed arrays or aggregates, unnamed floats, unnamed >> expressions, unnamed statements, unnamed argument lists, etc. why >> *require* a name

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

2006-05-08 Thread Alex Martelli
Patrick May <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Alex Martelli) writes: > > ...an alleged reply to me, which in fact quotes (and responds to) > > only to statements by Brian, without mentioning Brian... > > > > Mr May, it seems that you're badly confused regarding Usenet's > > quoting c

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

2006-05-08 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: ... > Doesn't Google also employ such people as the inventor of Limbo > programming language, one of the inventors of Dylan, and a Smalltalk > expert? ...not to mention Lisp gurus (such as Peter Norvig), C++ gurus (such as Matt Austern) and Java ones (suc

Re: Python's DSLs

2006-05-08 Thread Alex Martelli
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". Have I been fooling > myself, or are you making the point that Lisp-based

Problem - Serving web pages on the desktop (SimpleHTTPServer)

2006-05-08 Thread test
Hi there, 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 ;) Here's my script

Re: python 2.5a2, gcc 4.1 and memory problems

2006-05-08 Thread [EMAIL PROTECTED]
Michele Petrazzo wrote: > [EMAIL PROTECTED] wrote: > > Michele Petrazzo wrote: > >> I haven't tried to recompile py 2.4 myself with gcc 4.1 because it > >> is already compiled with it (4.0.3), so I think (only think) that > >> is a py 2.5 problem. I'm right? or I have to compile it with > >> someth

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

2006-05-08 Thread heidan
Another quick question about python and palm? As we all have known that ACCESS has planned to build Palm OS on top of Linux, is there any plan to port python to THIS future PALM OS? Regards, Phipps -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
James Stroud wrote: > You see the difficulty don't you? How will the computer know in advance > that the regex matches only a finite set of possible strings? Well sure it might be a little difficult to figure _that_ out, although probably not all that hard if you converted to an FSA or something.

Re: Memory leak in Python

2006-05-08 Thread diffuser78
Its kinda 65o lines of code...not the best idea to paste the code. [EMAIL PROTECTED] wrote: > Can you paste an example of the code you're using? -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating Regular Expressions

2006-05-08 Thread James Stroud
[EMAIL PROTECTED] wrote: > James Stroud wrote: > >>You mean like re.compile(r'.*') ? > > > No. I mean like: > regex = re.compile(r'a|b') regex.enumerate() > > a > b > > You see the difficulty don't you? How will the computer know in advance that the regex matches only a finite set

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

2006-05-08 Thread Ken Tilton
Pisin Bootvong wrote: > 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? >> >> defnumber zero 0 >> defnumber one { successor

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
James Stroud wrote: > You mean like re.compile(r'.*') ? No. I mean like: >>> regex = re.compile(r'a|b') >>> regex.enumerate() a b >>> -- http://mail.python.org/mailman/listinfo/python-list

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

2006-05-08 Thread Pisin Bootvong
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? > > defnumber zero 0 > defnumber one { successor (zero); } > > for (int i = z

Re: Enumerating Regular Expressions

2006-05-08 Thread James Stroud
[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 > You mean like re.compile(r'.*') ? -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 L

Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
Hi all, Does anybody know of a module that allows you to enumerate all the strings a particular regular expression describes? Cheers, -Blair -- http://mail.python.org/mailman/listinfo/python-list

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

2006-05-08 Thread Alex Martelli
Joe Marshall <[EMAIL PROTECTED]> wrote: ... > If you language allows unnamed integers, unnamed strings, unnamed > characters, unnamed arrays or aggregates, unnamed floats, unnamed > expressions, unnamed statements, unnamed argument lists, etc. why > *require* a name for trivial functions? I th

Re: which is better, string concatentation or substitution?

2006-05-08 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Casey Hawthorne <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Roy Smith) wrote: > > >O(n^0), which is almost always written as O(1). This is a "constant > >time" algorithm, one which takes the same amount of steps to execute > >no matter how big the input is.

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

2006-05-08 Thread vbgunz
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 view the solution :) -- htt

Re: which is better, string concatentation or substitution?

2006-05-08 Thread Casey Hawthorne
[EMAIL PROTECTED] (Roy Smith) wrote: >O(n^0), which is almost always written as O(1). This is a "constant >time" algorithm, one which takes the same amount of steps to execute >no matter how big the input is. For example, in python, you can >write, "x = 'foo'". That assignment statement takes t

Re: Memory leak in Python

2006-05-08 Thread vbgunz
how big is the set? 100MB, more? what are you doing with the set? do you have a small example that can prove the set is causing the freeze? I am not the sharpest tool in the shed but it sounds like you might be multiplying your set in/directly either permanently or temporarily on purpose or acciden

Re: Memory leak in Python

2006-05-08 Thread compromise
Can you paste an example of the code you're using? -- http://mail.python.org/mailman/listinfo/python-list

Re: get Windows file type

2006-05-08 Thread Roger Upole
If you have pywin32 installed, you can use the shell module. from win32com.shell import shell, shellcon shell.SHGetFileInfo(filename ,0, shellcon.SHGFI_TYPENAME) Roger "BartlebyScrivener" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Using Python on Windows XP, I am able to

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

2006-05-08 Thread [EMAIL PROTECTED]
Thank you! I got it. -- http://mail.python.org/mailman/listinfo/python-list

Re: advanced number recognition in strings?

2006-05-08 Thread skip
Sebastian> we want extract numbers from strings and wonder if there is Sebastian> already a module around for doing this. An example in our Sebastian> case would look like this: Sebastian> 0.032 +/- 0.5 x 10(-4) Sebastian> it would even be helpful to have a routine which does

Memory leak in Python

2006-05-08 Thread diffuser78
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 sure that my code runs fine without

__dict__ in class inherited from C extension module

2006-05-08 Thread Tamas Nepusz
Dear Python experts, I have a strange problem - or more precisely, I'm not even sure if it's a problem or not. I'm developing a Python extension module in C which creates a new type with methods, mapping support and stuff like that :) Everything's working fine, but if I inherit a new class from th

Re: Multi-line lambda proposal.

2006-05-08 Thread Leif K-Brooks
Kaz Kylheku wrote: > But suppose that the expression and the multi-line lambda body are > reordered? That is to say, the expression is written normally, and the > mlambda expressions in it serve as /markers/ indicating that body > material follows. This results in the most Python-like solution. I

Re: ascii to latin1

2006-05-08 Thread Serge Orlov
Luis P. Mendes wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I'm developing a django based intranet web server that has a search page. > > Data contained in the database is mixed. Some of the words are > accented, some are not but they should be. This is because the > colle

Re: Multi-line lambda proposal.

2006-05-08 Thread Scott David Daniels
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 applied myself to this problem and come up > with this off-the-wall propo

Re: group for pure startups...

2006-05-08 Thread Scott David Daniels
bruce wrote: > can someone tell me if there's a group where people who are interested in > starting/contributing to embryoninc startup concepts can get together/meet, > exchange ideas, etc... > i'm not referring to meetings where you do VC/Funding presentations, I'm > basically talking about meetin

Re: ascii to latin1

2006-05-08 Thread Rene Pijlman
Luis P. Mendes: >I'm developing a django based intranet web server that has a search page. > >Data contained in the database is mixed. Some of the words are >accented, some are not but they should be. This is because the >collection of data began a long time ago when ascii was the only way to go

Re: ascii to latin1

2006-05-08 Thread Robert Kern
Luis P. Mendes wrote: > example: > if the word searched is 'televisão', I want that a search by either > 'televisao', 'televisão' or even 'télévisao' (this last one doesn't > exist in Portuguese) is successful. The ICU library has the capability to transliterate strings via certain rulesets. One

Multi-line lambda proposal.

2006-05-08 Thread Kaz Kylheku
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 applied myself to this problem and come up with this off-the-wall proposal for you people. Perhaps thi

ascii to latin1

2006-05-08 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm developing a django based intranet web server that has a search page. Data contained in the database is mixed. Some of the words are accented, some are not but they should be. This is because the collection of data began a long time ago wh

Re: utility functions within a class?

2006-05-08 Thread Scott David Daniels
John Salerno wrote: > Scott David Daniels wrote: >> John Salerno wrote: >>> ... But isn't there something about a single leading underscore >>> that doesn't import when you use from X import *? Or am I thinking of >>> something else? Is that also the double underscore? >> >> That has to do with m

group for pure startups...

2006-05-08 Thread bruce
hi... can someone tell me if there's a group where people who are interested in starting/contributing to embryoninc startup concepts can get together/meet, exchange ideas, etc... i'm not referring to meetings where you do VC/Funding presentations, I'm basically talking about meetings where you co

Re: i don't understand this RE example from the documentation

2006-05-08 Thread Ben Cartwright
John Salerno wrote: > John Salerno wrote: > > Ok, I've been staring at this and figuring it out for a while. I'm close > > to getting it, but I'm confused by the examples: > > > > (?(id/name)yes-pattern|no-pattern) > > Will try to match with yes-pattern if the group with given id or name > > exists

Dr. Dobb's Python-URL! - weekly Python news and links (May 8)

2006-05-08 Thread Peter Otten
QOTW: "If you can find a workable solution not involving metaclasses and decorators, don't use them" - Michele Simionato "Newest Beautiful Soup beta solves everyone's problems that I know of." - Leonard Richardson Jeff Croft gives a good introduction to the Django web framework. Don't le

Re: advanced number recognition in strings?

2006-05-08 Thread Heiko Wundram
Am Montag 08 Mai 2006 19:03 schrieb [EMAIL PROTECTED]: > 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.5 x 10(-4) Should work beautifully with the re.finditer function (untested!)

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

2006-05-08 Thread Ken Tilton
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 data to other >>>slots, though that is a sound albeit primitive way of improving >>>se

Re: Econometrics in Panel data?

2006-05-08 Thread beliavsky
DeepBlue wrote: > Hi all, > > I am new to Python. Just wondering can Python able to do econometric > regression in either Time-series or pooled (panel) data? As well as test > for hetero, autocorrelation, or endogeneity? > Thank you! NumPy can do linear regression, and one can certainly program a

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

2006-05-08 Thread Serge Orlov
Delaney, Timothy (Tim) wrote: > [EMAIL PROTECTED] wrote: > > > I am a bit surprised that nobody else has tried running the short > > Python program above on a hyper-threading or dual core / dual > > processor system. > > Does it happen every time? Have you tried it on multiple machines? Is it > po

Re: hyperthreading locks up sleeping threads

2006-05-08 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > Tried importing win32api instead of time and using the > win32api.GetTickCount() and win32api.Sleep() methods. What about win32api.SleepEx? What about WaitForMultipleObjects WaitForMultipleObjectsEx WaitForSingleObject WaitForSingleObjectEx when the object is not expe

Re: Global utility module/package

2006-05-08 Thread Scott David Daniels
Christoph Haas wrote: > As I know that importing packages from multiple modules always keeps it a > singleton I thought of something like this: > > Util.py: > > debugFlag = False > vibranceLevel = 'good' > > def function1(): >global debugFlag >print debugFlag The global line is

Global utility module/package

2006-05-08 Thread Christoph Haas
Evening, I'm currently working on a larger Python project that consists of multiple programs and packages. As I need a few utility functions time and again I moved them all into a Utility package and created a class there. Like this: Util.py: class Util: def __init__(self, debugFlag=F

Econometrics in Panel data?

2006-05-08 Thread DeepBlue
Hi all, I am new to Python. Just wondering can Python able to do econometric regression in either Time-series or pooled (panel) data? As well as test for hetero, autocorrelation, or endogeneity? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: hyperthreading locks up sleeping threads

2006-05-08 Thread OlafMeding
Tim Many thanks for trying and reporting the details of your environment. All our hyper-threading PC are identical. However, we identified one that is different and we are installing Windows XP on it now ... My hope is that other people will try this, too. Olaf -- http://mail.python.org/mailm

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

2006-05-08 Thread Delaney, Timothy (Tim)
[EMAIL PROTECTED] wrote: > I am a bit surprised that nobody else has tried running the short > Python program above on a hyper-threading or dual core / dual > processor system. Does it happen every time? Have you tried it on multiple machines? Is it possible that that one machine is having proble

logging module: add client_addr to all log records

2006-05-08 Thread [EMAIL PROTECTED]
Hi! I'm writing a server and I want to use the logging module for logging stuff. I want to log all transactions in detail, and if everything goes haywire I want to know which client did it. Therefore I want to affix the client address to every single log item. I would like to do the following: Fo

Re: List Ctrl

2006-05-08 Thread Philippe Martin
[EMAIL PROTECTED] wrote: > > Hello together !! > > I have programmed a List Control and I introduced information in several > rows. What I want to do is, modify this information when i select a row > and press a button. > There two options: > - when i do this, a window appears and asks me to

Re: python rounding problem.

2006-05-08 Thread Grant Edwards
On 2006-05-08, Thomas Bartkus <[EMAIL PROTECTED]> wrote: >> Or you can write 0.1 >> 3 >> >> :) > > Ahhh! > > But if I need to store the value 1/10 (decimal!), what kind of > a precision pickle will I then find myself while working in > base 3? Then we're right back where we

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

2006-05-08 Thread Kaz Kylheku
Steve R. Hastings wrote: > On Fri, 05 May 2006 21:16:50 -0400, Ken Tilton wrote: > > The upshot of > > what he wrote is that it would be really hard to make semantically > > meaningful indentation work with lambda. > > Pretty much correct. The complete thought was that it would be painful > all o

Re: hyperthreading locks up sleeping threads

2006-05-08 Thread Tim Peters
[EMAIL PROTECTED] > Below are 2 files. The first is a Python program that isolates the > problem within less than 1 hour (often just a few minutes). It does not on my box. I ran that program, from a DOS shell, using the released Windows Python 2.4.3. After an hour, it was still printing. I lef

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

2006-05-08 Thread David C.Ullrich
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 data to other >> slots, though that is a sound albeit primitive way of improving >> self-consistency of data in big apps. The

Re: python rounding problem.

2006-05-08 Thread Thomas Bartkus
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-05-08, Thomas Bartkus <[EMAIL PROTECTED]> wrote: > > >> does python support true rations, which means that 1/3 is a > >> true one-third and not 0.3 rounded off at some > >> arbitrary precision? > > > > At

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

2006-05-08 Thread Ken Tilton
Thomas F. Burdick wrote: > Ken Tilton <[EMAIL PROTECTED]> writes: > > >>No, you do not want on-change handlers propagating data to other >>slots, though that is a sound albeit primitive way of improving >>self-consistency of data in big apps. The productivity win with >>VisiCalc was that one si

Re: Getting HTTP responses - a python linkchecking script.

2006-05-08 Thread p-d-p=pas-de-spam
[EMAIL PROTECTED] a écrit : > Hi Folks, > > I'm thinking about writing a script that can be run over a whole site > and produce a report about broken links etc... > > I've been playing with the urllib2 and httplib modules as a starting > point and have found that with urllib2 it doesn't seem poss

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

2006-05-08 Thread Patrick May
[EMAIL PROTECTED] (Alex Martelli) writes: > ...an alleged reply to me, which in fact quotes (and responds to) > only to statements by Brian, without mentioning Brian... > > Mr May, it seems that you're badly confused regarding Usenet's > quoting conventions. It seems that someone pisses in yo

Re: i don't understand this RE example from the documentation

2006-05-08 Thread John Salerno
John Salerno wrote: > Ok, I've been staring at this and figuring it out for a while. I'm close > to getting it, but I'm confused by the examples: > > (?(id/name)yes-pattern|no-pattern) > Will try to match with yes-pattern if the group with given id or name > exists, and with no-pattern if it doe

Re: utility functions within a class?

2006-05-08 Thread John Salerno
Scott David Daniels wrote: > John Salerno wrote: >> Dennis Lee Bieber wrote: >>> ... Single underscores are a convention/signal to the programmer that >>> "this method/attribute" is considered "private" and should only be used >>> by other methods within the class that defined it. The language do

Re: get Windows file type

2006-05-08 Thread dwelch
BartlebyScrivener wrote: > Using Python on Windows XP, I am able to get almost all file and path > info using os.path or stat, but I don't see a way to retrieve the file > type? E.g. Microsoft Word file, HTML file, etc, the equivalent of what > is listed in the "Type" column in the Windows Explorer

i don't understand this RE example from the documentation

2006-05-08 Thread John Salerno
Ok, I've been staring at this and figuring it out for a while. I'm close to getting it, but I'm confused by the examples: (?(id/name)yes-pattern|no-pattern) Will try to match with yes-pattern if the group with given id or name exists, and with no-pattern if it doesn't. |no-pattern is optional an

Re: connect file object to standard output?

2006-05-08 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I think there is a way to connect standard output to a > file, but I'd prefer not to do that, since I want to use plain print > statements to warn about errors in the function and have their output > appear on the screen. Thanks. > > def write_data(data,out_file="")

Re: utility functions within a class?

2006-05-08 Thread Scott David Daniels
John Salerno wrote: > Dennis Lee Bieber wrote: >> ... Single underscores are a convention/signal to the programmer that >> "this method/attribute" is considered "private" and should only be used >> by other methods within the class that defined it. The language does no >> enforcement of usage

Re: python rounding problem.

2006-05-08 Thread Grant Edwards
On 2006-05-08, Thomas Bartkus <[EMAIL PROTECTED]> wrote: >> does python support true rations, which means that 1/3 is a >> true one-third and not 0.3 rounded off at some >> arbitrary precision? > > At risk of being boring ;-) > > - Python supports both rational and irrational numbers as >

Python's DSLs (was: A critic of Guido's blog on Python's lambda)

2006-05-08 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: . . . >Of course, the choice of Python does mean that, when we really truly >need a "domain specific little language", we have to implement it as a >langu

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

2006-05-08 Thread Thomas F. Burdick
Ken Tilton <[EMAIL PROTECTED]> writes: > No, you do not want on-change handlers propagating data to other > slots, though that is a sound albeit primitive way of improving > self-consistency of data in big apps. The productivity win with > VisiCalc was that one simply writes rules that use other c

Re: Using StopIteration

2006-05-08 Thread tkpmep
This is just what the doctor ordered. Thanks, as always, everyone! > By breaking out of the while loop as shown above. > > Peter -- http://mail.python.org/mailman/listinfo/python-list

PyX custom x-labels

2006-05-08 Thread Ronny Mandal
Hello. I need to draw a graph, with letters on the x-axis and a numeric value on the y-axis, e.g.. a = 3, b = 6 etc. Suggestions? Thanks, Ronny Mandal -- http://mail.python.org/mailman/listinfo/python-list

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

2006-05-08 Thread Ken Tilton
Ken Tilton wrote: > > I just keep what I call a "datapulse ID", sequentially growing from > zero, in a global variable. Each ruled Cell keeps track of its memoized > value, datapulse stamp, and whether it in fact changed value in reaching > its current datapulse stamp. (I can reach the curren

Re: converting to scgi

2006-05-08 Thread Damjan
> I'm looking for a scgi modules that make it easy to convert a CGI using > the standard Python CGI module. I'm hoping for something that will run > my program either as scgi or cgi. > > I did find something called paste which purports to be some sort of CGI > Bridge framework but from the docume

Re: utility functions within a class?

2006-05-08 Thread John Salerno
Dennis Lee Bieber wrote: > tOn Mon, 08 May 2006 14:04:34 GMT, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> I tried the underscore method, but I was still able to call it as a >> regular instance method in the interpreter. Is that what's supposed to >> happ

Re: Using StopIteration

2006-05-08 Thread vbgunz
to catch and recover from StopIterations, use this: try: raise StopIteration except StopIteration: print 'caught StopIteration!' # verbose: sys.exc_info() requires import sys -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question: "TypeError" wrong number of args

2006-05-08 Thread Holger
And thank you gentlemen for turning my somewhat banale question into a worthwhile discussion. :-) I shall not forget self ever again! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using StopIteration

2006-05-08 Thread vbgunz
sequence = ['','2'] for index, line in enumerate(sequence): if line.isspace():continue if line[:1].isdigit(): print 'index %s: starts with digit %s' % (index, line[:1]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using StopIteration

2006-05-08 Thread Steve R. Hastings
On Mon, 08 May 2006 11:23:28 -0700, tkpmep wrote: > I create list of files, open each file in turn, skip past all the blank > lines, and then process the first line that starts with a number (see > code below) Here is what I suggest for you: filenames=glob.glob("C:/*.txt") for fn in filenames:

Re: Using StopIteration

2006-05-08 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I create list of files, open each file in turn, skip past all the blank > lines, and then process the first line that starts with a number (see > code below) > > filenames=glob.glob("C:/*.txt") > for fn in filenames: f = open(fn) for line in f: if

Re: python rounding problem.

2006-05-08 Thread Thomas Bartkus
"Gary Wessle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Erik Max Francis <[EMAIL PROTECTED]> writes: > > > chun ping wang wrote: > > > > > Hey i have a stupid question. > > > How do i get python to print the result in only three decimal > > > place... > > > Example>>> round (2.9

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

2006-05-08 Thread Ken Tilton
[Sorry, i was just reading comp.lang.lisp, missed the following till someone mentioned it in email. k] Alex Martelli wrote: > Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: >... > >>>an extension that allows the programmer to specify how the value of >>>some slot (Lisp lingo for "member vari

ALERT - GroupShield ticket number OB20_1147112369_EXCHANGE_3 was generated

2006-05-08 Thread GroupShield for Exchange (EXCHANGE)
Action Taken: The message was quarantined and replaced with a text informing the recipient of the action taken. To: python-list@python.org From: Jorge Vargas <[EMAIL PROTECTED]> Sent: -235532672,29782731 Subject: help with Linker dependencies missing went compiling mysql-python on Windows with

Using StopIteration

2006-05-08 Thread tkpmep
I create list of files, open each file in turn, skip past all the blank lines, and then process the first line that starts with a number (see code below) filenames=glob.glob("C:/*.txt") for fn in filenames: f =file(fn) line = " " while line[0] not in digits: line = f.next()

Re: Getting HTTP responses - a python linkchecking script.

2006-05-08 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Rene Pijlman wrote: >> [EMAIL PROTECTED]: >>> with urllib2 it doesn't seem possible to get HTTP status codes. >> except urllib2.HTTPError, e: >> if e.code == 403: > > Thanks. Is there documentation for this available somewhere online, I > can't see i

Re: utility functions within a class?

2006-05-08 Thread Scott David Daniels
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 the class it

Re: Logging vs printing

2006-05-08 Thread alisonken1
Leo Breebaart wrote: > Also, assume that I have set it up as above. Now I want certain > other print statements to go to sys.stderr alone. If I understand > the docs correctly (possibly I don't), the way to do this is to > start attaching explicit StreamHandlers and whatnot. Whereas with > print

Re: which is better, string concatentation or substitution?

2006-05-08 Thread John Salerno
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > John Salerno <[EMAIL PROTECTED]> wrote: >> Roy Smith wrote: >> >>> OK, here's a quick tutorial to "big-oh" notation. >> Wow, that was fantastic (and interesting)! Did you just write that? That >> should be saved somewhere! Mind if I post it on

  1   2   3   >