PPC floating equality vs. byte compilation

2005-07-09 Thread Donn Cave
I ran into a phenomenon that seemed odd to me, while testing a build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. test_builtin.py, for example, fails a couple of tests with errors claiming that apparently identical floating point values aren't equal. But it only does that when imported, and

Re: why UnboundLocalError?

2005-07-09 Thread Bengt Richter
On Fri, 8 Jul 2005 21:21:36 -0500, Alex Gittens [EMAIL PROTECTED] wrote: I'm trying to define a function that prints fields of given widths with specified alignments; to do so, I wrote some helper functions nested inside of the print function itself. I'm getting an UnboundLocalError, and after

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Bengt Richter
On Fri, 08 Jul 2005 22:29:30 -0600, Steven Bethard [EMAIL PROTECTED] wrote: Dennis Lee Bieber wrote: On Fri, 08 Jul 2005 16:07:50 -0600, Steven Bethard [EMAIL PROTECTED] declaimed the following in comp.lang.python: I only searched a few relatively recent threads in c.l.py, so there are

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Ron Adam
Leif K-Brooks wrote: Kay Schluehr wrote: list.from_str(abc) list(a, b, c ) I assume we'll also have list.from_list, list.from_tuple, list.from_genexp, list.from_xrange, etc.? List from list isn't needed, nor list from tuple. That's what the * is for. And for that matter neither is

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Kay Schluehr
Leif K-Brooks schrieb: Kay Schluehr wrote: list.from_str(abc) list(a, b, c ) I assume we'll also have list.from_list, list.from_tuple, list.from_genexp, list.from_xrange, etc.? One might unify all those factory functions into a single list.from_iter that dispatches to the right

Re: Python Module Exposure

2005-07-09 Thread George Sakkis
Jacob Page wrote: Thomas Lotze wrote: Jacob Page wrote: better-named, Just a quick remark, without even having looked at it yet: the name is not really descriptive and runs a chance of misleading people. The example I'm thinking of is using zope.interface in the same project: it's

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-09 Thread Ralf W. Grosse-Kunstleve
--- NickC [EMAIL PROTECTED] wrote: I'd be very interested to hear your opinion on the 'namespace' module, which looks at addressing some of these issues (the Record object, in particular). The URL is http://namespace.python-hosting.com, and any comments should be directed to the [EMAIL

Re: Lisp development with macros faster than Python development?..

2005-07-09 Thread Kay Schluehr
Kirk Job Sluder schrieb: Kay Schluehr [EMAIL PROTECTED] writes: This might be a great self experience for some great hackers but just annoying for others who used to work with modular standard librarys and think that the border of the language and an application should be somehow fixed

Hosting Python projects

2005-07-09 Thread Kay Schluehr
Jacob Page schrieb: I have created what I think may be a useful Python module, but I'd like to share it with the Python community to get feedback, i.e. if it's Pythonic. If it's considered useful by Pythonistas, I'll see about hosting it on Sourceforge or something like that. Is this a good

Re: Pattern question

2005-07-09 Thread cantabile
Scott David Daniels a écrit : cantabile wrote: bruno modulix a écrit : You may want to have a look at the Factory pattern... ... demo of class Factory ... Taking advantage of Python's dynamic nature, you could simply: # similarly outrageously oversimplified dummy example

file.readlines() question

2005-07-09 Thread vch
Does a call to file.readlines() reads all lines at once in the memory? Are the any reasons, from the performance point of view, to prefer *while* loop with readline() to *for* loop with readlines()? -- http://mail.python.org/mailman/listinfo/python-list

Re: file.readlines() question

2005-07-09 Thread Erik Max Francis
vch wrote: Does a call to file.readlines() reads all lines at once in the memory? Are the any reasons, from the performance point of view, to prefer *while* loop with readline() to *for* loop with readlines()? Yes, and you just mentioned it. .readlines reads the entire file into memory at

Re: file.readlines() question

2005-07-09 Thread vch
Erik Max Francis wrote: ... modern versions of Python allow iteration over a file, which will read it line by line: for line in aFile: ... Thanks! Just what I need. -- http://mail.python.org/mailman/listinfo/python-list

