Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Steven Bethard
Bengt Richter wrote: So, e.g., for >>> presets = dict(a=1, b=2, deftime=__import__('time').ctime()) in the decorator args, the next version will act as if the decorated function had the source code >>> print '%s = __frompresets__' % ', '.join(sorted(presets)) a, b, deftime = __frompresets__ for

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Bengt Richter
On Sun, 23 Jan 2005 13:14:10 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> On Sat, 22 Jan 2005 16:22:33 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> >> [Steven Bethard] > If you really want locals that don't contribute to arguments, I'd be > much happie

Re: Asynchronous event handling...?

2005-01-23 Thread Fredrik Lundh
Chris Line wrote: > When the 'stop' button is selected after 'count', it does > not execute until the count command finishes at 500. > Instead, it is desired to stop counting immediately and > execute the 'stop' method. > > Is there a simple way to handle this situation? calling self.update() at

Re: how to write a tutorial

2005-01-23 Thread alex23
Daniel Bickett wrote: > You guys are just begging for a YHBT ;-) Point taken :) I've noticed very few people even acknowledge his posts at all; I'll follow the group lead and do the same. Cheers! - alex23 -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-01-23 Thread alex23
Daniel Bickett wrote: > Chris Mattern wrote: > > alex23 wrote: > > > > > Having read your comments on women, > > > > I hadn't looked at that part of his site until now. I can only say: > > gah. Haven't seen something like that since Dave Sim's infamous > > "Tangent" essay. > > It's painfully obvi

Re: best way to do a series of regexp checks with groups

2005-01-23 Thread Nick Craig-Wood
Mark Fanty <[EMAIL PROTECTED]> wrote: > In perl, I might do (made up example just to illustrate the point): > > if(/add (\d+) (\d+)/) { >do_add($1, $2); > } elsif (/mult (\d+) (\d+)/) { >do_mult($1,$2); > } elsif(/help (\w+)/) { >show_help($1); > } There was a thread about this r

Re: Automatic Windows printer creation?

2005-01-23 Thread Alan Gauld
On Wed, 19 Jan 2005 14:35:22 -0500, "GMane Python" <[EMAIL PROTECTED]> wrote: > Anyone know if there's a module which will allow me to 'create' windows > printer definitions? Not from a Windows domain network, but just to add a > printer that sends to a jet-direct-attached printer. The easiest w

Re: compile python to binary

2005-01-23 Thread sam
Peter Hansen wrote: Daniel Bickett wrote: Fredrik Lundh wrote: oh, you mean that "python compiler" didn't mean "the python compiler". [snip] I simply inferred that he was using the wrong terminology, being that he said "binary" twice ;-) While I suspect you've guessed correctly at what the OP mea

Re: compile python to binary

2005-01-23 Thread sam
Fredrik Lundh wrote: Daniel Bickett wrote: I believe Sam was talking about "frozen" python scripts using tools such as py2exe: oh, you mean that "python compiler" didn't mean "the python compiler". here are links to some more tools, btw: http://effbot.org/zone/python-compile.htm Thanks for th

Re: how to write a tutorial

2005-01-23 Thread Daniel Bickett
Daniel Bickett wrote: > [snip] > You guys are just begging for a YHBT ;-) I apologize, that should have been "we" -- I was criticizing him too. no-one-wants-to-be-a-hypocrite-ly y'rs, Daniel Bickett -- http://mail.python.org/mailman/listinfo/python-list

Asynchronous event handling...?

2005-01-23 Thread Chris Line
The application below has two buttons, 'count' and 'stop'.   When the 'stop' button is selected after 'count', it does not execute until the count command finishes at 500.  Instead, it is desired to stop counting immediately and execute the 'stop' method.   Is there a simple way to handle this situ

Re: how to write a tutorial

2005-01-23 Thread Daniel Bickett
Chris Mattern wrote: > alex23 wrote: > > > Having read your comments on women, > > I hadn't looked at that part of his site until now. I can only say: > gah. Haven't seen something like that since Dave Sim's infamous > "Tangent" essay. It's painfully obvious that it is all for the sole purpose

Help with Threading

