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

2005-07-09 Thread Dark Cowherd
http://www.joelonsoftware.com/items/2003/10/13.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Module Exposure

2005-07-09 Thread Jacob Page
George Sakkis wrote: > "Jacob Page" <[EMAIL PROTECTED]> wrote: > >>I selected option one; Intervals are immutable. However, this doesn't >>mean that __add__ has to go, as that function has no side-effects. The >>reason I chose option one was because it's uncommon for a mathematical >>operation o

RE: Yet Another Python Web Programming Question

2005-07-09 Thread Robert Brewer
Daniel Bickett wrote: > 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). Do you have access to mod_python, mod_rewrite, FastCGI, or SCGI? Then CherryPy 2.1 is still a great opti

Re: Python Module Exposure

2005-07-09 Thread George Sakkis
"Jacob Page" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > As I see it, there are two main options you have: > > > > 1. Keep Intervals immutable and pass all the responsibility of > > combining them to IntervalSet. In this case Interval.__add__ would have > > to go. This is simple to imple

Re: decorators as generalized pre-binding hooks

2005-07-09 Thread Ron Adam
Bengt Richter wrote: > ;-) > We have Have we? Looks like not a lot of interested takers so far. But I'll bite. ;-) > So why not > > @deco > foo = lambda:pass > equivalent to > foo = deco(lambda:pass) > > and from there, > @deco > = > being equivalent to > = deco(

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 introdu

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

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 w

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 f

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

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

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

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 b

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

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?

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 do

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

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

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 chan

Re: Use cases for del

2005-07-09 Thread Ron Adam
Scott David Daniels wrote: > 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 Well of course it

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

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

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: __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): > self

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

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

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 t

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 programm

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: http://t

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 "", line 1, in -toplevel- > from nltk.probability impor

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 wha

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

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

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 "", line 1, in -toplevel-    from nltk.probability import  ConditionalFreqDist  File "C:\Python

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

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

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 >

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 deve

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 argumen

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 ha

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 mor

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

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 eas

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 = datetime.

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 pun

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 range

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

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

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

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

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

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

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 d

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 J

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

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

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

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 c

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 -- http://mail.python.org/mailman

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 p

Re: Python Module Exposure

2005-07-09 Thread George Sakkis
"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 to

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

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 observat

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

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

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

Re: Defending Python

2005-07-09 Thread Raymond Hettinger
The posts do share an erroneous, implied assumption that the investment in learning each language is equal. Python has a strong competitive advantage over Java and C++ in terms of learnability. A person can get up to speed in a few days with Python. That certainly is not true for C++ which is mo

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

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 2

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 expressi

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

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

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

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 oute

Re: pygtk does ... ?

2005-07-09 Thread Dave Cook
On 2005-07-08, Thomas Bartkus <[EMAIL PROTECTED]> wrote: > Why would I want to "import pygtk" with it's single function > "require(version)"? > What is it supposed to do? Where does it fit in? The only reason I can think of is to use pygtk.require, so you can specify which major version of pygtk

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(

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 and-google
Florian Lindner wrote: > sha = sha.new(f.read()) > this generates a traceback when sha.new() is called for the second time You have reassigned the variable 'sha'. First time around, sha is the sha module object as obtained by 'import sha'. Second time around, sha is the SHA hashing obje

Re: Defending Python

2005-07-09 Thread Dave Cook
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. Good luck. Dave Cook -- http://mail.pyt

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 ou

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 sha.hexdigest

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

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 Googl

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 Py

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

Re: Python Module Exposure

2005-07-09 Thread Jacob Page
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 to make the association easier. The reason I decided

__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( zip(self.__autoinit__.im_fun

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

  1   2   >