__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Ralf W. Grosse-Kunstleve
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object): def __init__(self, *args, **keyword_args): self.__dict__.update(

directory traverser

2005-07-09 Thread Florian Lindner
Hello, IIRC there is a directory traverser for walking recursively through subdirectories in the standard library. But I can't remember the name and was unable to find in the docs. Anyone can point me to it? Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

ANN: eric3 3.7.1 available

2005-07-09 Thread Detlev Offenbach
Hi, I am proud to announce the availability of eric3 3.7.1. This is a bug fix release which fixes a severe bug next to some normal ones. NOTE: Everybody using 3.7.0 or 3.6.x should upgrade. It is available via http://www.die-offenbachs.de/detlev/eric3.html. What is it? --- Eric3 is a

Re: directory traverser

2005-07-09 Thread John Machin
Florian Lindner wrote: Hello, IIRC there is a directory traverser for walking recursively through subdirectories in the standard library. But I can't remember the name and was unable to find in the docs. Where did you look? How did you look? Anyone can point me to it? Did you try Googling

Formatting data to output in web browser from web form

2005-07-09 Thread Harlin Seritt
Hi, I am using CherryPy to make a very small Blog web app. Of course I use a textarea input on a page to get some information. Most of the time when text is entered into it, there will be carriage returns. When I take the text and then try to re-write it out to output (in html on a web page), I

Problem with sha.new

2005-07-09 Thread Florian Lindner
Hello, I try to compute SHA hashes for different files: for root, dirs, files in os.walk(sys.argv[1]): for file in files: path = os.path.join(root, file) print path f = open(path) sha = sha.new(f.read()) sha.update(f.read()) print

Re: Formatting data to output in web browser from web form

2005-07-09 Thread John Machin
Harlin Seritt wrote: Hi, I am using CherryPy to make a very small Blog web app. Of course I use a textarea input on a page to get some information. Most of the time when text is entered into it, there will be carriage returns. When I take the text and then try to re-write it out to

Re: Problem with sha.new

2005-07-09 Thread John Machin
Florian Lindner wrote: Hello, I try to compute SHA hashes for different files: for root, dirs, files in os.walk(sys.argv[1]): for file in files: path = os.path.join(root, file) print path f = open(path) print sha is, repr(sha) ### self-help !

Re: Problem with sha.new

2005-07-09 Thread Dan Sommers
On Sat, 09 Jul 2005 13:49:12 +0200, Florian Lindner [EMAIL PROTECTED] wrote: Hello, I try to compute SHA hashes for different files: for root, dirs, files in os.walk(sys.argv[1]): for file in files: path = os.path.join(root, file) print path f = open(path)

Re: why UnboundLocalError?

2005-07-09 Thread and-google
Alex Gittens wrote: I'm getting an UnboundLocalError def fieldprint(widths,align,fields): [...] def cutbits(): [...] fields = fields[widths[i]:] There's your problem. You are assigning 'fields' a completely new value. Python doesn't allow you to rebind a variable from an outer

Re: Problem with sha.new

2005-07-09 Thread Rob Williscroft
Florian Lindner wrote in news:[EMAIL PROTECTED] in comp.lang.python: Hello, I try to compute SHA hashes for different files: for root, dirs, files in os.walk(sys.argv[1]): for file in files: path = os.path.join(root, file) print path f = open(path) Here

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Kay Schluehr
Ralf W. Grosse-Kunstleve schrieb: My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... Well ... yes ;) Ralf, if you want to modify the class instantiation behaviour you should have a look on metaclasses. That's what they

Re: PPC floating equality vs. byte compilation

2005-07-09 Thread Andrew MacIntyre
Donn Cave wrote: I ran into a phenomenon that seemed odd to me, while testing a build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. test_builtin.py, for example, fails a couple of tests with errors claiming that apparently identical floating point values aren't equal. But it only does that

pyo contains absolute paths

2005-07-09 Thread David Siroky
Hi! When I compile my python files with python -OO into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? Thank you. David -- http://mail.python.org/mailman/listinfo/python-list

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Peter Hansen
Bengt Richter wrote: On Fri, 08 Jul 2005 22:29:30 -0600, Steven Bethard [EMAIL PROTECTED] wrote: (1) There's no reason to get uncomfortable even if they're removed. You'd just replace [] with list(). So list(1, 2, 3) will be the same as [1, 2, 3] ?? No, the discussion is about list