2005-01-23 Thread Philip Smith
Hi I am fairly new to Python threading and my needs are simple(!) I want to establish a number of threads each of which work on the same computationally intensive problem in different ways. I am using the thread module rather than the threading module. My problem is I can't see how (when one t

Re: Fuzzy matching of postal addresses

2005-01-23 Thread Joseph Turian
Andrew, > Basically, I have two databases containing lists of postal addresses and > need to look for matching addresses in the two databases. More > precisely, for each address in database A I want to find a single > matching address in database B. What percent of addresses in A have a unique co

Re: Determining if a client PC has an Internet connection

2005-01-23 Thread Dave Brueck
torment wrote: [snip] Have you tried just parsing the output from the command "ipconfig"? It's pretty obvious from the output that might give you if a connection is availible. It's tempting to use ipconfig's output, but the info it gives you is unreliable - you can incorrectly infer the presence o

Re: how to write a tutorial

2005-01-23 Thread Chris Mattern
alex23 wrote: > Having read your comments on women, I hadn't looked at that part of his site until now. I can only say: gah. Haven't seen something like that since Dave Sim's infamous "Tangent" essay. -- Christopher Mattern "Which one you figure tracked us?" "The ugly one, sir.

Re: JPype and classpath (Was Re: embedding jython in CPython... )