Re: pyo contains absolute paths

2005-07-09 Thread Peter Hansen
David Siroky wrote: When I compile my python files with python -OO into pyo files then they still contain absolute paths of the source files which is undesirable for me. How can I deal with that? Don't do that? Delete the pyo files? Stop using Python? I could guess at a few more

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Raymond Hettinger
In all probability, both list comprehensions and generator expressions will be around in perpetuity. List comps have been a very successful language feature. The root of this discussion has been the observation that a list comprehension can be expressed in terms of list() and a generator

Re: FORTRAN like formatting

2005-07-09 Thread Cyril Bazin
Ok, dennis, your solution may be better, but is quite dangerous: Python can't handle if there is exactly 3 arguments passed to the function. The created code is correct but the error will appear when your run Fortran. Cyril On 7/9/05, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Fri, 8 Jul

Re: FORTRAN like formatting

2005-07-09 Thread beliavsky
Dennis Lee Bieber wrote: On 7/8/05, Einstein, Daniel R [EMAIL PROTECTED] wrote: Hi, Sorry for this, but I need to write ASCII from my Python to be read by FORTRAN and the formatting is very important. Is there any way of doing anything like: write(*,'(3( ,1pe20.12))')

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Bengt Richter
On Sat, 09 Jul 2005 10:16:17 -0400, Peter Hansen [EMAIL PROTECTED] wrote: Bengt Richter wrote: On Fri, 08 Jul 2005 22:29:30 -0600, Steven Bethard [EMAIL PROTECTED] wrote: (1) There's no reason to get uncomfortable even if they're removed. You'd just replace [] with list(). So list(1, 2, 3)

Re: why UnboundLocalError?

2005-07-09 Thread Bengt Richter
On 9 Jul 2005 05:26:46 -0700, [EMAIL PROTECTED] wrote: Alex Gittens wrote: I'm getting an UnboundLocalError def fieldprint(widths,align,fields): [...] def cutbits(): [...] fields = fields[widths[i]:] There's your problem. You are assigning 'fields' a completely new value.

Re: PPC floating equality vs. byte compilation

2005-07-09 Thread Tim Peters
[Donn Cave] I ran into a phenomenon that seemed odd to me, while testing a build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. test_builtin.py, for example, fails a couple of tests with errors claiming that apparently identical floating point values aren't equal. But it only does that when

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread John Roth
Raymond Hettinger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In all probability, both list comprehensions and generator expressions will be around in perpetuity. List comps have been a very successful language feature. The root of this discussion has been the observation that

Re: Defending Python

2005-07-09 Thread Donn Cave
Quoth Dave Cook [EMAIL PROTECTED]: | On 2005-07-08, Charlie Calvert [EMAIL PROTECTED] wrote: | | I perhaps rather foolishly wrote two article that mentioned Python as a | good alternative language to more popular tools such as C# or Java. I | | Sounds like a really hidebound bunch over there.

Re: Defending Python

2005-07-09 Thread Brian
Raymond Hettinger wrote: So, I would recommend Python to these folks as an easily acquired extra skill. I agree 100% with your statement above. Python may not be sufficient for being the only programming language that one needs to know -- yet, it does come in VERY handy for projects that

Re: Defending Python

2005-07-09 Thread Grant Edwards
On 2005-07-09, Brian [EMAIL PROTECTED] wrote: folks as an easily acquired extra skill. I agree 100% with your statement above. Python may not be sufficient for being the only programming language that one needs to know -- yet, it does come in VERY handy for projects that need to perform

About undisclosed recipient

2005-07-09 Thread bartek . rylko
Hi all, Any one got idea about how to set undisclosed recipient? I put all recipient in BCC field while the To field don't want to leave blank. but neither fail to place an empty email address nor i don't want to put my own email address inside. www.bartekrr.info --

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread George Sakkis
Raymond Hettinger [EMAIL PROTECTED] wrote: In all probability, both list comprehensions and generator expressions will be around in perpetuity. List comps have been a very successful language feature. The root of this discussion has been the observation that a list comprehension can be