2005-01-23 Thread Steve Menard
[EMAIL PROTECTED] wrote: Thanks for the response. However, I continue to have problems. Allow me to give some more detail. For simplicity of testing, I hard coded the classpath and JVM path (BTW getDefaultJVMPath() returns None on my system) import os, os.path from jpype import * startJVM("C:/jdk1.

Re: how to write a tutorial

2005-01-23 Thread alex23
> the first paragraph of 9.1 "A Word About Terminology" is > epitome of masturbation. I'm tempted to concede this point to you given the sheer overwhelming testament to onanism that is your website but this is just nonsense. Defining terms is *always* necessary, it ensures that participants in wha

Re: Quoting sql queries with the DB-API

2005-01-23 Thread snacktime
> > Also, is this a good way to use variables in an insert/update > > statement, or is there a better way? > > > > sql = "insert into test(a,b) values('%s','%s')" % (a,b) > > cursor.execute(sql) > > If you do it like this: > > sql = "INSERT INTO test(a, b) VALUES(%s, %s)" # no quotes around the %

Re: Set parity of a string

2005-01-23 Thread snacktime
On Sun, 23 Jan 2005 21:00:25 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Peter Hansen wrote: > > snacktime wrote: > >> Is there a module that sets the parity of a string? > > > > As to the specific question: a module is not really required. > > But here's one for you anyway. It raises an exc

Re: Set parity of a string

2005-01-23 Thread John Machin
Peter Hansen wrote: > snacktime wrote: > > Is there a module that sets the parity of a string? I have an > > application that needs to communicate with a host using even parity > > So what I need is before sending the message, convert it from space to > > even parity. And when I get the respons

Re: Help on project, anyone?

2005-01-23 Thread Peter Hansen
Georg Brandl wrote: Hello, to train my Python skills I am looking for some project I can contribute to. I learned Python about one year ago, and had already some programming background behind (I contributed to SharpDevelop for instance), so I'm not the complete newbie. About myself: I'm a 20 year o

Re: Set parity of a string

2005-01-23 Thread Peter Hansen
Peter Hansen wrote: snacktime wrote: Is there a module that sets the parity of a string? As to the specific question: a module is not really required. But here's one for you anyway. It raises an exception if any input character is non-ASCII, otherwise when you call set_parity() with a string and

python newt under win32

2005-01-23 Thread Gabriel B.
Anyone has any info if there's something similar to Newt lib for win32? Thanks Gabriel -- http://mail.python.org/mailman/listinfo/python-list

Re: Help on project, anyone?

2005-01-23 Thread Steve Menard
Georg Brandl wrote: Hello, to train my Python skills I am looking for some project I can contribute to. I learned Python about one year ago, and had already some programming background behind (I contributed to SharpDevelop for instance), so I'm not the complete newbie. About myself: I'm a 20 year o

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Tim Peters
[Mike C. Fletcher] > I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate > __del__ methods (and the memory leaks they create). A worthy goal! > Looking at the docs for 2.3's weakref.ref, there's no mention of whether the > callbacks are held with a strong reference. A callback

Re: Quoting sql queries with the DB-API

2005-01-23 Thread Leif K-Brooks
snacktime wrote: I'm used to using the perl DBI and not very familiar with the python DB-API. I am using PyGreSQL. My question is what is the standard way to quote strings in sql queries? I didn't see any quoting functions in the DB-API docs. Is quoting handled internally by the PyGreSQL module

Re: Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread Andrew McLean
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> writes Andrew McLean wrote: In case anyone is interested, here is the latest. def insCost(tokenList, indx, pos): """The cost of inserting a specific token at a specific normalised position along the sequence.""" if containsNu

Installer made with bdist_wininst segfaulting...

2005-01-23 Thread Fernando Perez
Hi all, I am seeking advice/help from those with more win32 experience than myself. I am trying to build a proper win32 installer for IPython, after a user did most of the hard work. For the most part, it's working very well, but I am running into a nasty problem, which took me a few hours to fi

Re: [perl-python] 20050121 file reading & writing

2005-01-23 Thread Erik Max Francis
Bob Smith wrote: To do this efficiently on a large file (dozens or hundreds of megs), you should use the 'sizehint' parameter so as not to use too much memory: sizehint = 0 mylist = f.readlines(sizehint) It doesn't make any difference. .readlines reads the entire file into memory at once. -- E

Re: Classical FP problem in python : Hamming problem

2005-01-23 Thread Tim Peters
[Francis Girard] > ... > In the meantime, I couldn't resist to test the new Python features about > laziness on a classical FP problem, i.e. the "Hamming" problem. ... > Nevertheless, while the Haskell version prints Hamming sequence for as long as > I can stand it, and with very little memory cons

Re: how to write a tutorial

2005-01-23 Thread Daniel Bickett
Lucas Raab wrote: > Daniel Bickett wrote: > >>Most texts in computing are written by authors to defend and showcase > >>their existence against their peers. > > > > > > When you aren't busy `showcasing' your ignorance, this is *all* i see > > in everything you write. > > > > Um, maybe that was h

Re: Set parity of a string

2005-01-23 Thread Peter Hansen
snacktime wrote: Is there a module that sets the parity of a string? I have an application that needs to communicate with a host using even parity So what I need is before sending the message, convert it from space to even parity. And when I get the response I need to convert that from even to s

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Mike C. Fletcher
Alex Martelli wrote: Mike C. Fletcher <[EMAIL PROTECTED]> wrote: weakref.ref( self, self.close ) but the self.close reference in the instance is going away *before* the object is called. Uh -- what's holding on to this weakref.ref instance? I guess the weakreference _itself_ is goin

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Peter Hansen
Daniel Bickett wrote: John Lenton wrote: On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: Is there a reason that Google Groups isn't mirroring python-list exactly like it used to, or is it simply a conspiracy I'm not in on? You should not ask this kind of question in a public forum,

Quoting sql queries with the DB-API

2005-01-23 Thread snacktime
I'm used to using the perl DBI and not very familiar with the python DB-API. I am using PyGreSQL. My question is what is the standard way to quote strings in sql queries? I didn't see any quoting functions in the DB-API docs. Is quoting handled internally by the PyGreSQL module? Also, is this

Re: [perl-python] 20050121 file reading & writing

2005-01-23 Thread Bob Smith
Erik Max Francis wrote: Bob Smith wrote: To do this efficiently on a large file (dozens or hundreds of megs), you should use the 'sizehint' parameter so as not to use too much memory: sizehint = 0 mylist = f.readlines(sizehint) It doesn't make any difference. .readlines reads the entire file in

Re: compile python to binary

2005-01-23 Thread Peter Hansen
Daniel Bickett wrote: Fredrik Lundh wrote: oh, you mean that "python compiler" didn't mean "the python compiler". [snip] I simply inferred that he was using the wrong terminology, being that he said "binary" twice ;-) While I suspect you've guessed correctly at what the OP meant, one should also co

Re: What's so funny? WAS Re: rotor replacement

2005-01-23 Thread "Martin v. Löwis"
Paul Rubin wrote: If he understood how Python is actually used, he'd understand that any C module is a lot more useful in the core than out of it. This is non-sense. I have been distributing C modules outside the core for quite some time now, and I found that the modules are quite useful. distuti

Re: [perl-python] 20050121 file reading & writing

2005-01-23 Thread Fredrik Lundh
Erik Max Francis wrote: >> To do this efficiently on a large file (dozens or hundreds of megs), you >> should use the >> 'sizehint' parameter so as not to use too much memory: >> >> sizehint = 0 >> mylist = f.readlines(sizehint) > > It doesn't make any difference. .readlines reads the entire fi

Re: Set parity of a string

2005-01-23 Thread snacktime
On Sun, 23 Jan 2005 23:52:29 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "snacktime" wrote: > > > Is there a module that sets the parity of a string? I have an > > application that needs to communicate with a host using even parity > > So what I need is before sending the message, convert i

Re: Alternative Ways to install Python 2.4?

2005-01-23 Thread "Martin v. Löwis"
Michael Goettsche wrote: I convinced my CS teacher to use Python in school. We currently have 2.2 installed on a Windows 2000 Terminal server. I asked the system administrator to upgrade to Python 2.4, but he didn't succeed in doing it. He used the microsoft installer package, which according to

Re: rotor replacement

2005-01-23 Thread "Martin v. Löwis"
Paul Rubin wrote: There's tons of such examples, but python-dev apparently reached consensus that the Python maintainers were less willing than the maintainers of those other packages to deal with those issues. As Andrew says, it is not apparent that there was consensus. Martin, do you know more ab

Re: Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Alex Martelli
Mike C. Fletcher <[EMAIL PROTECTED]> wrote: > weakref.ref( self, self.close ) > > but the self.close reference in the instance is going away *before* the > object is called. Uh -- what's holding on to this weakref.ref instance? I guess the weakreference _itself_ is going away right afte

Re: Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread John Machin
Andrew McLean wrote: > In case anyone is interested, here is the latest. > def insCost(tokenList, indx, pos): > """The cost of inserting a specific token at a specific normalised position along the sequence.""" > if containsNumber(tokenList[indx]): > return INSERT_TOKEN_WITH_NUMBER

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Daniel Bickett
John Lenton wrote: > > On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: > > > > > > Is there a reason that Google Groups isn't mirroring python-list > > > exactly like it used to, or is it simply a conspiracy I'm not in on? > > > > You should not ask this kind of question in a publi

Re: Set parity of a string

2005-01-23 Thread Fredrik Lundh
"snacktime" wrote: > Is there a module that sets the parity of a string? I have an > application that needs to communicate with a host using even parity > So what I need is before sending the message, convert it from space to > even parity. And when I get the response I need to convert that from

Weakref.ref callbacks and eliminating __del__ methods

2005-01-23 Thread Mike C. Fletcher
I'm looking at rewriting parts of Twisted and TwistedSNMP to eliminate __del__ methods (and the memory leaks they create). Looking at the docs for 2.3's weakref.ref, there's no mention of whether the callbacks are held with a strong reference. My experiments suggest they are not... i.e. I'm

Re: finding name of instances created

2005-01-23 Thread Michael Tobis
I have a similar problem. Here's what I do: .def new_robot_named(name,indict=globals()): . execstr = name + " = robot('" + name + "')" . exec(execstr,indict) .class robot(object): . def __init__(self,name): . self.name = name . def sayhi(self): . print "Hi! I'm %s!" % self.nam

Re: Classical FP problem in python : Hamming problem

2005-01-23 Thread Jeff Epler
Your formulation in Python is recursive (hamming calls hamming()) and I think that's why your program gives up fairly early. Instead, use itertools.tee() [new in Python 2.4, or search the internet for an implementation that works in 2.3] to give a copy of the output sequence to each "multiply by N

Re: Solutions for data storage?

2005-01-23 Thread Shalabh Chaturvedi
Leif K-Brooks wrote: I'm writing a relatively simple multi-user public Web application with Python. It's a rewrite of a similar application which used PHP+MySQL (not particularly clean code, either). My opinions on various Web frameworks tends to vary with the phase of the moon, but currently, I

Re: how to write a tutorial

2005-01-23 Thread Lucas Raab
Daniel Bickett wrote: Most texts in computing are written by authors to defend and showcase their existence against their peers. When you aren't busy `showcasing' your ignorance, this is *all* i see in everything you write. Um, maybe that was his point... -- http://mail.python.org/mailman/listinf

Re: Insanity

2005-01-23 Thread Tim Daneliuk
Fredrik Lundh wrote: Tim Daneliuk wrote: Thanks - very helpful. One followup - your re works as advertised. But if I use: r'\[PROMPT:[^]].*\]' it seems not to. the '.*' instead of just '*' it matches the entire string ... it's not "just '*'", it's "[^]]*". it's the "^]" set (anything but ])

Set parity of a string

2005-01-23 Thread snacktime
Is there a module that sets the parity of a string? I have an application that needs to communicate with a host using even parity So what I need is before sending the message, convert it from space to even parity. And when I get the response I need to convert that from even to space parity. The

Re: What is print? A function?

2005-01-23 Thread Steven Bethard
Frans Englich wrote: The reason I thinks about this is I need to implement a debug print for my program; very simple, a function/print statement that conditionally prints its message whether a bool is true. Not overly complex. Sounds like you want to override sys.stdout: py> class ConditionalWrit

Classical FP problem in python : Hamming problem

2005-01-23 Thread Francis Girard
Hi, First, My deepest thanks to Craig Ringer, Alex Martelli, Nick Coghlan and Terry Reedy for having generously answered on the "Need help on need help on generator" thread. I'm compiling the answers to sketch myself a global pictures about iterators, generators, iterator-generators and lazine

Re: JPype and classpath (Was Re: embedding jython in CPython... )

2005-01-23 Thread johng2001
Thanks for the response. However, I continue to have problems. Allow me to give some more detail. For simplicity of testing, I hard coded the classpath and JVM path (BTW getDefaultJVMPath() returns None on my system) import os, os.path from jpype import * startJVM("C:/jdk1.5.0/jre/bin/client/jvm

Microsoft to Provide PyCon Opening Keynote

2005-01-23 Thread Steve Holden
Dear Python Colleague: The PyCon Program Committee is happy to announce that the opening keynote speech, at 9:30 am on Wednesday March 23 will be: Python on the .NET Platform, by Jim Hugunin, Microsoft Corporation Jim Hugunin is well-known in the Python world for his pioneering work on

Re: finding name of instances created

2005-01-23 Thread Steven Bethard
Nick Coghlan wrote: It also directly addresses the question of aliasing. Think about how Steven's modified dictionary would react to this code: pete = CreateRobot(2, 3) dad = pete dad.move() pete.move() If you'd like to handle these cases, but you don't want to have to explain aliasing right off

Re: What is print? A function?

2005-01-23 Thread Nelson Minar
Frans Englich <[EMAIL PROTECTED]> writes: > The reason I thinks about this is I need to implement a debug print for my > program; very simple, a function/print statement that conditionally prints > its message whether a bool is true. Not overly complex. As several folks have said, print is a sta

Re: Keyboard problems with Python shell over SSH

2005-01-23 Thread Stian Soiland
På 23. jan 2005 kl. 21:55 skrev Nils Emil P.Larsen: I connect to my server using SSH and then run 'python' to enter the shell. I can't use the arrow buttons (up, down, left and right). Instead I get this ^[[A , ^[[B, ^[[C or ^[[D. Your Python installation is probably compiled without readline su

Keyboard problems with Python shell over SSH

2005-01-23 Thread Nils Emil P.Larsen
Hello I'm not sure this is Python-related but it might be since Bash and vim works perfectly. I connect to my server using SSH and then run 'python' to enter the shell. I can't use the arrow buttons (up, down, left and right). Instead I get this ^[[A , ^[[B, ^[[C or ^[[D. How do I get my arro

Re: What is print? A function?

2005-01-23 Thread Georg Brandl
Roy Smith wrote: >> So I wonder, what _is_ exactly the print statement? The untraditional way of >> invoking it(without paranteses) makes me wonder. > > It's a statement, just like "write" in Fortran. When C came around, the > idea of a language having no built-in print statement and having to

Fuzzy matching of postal addresses [1/1]

2005-01-23 Thread Andrew McLean
In case anyone is interested, here is the latest. I implemented an edit distance technique based on tokens. This incorporated a number of the ideas discussed in the thread. It works pretty well on my data. I'm getting about 95% matching now, compared with 90% for the simple technique I originall

Re: What is print? A function?

2005-01-23 Thread Roy Smith
Frans Englich <[EMAIL PROTECTED]> wrote: > Nah, I don't think it's a function, but rather a builtin "statement". But > it's possible to invoke it as an function; print( "test" ) works fine. That's not calling it as a function. The parens in this case are simply evaluated as grouping operators a

Re: finding name of instances created

2005-01-23 Thread Georg Brandl
Michael Tobis wrote: > I have a similar problem. Here's what I do: > > .def new_robot_named(name,indict=globals()): > . execstr = name + " = robot('" + name + "')" > . exec(execstr,indict) > > .class robot(object): > . def __init__(self,name): > . self.name = name > > . def sayhi(se

Re: finding name of instances created

2005-01-23 Thread Steven Bethard
Michael Tobis wrote: I have a similar problem. Here's what I do: .def new_robot_named(name,indict=globals()): . execstr = name + " = robot('" + name + "')" . exec(execstr,indict) .class robot(object): . def __init__(self,name): . self.name = name . def sayhi(self): . print "Hi! I

python-dev Summary for 2004-12-01 through 2004-12-15

2005-01-23 Thread Brett C.
This is a summary of traffic on the `python-dev mailing list`_ from December 01, 2004 through December 15, 2004. It is intended to inform the wider Python community of on-going developments on the list. To comment on anything mentioned here, just post to `comp.lang.python`_ (or email python-l

Re: make install with python

2005-01-23 Thread Christopher De Vries
On Sat, Jan 22, 2005 at 01:54:17AM +0100, Uwe Mayer wrote: > Any suggestions how I handle uninstallation? This was provided by automake > rather mechanically. I didn't find a section on that in the distutils > documentation... :( I've been using distutils for a couple of projects I've written for

Re: [python-win32] on the way to find pi!

2005-01-23 Thread Michel Claveau
Hi ! Very more simplistic, but easy for to code : def pi(nb): cpi=0 for i in xrange(1,nb,4): cpi=cpi+4./i-4./(i+2.) return(cpi) print pi(99) @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

bdb

2005-01-23 Thread jimbo
Hi, I am trying to sort how to best programmatically run the debugger on a program, and another way that I am trying to explore is by using the bdb module. There isn't any documentation for this and I have tried reading through the source, which includes an example/test at the end of bdb.py on

Re: re Insanity

2005-01-23 Thread Tim Daneliuk
Orlando Vazquez wrote: Tim Daneliuk wrote: For some reason, I am having the hardest time doing something that should be obvious. (Note time of posting ;) Given an arbitrary string, I want to find each individual instance of text in the form: "[PROMPT:optional text]" I tried this: y=re.compile

Weekly Python Patch/Bug Summary

2005-01-23 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 273 open ( +1) / 2746 closed ( +9) / 3019 total (+10) Bugs: 797 open ( +4) / 4789 closed (+12) / 5586 total (+16) RFE : 166 open ( +1) / 141 closed ( +0) / 307 total ( +1) New / Reopened Patches __ fix distu

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Steven Bethard
Bengt Richter wrote: On Sat, 22 Jan 2005 16:22:33 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote: Steven Bethard wrote: I wrote: > If you really want locals that don't contribute to arguments, I'd be > much happier with something like a decorator, e.g.[1]: > > @with_consts(i=1, deftime=time.ctime()

Help on project, anyone?

2005-01-23 Thread Georg Brandl
Hello, to train my Python skills I am looking for some project I can contribute to. I learned Python about one year ago, and had already some programming background behind (I contributed to SharpDevelop for instance), so I'm not the complete newbie. About myself: I'm a 20 year old German with str

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread John Lenton
> On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: > > > > Is there a reason that Google Groups isn't mirroring python-list > > exactly like it used to, or is it simply a conspiracy I'm not in on? > > You should not ask this kind of question in a public forum, and *you* should kno

Re: specifying constants for a function (WAS: generator expressions: performance anomaly?)

2005-01-23 Thread Steven Bethard
Nick Coghlan wrote: Steven Bethard wrote: I wrote: > If you really want locals that don't contribute to arguments, I'd be > much happier with something like a decorator, e.g.[1]: > > @with_consts(i=1, deftime=time.ctime()) > def foo(x, y=123, *args, **kw): >return x*y, kw.get('which_time'

Re: OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Steve Holden
Daniel Bickett wrote: John Lenton wrote: On Sun, Jan 23, 2005 at 01:53:52PM -0500, Daniel Bickett wrote: Is there a reason that Google Groups isn't mirroring python-list exactly like it used to, or is it simply a conspiracy I'm not in on? You should not ask this kind of question in a public forum,

Re: on the way to find pi!

2005-01-23 Thread Fredrik Lundh
Ali Polatel wrote: > write the code type str(pi(5)) and see what I mean it helps if you post the code you want help with in your first post, so people don't have to guess. the pi function doesn't return anything, it prints the value to stdout (that's what the stdout.write things are doing). if

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Alan Kennedy
[Alan Kennedy] >>So, I'm hoping that the learned folks here might be able to give me >>some pointers to a markup language that has the following >>characteristics [Paul Rubin] > I'm a bit biased but I've been using Texinfo for a long time and have > been happy with it. It's reasonably lightweight

Re: Textual markup languages (was Re: What YAML engine do you use?)

2005-01-23 Thread Alan Kennedy
[Alan Kennedy] >> From what I've seen, pretty much every textual markup targetted >> for web content, e.g. wiki markup, seems to have grown/evolved >> organically, meaning that it is either underpowered or overpowered, >> full of special cases, doesn't have a meaningful object model, etc. [Fredrik

OT: problems mirroring python-list to c.l.py?

2005-01-23 Thread Daniel Bickett
I'm not sure if it's just me (or, indeed, just google groups), but my "python-list" folder (label, that is) in my gmail account looks less and less similar to Google Groups' comp.lang.python with each day. Not only that, c.l.py has been acting rather strange. Example that happened just now: Ali Po

Re: on the way to find pi!

2005-01-23 Thread Ali Polatel
write the code type str(pi(5)) and see what I mean__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Re: on the way to find pi!

2005-01-23 Thread Ali Polatel
that's just little near to pi... pi is so far away ;)__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

Re: on the way to find pi!

2005-01-23 Thread Fredrik Lundh
Ali Polatel wrote: > I found a code which calculates pi with an interesting algorithm the > programme code is below: > [code snipped] > This code gives the number in an unusual format like "3.1415'None'" it has > a number part and a string part. are you sure? $ python pi.py How many d

Re: on the way to find pi!

2005-01-23 Thread Daniel Bickett
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import math >>> math.pi 3.1415926535897931 Daniel Bickett -- http://mail.python.org/mailman/listinfo/python-list

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
Frans Englich wrote: > I find this a nice solution. The most practical would be if it was possible to > do this with print, of course. But print won't budge. you can disable print, though: class dev_null: def write(self, text): pass sys.stdout = dev_null() or pipe al

on the way to find pi!

2005-01-23 Thread Ali Polatel
dear friends , I found a code which calculates pi with an interesting algorithm the programme code is below: from sys import stdout def f((q,r,t,k)):    n = (3*q+r) / t    if (4*q+r) / t == n:    return (10*q,10*(r-n*t),t,k,n)    else:    return (q*k, q*(4*k+2)+r*(2*k+1),t*(2*k+1),k+1) # C

Re: What is print? A function?

2005-01-23 Thread Frans Englich
On Sunday 23 January 2005 18:04, Michael Hoffman wrote: > Frans Englich wrote: [...] > if command_line_debug_option: > debug = _debug_true > else > debug = _debug_false I find this a nice solution. The most practical would be if it was possible to do this with print, of course. But prin

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
>> The reason I thinks about this is I need to implement a debug print for my >> program; very simple, a function/print statement that conditionally prints >> its message whether a bool is true. Not overly complex. >> >> I tried this by overshadowing the print keyword, but that obviously didn't >>

Re: What is print? A function?

2005-01-23 Thread Michael Hoffman
Frans Englich wrote: Nah, I don't think it's a function, but rather a builtin "statement". But it's possible to invoke it as an function; print( "test" ) works fine. That is not invoking it as a function. The parentheses are only for ordering the expression on the right You can do this too: >>>

Re: What is print? A function?

2005-01-23 Thread Fredrik Lundh
Frans Englich wrote: > Nah, I don't think it's a function, but rather a builtin "statement". But it's > possible to invoke it as an function; print( "test" ) works fine. > > So I wonder, what _is_ exactly the print statement? The untraditional way of > invoking it(without paranteses) makes me wond

What is print? A function?

2005-01-23 Thread Frans Englich
Nah, I don't think it's a function, but rather a builtin "statement". But it's possible to invoke it as an function; print( "test" ) works fine. So I wonder, what _is_ exactly the print statement? The untraditional way of invoking it(without paranteses) makes me wonder. The reason I thinks abo

Re: compile python to binary

2005-01-23 Thread Doug Holton
Fredrik Lundh wrote: Daniel Bickett wrote: I believe Sam was talking about "frozen" python scripts using tools such as py2exe: oh, you mean that "python compiler" didn't mean "the python compiler". I wouldn't assume a novice uses terms the same way you would. It was quite clear from his message

Re: how to write a tutorial

2005-01-23 Thread Hans Nowak
Xah Lee wrote: the first paragraph of 9.1 "A Word About Terminology" is epitome of masturbation. The entire 9.1 is not necessary. Large part of 9.2 "Python Scopes and Name Spaces" is again masturbatory. So I can just take a copy of the tutorial to the bathroom next time. Thanks for the tip, man!

Re: compile python to binary

2005-01-23 Thread Fredrik Lundh
Daniel Bickett wrote: > I believe Sam was talking about "frozen" python scripts using tools > such as py2exe: oh, you mean that "python compiler" didn't mean "the python compiler". here are links to some more tools, btw: http://effbot.org/zone/python-compile.htm -- http://mail.python

Re: best way to do a series of regexp checks with groups

2005-01-23 Thread [EMAIL PROTECTED]
what about something like this? >>> import re >>> m = re.match(r"""(?Padd|mult) (?P\d+) (?P\d+)""", 'add 3 5') >>> from operator import add, mul >>> op = {'add': add, 'mult: mul} >>> op[m.groupdict()['operator']](int(m.groupdict()['int_1']), int(m.groupdict()['int_2'])) 8 -- http://mail.python.or

Dr. Dobb's Python-URL! - weekly Python news and links (Jan 23)

2005-01-23 Thread Josiah Carlson
QOTW: "XML with elementtree is what makes me never have [to] think about XML again." -- Istvan Albert "'Plays well with others' was a strong motivator for Python's design, and that often means playing by others' rules." -- Tim Peters Type mutability, and why some types are immutable. T

Re: list unpack trick?

2005-01-23 Thread aurora
On Sat, 22 Jan 2005 10:03:27 -0800, aurora <[EMAIL PROTECTED]> wrote: I am think more in the line of string.ljust(). So if we have a list.ljust(length, filler), we can do something like name, value = s.split('=',1).ljust(2,'') I can always break it down into multiple lines. The good thing abo

Re: What YAML engine do you use?

2005-01-23 Thread rm
rm wrote: Paul Rubin wrote: Reinhold Birkenfeld <[EMAIL PROTECTED]> writes: For those of you who don't know what YAML is: visit http://yaml.org/! You will be amazed, and never think of XML again. Well, almost. Oh please no, not another one of these. We really really don't need it. well, I did lo

  1   2   >