Re: why UnboundLocalError?

2005-07-09 Thread Bengt Richter
On Sat, 09 Jul 2005 06:17:20 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: On Fri, 8 Jul 2005 21:21:36 -0500, Alex Gittens [EMAIL PROTECTED] wrote: I'm trying to define a function that prints fields of given widths with specified alignments; to do so, I wrote some helper functions nested inside

Re: calling python procedures from tcl using tclpython

2005-07-09 Thread Jonathan Ellis
Jeff Hobbs wrote: chand wrote: can anyone help me how to provide the info about the python file procedure in the tcl script which uses tclpython i.e., is there a way to import that .py file procedure in the tcl script currently I have wriiten this tcl code which is not working package

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread John Roth
George Sakkis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's funny how one of the arguments for removing lambda -- you can do the same by defining a named function -- does not apply for list comprehensions. Which is a point a number of people have made many times, with about

Re: About undisclosed recipient

2005-07-09 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Hi all, Any one got idea about how to set undisclosed recipient? I put all recipient in BCC field while the To field don't want to leave blank. but neither fail to place an empty email address nor i don't want to put my own email address inside. www.bartekrr.info

Should I use if or try (as a matter of speed)?

2005-07-09 Thread Steve Juranich
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a n00b. I dutifully evangelize on the goodness of Python whenever I talk with fellow developers, but I always hit a snag when it comes to

Re: Lisp development with macros faster than Python development?..

2005-07-09 Thread Kirk Job Sluder
Kay Schluehr [EMAIL PROTECTED] writes: Kirk Job Sluder schrieb: In what way do lisp macros prevent the creation of modular libraries? Common Lisp does does have mechanisms for library namespaces, and in practice a macro contained within a library is not that much different from a

Re: Having trouble importing against PP2E files

2005-07-09 Thread Charles Krug
On Fri, 08 Jul 2005 22:43:55 +0300, Elmo Mäntynen [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Import Error: no module named PP2E.launchmodes However if I copy launchmodes.py into my work directory, it imports successfully. Both Examples above and

Re: Python Module Exposure

2005-07-09 Thread Jacob Page
George Sakkis wrote: Jacob Page [EMAIL PROTECTED] wrote: George Sakkis wrote: 1. As already noted, ISet is not really descriptive of what the class does. How about RangeSet ? It's not that long and I find it pretty descriptive. In this case, it would be a good idea to change Interval to Range

Re: About undisclosed recipient

2005-07-09 Thread Jeff Epler
You provided far too little information for us to be able to help. If you are using smtplib, it doesn't even look at message's headers to find the recipient list; you must use the rcpt() method to specify each one. If you are using the sendmail method, the to_addrs list has no relationship to

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread ncf
Honestly, I'm rather new to python, but my best bet would be to create some test code and time it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Module Exposure

2005-07-09 Thread George Sakkis
Jacob Page [EMAIL PROTECTED] wrote: George Sakkis wrote: There are several possible use cases where dealing directly with intervals would be appropriate or necessary, so it's good to have them supported directly by the module. I think I will keep Interval exposed. It sort of raises a

Re: pyo contains absolute paths

2005-07-09 Thread ncf
Python is compiling the files with absolute paths because it is much faster to load a file when you know where it is, than to have to find it and then load it. I'm guessing you're wondering this so you can distribute it compiled or such? If so, I wouldn't do that in the first place. Python's

How long is a piece of string? How big's a unit?

2005-07-09 Thread esther
I'm working on my monthly column for Software Test Performance magazine, and I'd like your input. The topic, this time around, is unit testing (using python or anything else). Care to share some of your hard-won knowledge with your peers? In particular, what I'm looking for are experiences and

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread [EMAIL PROTECTED]
My shot would be to test it like this on your platform like this: #!/usr/bin/env python import datetime, time t1 = datetime.datetime.now() for i in [str(x) for x in range(100)]: if int(i) == i: i + 1 t2 = datetime.datetime.now() print t2 - t1 for i in [str(x) for x in

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Roy Smith
Steve Juranich [EMAIL PROTECTED] wrote: Without fail, when I start talking with some of the old-timers (people who have written code in ADA or Fortran), I hear the same arguments that using if is better than using try. Well, you've now got a failure. I used to write Fortran on punch cards, so

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Wezzy
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: My shot would be to test it like this on your platform like this: #!/usr/bin/env python import datetime, time t1 = datetime.datetime.now() for i in [str(x) for x in range(100)]: if int(i) == i: i + 1 t2 =

Re: Another newbie question from Nathan.

2005-07-09 Thread Nathan Pinno
Hi all, How do I make Python get a def? Is it the get function, or something else? I need to know so that I can get a def for that computer MasterMind(tm) game that I'm writing. BTW, I took your advice, and wrote some definitions for my Giant Calculator program. Might make the code

Re: PPC floating equality vs. byte compilation

2005-07-09 Thread Terry Reedy
Tim Peters [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [Donn Cave] I ran into a phenomenon that seemed odd to me, while testing a build of Python 2.4.1 on BeOS 5.04, on PowerPC 603e. test_builtin.py, for example, fails a couple of tests with errors claiming that apparently

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : My shot would be to test it like this on your platform like this: #!/usr/bin/env python import datetime, time Why not use the timeit module instead ? t1 = datetime.datetime.now() for i in [str(x) for x in range(100)]: A bigger range (at least 10/100x more)

Re: Defending Python

2005-07-09 Thread Bruno Desthuilliers
Grant Edwards a écrit : On 2005-07-09, Brian [EMAIL PROTECTED] wrote: folks as an easily acquired extra skill. I agree 100% with your statement above. Python may not be sufficient for being the only programming language that one needs to know -- yet, it does come in VERY handy for

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Terry Reedy
Steve Juranich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Without fail, when I start talking with some of the old-timers (people who have written code in ADA or Fortran), I hear the same arguments that using if is better than using try. I think that the argument goes

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Thorsten Kampe
* Steve Juranich (2005-07-09 19:21 +0100) I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a n00b. I dutifully evangelize on the goodness of Python whenever I talk with fellow

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Terry Reedy
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My shot would be to test it like this on your platform like this: #!/usr/bin/env python import datetime, time t1 = datetime.datetime.now() for i in [str(x) for x in range(100)]: if int(i) == i: i + 1 t2 =

Yet Another Python Web Programming Question

2005-07-09 Thread Daniel Bickett
This post started as an incredibly long winded essay, but halfway through I decided that was a terribly bad idea, so I've trimmed it down dramatically, and put it in the third person (for humor's sake). Once upon a time a boy named Hypothetical programmed in PHP and made many a web application.

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread John Roth
Thorsten Kampe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Steve Juranich (2005-07-09 19:21 +0100) I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a n00b. I dutifully

ImportError: No module named numarray

2005-07-09 Thread enas khalil
dear all could you tell me how can i fix this error appears when i try to import modules from nltk as follows from nltk.probability import ConditionalFreqDist Traceback (most recent call last): File "pyshell#1", line 1, in -toplevel- from nltk.probability import ConditionalFreqDist File

decorators as generalized pre-binding hooks

2005-07-09 Thread Bengt Richter
;-) We have @deco def foo(): pass as sugar (unless there's an uncaught exception in the decorator) for def foo(): pass foo = deco(foo) The binding of a class name is similar, and class decorators would seem natural, i.e., @cdeco class Foo: pass for class Foo: pass

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Thomas Lotze
Steve Juranich wrote: I was wondering how true this holds for Python, where exceptions are such an integral part of the execution model. It seems to me, that if I'm executing a loop over a bunch of items, and I expect some condition to hold for a majority of the cases, then a try block would

Re: Yet Another Python Web Programming Question

2005-07-09 Thread Devan L
Take some time to learn one of the web frameworks. If your host doesn't already have it, ask your host if they would consider adding it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Peter Hansen
Thomas Lotze wrote: Steve Juranich wrote: What do I mean by cheaper? I'm basically talking about the number of instructions that are necessary to set up and execute a try block as opposed to an if block. I don't know about the implementation of exceptions but I suspect most of what try does

Re: ImportError: No module named numarray

2005-07-09 Thread Robert Kern
enas khalil wrote: dear all could you tell me how can i fix this error appears when i try to import modules from nltk as follows from nltk.probability import ConditionalFreqDist Traceback (most recent call last): File pyshell#1, line 1, in -toplevel- from nltk.probability import

already written optparse callback for range and list arguments?

2005-07-09 Thread Alex Gittens
I would like my program to accept a list of range values on the command line, like -a 1 -a 1-10 -a 4,5,2 In the interest of avoiding reinventing the wheel, is there already available code for a callback that would enable optparse to parse these as arguments? Thanks, Alex -- ChapterZero:

Re: Yet Another Python Web Programming Question

2005-07-09 Thread Dave Brueck
Daniel Bickett wrote: He would read the documentation of Nevow, Zope, and Quixote, and would find none of them to his liking because: * They had a learning curve, and he was not at all interested, being eager to fulfill his new idea for the web app. It was his opinion that web programming

Re: Use cases for del

2005-07-09 Thread Scott David Daniels
Ron Adam wrote: George Sakkis wrote: I get: None: 0.54952316 String: 0.498000144958 is None: 0.45047684 What do yo get for name is 'string' expressions? 'abc' is 'abcd'[:3] False You need to test for equality (==), not identity (is) when equal things may be

Re: Yet Another Python Web Programming Question

2005-07-09 Thread Jonathan Ellis
Daniel Bickett wrote: He would read the documentation of Nevow, Zope, and Quixote, and would find none of them to his liking because: * They had a learning curve, and he was not at all interested, being eager to fulfill his new idea for the web app. It was his opinion that web programming

Re: Yet Another Python Web Programming Question

2005-07-09 Thread Luis M. Gonzalez
Try Karrigell ( http://karrigell.sourceforge.net ). And let me know what you think... Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Ralf W. Grosse-Kunstleve
--- Kay Schluehr [EMAIL PROTECTED] wrote: Ralf, if you want to modify the class instantiation behaviour you I don't. I simply want to give the user a choice: __init__(self, ...) # same as always (no modification) or __autoinit__(self, ...) # self.x=x job done automatically and

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Ralf W. Grosse-Kunstleve
Sorry, I forgot the attachment. Sell on Yahoo! Auctions – no fees. Bid on great items. http://auctions.yahoo.com/import sys, os class plain_grouping: def __init__(self, x, y, z): self.x = x self.y = y self.z =

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Scott David Daniels
Ralf W. Grosse-Kunstleve wrote: My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object): def __init__(self, *args, **keyword_args):

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Ralf W. Grosse-Kunstleve
--- Scott David Daniels [EMAIL PROTECTED] wrote: Should be: class autoinit(object): def __init__(self, *args, **keyword_args): for name, value in zip(self.__autoinit__.im_func.func_code. co_varnames[1:], args):

Re: Defending Python

2005-07-09 Thread Jorey Bump
Bruno Desthuilliers [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Grant Edwards a écrit : On 2005-07-09, Brian [EMAIL PROTECTED] wrote: folks as an easily acquired extra skill. I agree 100% with your statement above. Python may not be sufficient for being the only programming

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread John Machin
Roy Smith wrote: Well, you've now got a failure. I used to write Fortran on punch cards, which were then fed into an OCR gadget? That's an efficient approach -- where I was, we had to write the FORTRAN [*] on coding sheets; KPOs would then produce the punched cards. [snip] 3) In some

Re: Python Module Exposure

2005-07-09 Thread Jacob Page
George Sakkis wrote: Jacob Page [EMAIL PROTECTED] wrote: I think I will keep Interval exposed. It sort of raises a bunch of hard-to-answer design questions having two class interfaces, though. For example, would Interval.between(2, 3) + Interval.between(5, 7) raise an error (as it currently

ANN: interval module 0.2.0 (alpha)

2005-07-09 Thread Jacob Page
After some feedback from this newsgroup, I've updated and renamed the iset module to the interval module. Many of the names within the module have also changed, and I've refactored a lot of the code. The updated version can be found at http://members.cox.net/apoco/interval/, as well as a

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Steven Bethard
Devan L wrote: import timeit t1 = timeit.Timer('list(i for i in xrange(10))') t1.timeit() 27.267753024476576 t2 = timeit.Timer('[i for i in xrange(10)]') t2.timeit() 15.050426800054197 t3 = timeit.Timer('list(i for i in xrange(100))') t3.timeit() 117.61078097914682 t4 =

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Steven Bethard
Raymond Hettinger wrote: The root of this discussion has been the observation that a list comprehension can be expressed in terms of list() and a generator expression. As George Sakkis already noted, the root of the discussion was actually the rejection of the dict comprehensions PEP.

Re: Yet Another Python Web Programming Question

2005-07-09 Thread and-google
Daniel Bickett wrote: Python using CGI, for example, was enough for him until he started getting 500 errors that he wasn't sure how to fix. Every time you mention web applications on this list, there will necessarily be a flood of My Favourite Framework Is X posts. But you* sound like you

Re: already written optparse callback for range and list arguments?

2005-07-09 Thread Peter Hansen
Alex Gittens wrote: I would like my program to accept a list of range values on the command line, like -a 1 -a 1-10 -a 4,5,2 In the interest of avoiding reinventing the wheel, is there already available code for a callback that would enable optparse to parse these as arguments? Doesn't

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Steven D'Aprano
On Sat, 09 Jul 2005 23:10:49 +0200, Thomas Lotze wrote: Steve Juranich wrote: I was wondering how true this holds for Python, where exceptions are such an integral part of the execution model. It seems to me, that if I'm executing a loop over a bunch of items, and I expect some condition

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Raymond Hettinger
[Steven Bethard] I would hope that in Python 3.0 list comprehensions and generator expressions would be able to share a large amount of implementation, and thus that the speed differences would be much smaller. But maybe not... Looking under the hood, you would see that the implementations

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Raymond Hettinger
[Raymond Hettinger] It is darned inconvenient to get an iterator when you really need a list, when you want to slice the result, when you want to see a few elements through repr(), and when you need to loop over the contents more than once. [George Sakkis] Similar arguments can be given

importing files from a directory

2005-07-09 Thread spike grobstein
I'm a total Python newbie, so bear with me here... I'm writing a program that has a user-configurable, module-based architecture. it's got a directory where modules are stored (.py files) which subclass one of several master classes. My plan is to have the program go into the folder called

Python Forum

2005-07-09 Thread Throne Software
Throne Software has opened up a Python Forum at: http://www.thronesoftware.com/forum/ Join us! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Forum

2005-07-09 Thread Devan L
I see a total of 12 posts and 8 users. -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I use if or try (as a matter of speed)?

2005-07-09 Thread Jorey Bump
Steve Juranich [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: I was wondering how true this holds for Python, where exceptions are such an integral part of the execution model. It seems to me, that if I'm executing a loop over a bunch of items, and I expect some condition to hold for a

Re: removing list comprehensions in Python 3.0

2005-07-09 Thread Steven Bethard
Raymond Hettinger wrote: [Steven Bethard] I would hope that in Python 3.0 list comprehensions and generator expressions would be able to share a large amount of implementation, and thus that the speed differences would be much smaller. But maybe not... Looking under the hood, you would see

Re: Yet Another Python Web Programming Question

2005-07-09 Thread Daniel Bickett
I neglected to mention an important fact, and that is the fact that I am limited to Apache, which elminates several suggestions (that are appreciated none-the-less). -- Daniel Bickett dbickett at gmail.com http://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list

bsddb environment lock failure

2005-07-09 Thread Barry
I have python2.4.1 installed on two machines: -- one is Fedora core 1, where the bsddb module works fine -- one is Redhat ES 3.0, and I installed mysql 4.1 (and mysql-python2.1) after putting the newer python on the machine. python2.2, which came with Redhat ES, works fine, so I suppose I messed

Re: __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

2005-07-09 Thread Kay Schluehr
I stripped your code down to the essence. See attachment. For the user your approach then becomes: class grouping: __metaclass__ = autoattr def __init__(self, x, y, z): pass No. This is clearly NOT what I had in mind. I translated your original proposal which introduced a

  1   2   >