Re: Simple ini Config parser examples needed

2008-12-02 Thread Chris Rebert
On Tue, Dec 2, 2008 at 2:51 PM, Glenn Linderman <[EMAIL PROTECTED]> wrote: > On approximately 12/2/2008 1:31 PM, came the following characters from the > keyboard of Chris Rebert: >> >> On Tue, Dec 2, 2008 at 1:18 PM, RON BRENNAN <[EMAIL PROTECTED]> >> wrote: >> >>> >>> Hello, >>> >>> I have a very

Re: Multiple Versions of Python on Windows XP

2008-12-02 Thread Jason Scheirer
On Dec 1, 4:49 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > Could anyone please point me to > documentation on the way the msi > installer handles multiple versions eg. > Python 2.5, 2.6 and 3.0? > > What changes are made to the registry? > > Is there some way to specify a default > version

Re: Mathematica 7 compares to other languages

2008-12-02 Thread John B. Matthews
In article <[EMAIL PROTECTED]>, Xah Lee <[EMAIL PROTECTED]> wrote: [...] > > Dr Jon D Harrop, Flying Frog Consultancy Ltd. > > http://www.ffconsultancy.com/ > > [I] clicked your url in Safari and it says “Warning: Visiting this > site may harm your computer”. Apparantly, your site set[s]

Re: optimization

2008-12-02 Thread Carl Banks
On Dec 1, 11:41 am, Neal Becker <[EMAIL PROTECTED]> wrote: > I guess I've become accustomed to decent compilers performing > reasonable transformations and so have tended to write code for > clarity. Python isn't that language. It'll do what it can, but a very aggressive optimizing compiler would

Re: Reverse zip() ?

2008-12-02 Thread John Machin
On Dec 3, 7:12 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Andreas Waldenburger wrote: > > we all know about the zip builtin that combines several iterables into > > a list of tuples. > > > I often find myself doing the reverse, splitting a list of tuples into > > several lists, each correspondi

problem with optparse

2008-12-02 Thread Neal Becker
This example is right out of python library reference. What's wrong here? import optparse def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_option("--foo", action="callback", callback=sto

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread r
I added you name to my "for" list. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with optparse

2008-12-02 Thread Robert Kern
Neal Becker wrote: This example is right out of python library reference. What's wrong here? import optparse def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_option("--foo", action="ca

Re: unicode and hashlib

2008-12-02 Thread Bryan Olson
Scott David Daniels wrote: Bryan Olson wrote: ... I think that's good behavior, except that the error message is likely to end beginners to look up the obscure buffer interface before they find they just need mystring.decode('utf8') or bytes(mystring, 'utf8'). Oops, careful here (I made this

Re: Reverse zip() ?

2008-12-02 Thread Zac Burns
There is a problem with this however, which prompted me to actually write an unzip function. One might expect to be able to do something like so (pseudocode)... def filesAndAttributes(): files = walk() attributes = [attr(f) for f in files] return zip(files, attributes) files, attributes

Re: problem with optparse

2008-12-02 Thread Neal Becker
Robert Kern wrote: > Neal Becker wrote: >> This example is right out of python library reference. What's wrong >> here? >> >> import optparse >> >> def store_value(option, opt_str, value, parser): >> setattr(parser.values, option.dest, value) >> >> parser = optparse.OptionParser() >> parse

Overriding a method at the instance level on a subclass of a builtin type

2008-12-02 Thread Zac Burns
Sorry for the long subject. I'm trying to create a subclass dictionary that runs extra init code on the first __getitem__ call. However, the performance of __getitem__ is quite important - so I'm trying in the subclassed __getitem__ method to first run some code and then patch in the original dict

Re: problem with optparse

2008-12-02 Thread John Machin
On Dec 3, 11:28 am, Robert Kern <[EMAIL PROTECTED]> wrote: > Neal Becker wrote: > > This example is right out of python library reference.  What's wrong here? > > > import optparse > > > def store_value(option, opt_str, value, parser): > >     setattr(parser.values, option.dest, value) > > > parser

Re: problem with optparse

2008-12-02 Thread Robert Kern
Neal Becker wrote: Robert Kern wrote: Neal Becker wrote: This example is right out of python library reference. What's wrong here? import optparse def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_opt

Re: Mathematica 7 compares to other languages

2008-12-02 Thread Jon Harrop
Xah Lee wrote: > On Dec 1, 4:06 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: >> Mathematica is a whopping 700,000 times slower! > > LOL Jon. r u trying to get me to do otimization for you free? > > how about pay me $5 thru paypal? I'm pretty sure i can speed it up. > Say, maybe 10%, and even 50% is

Re: Pyhon (with wxPython) on Windows' cygwin: can it be done fully ?

2008-12-02 Thread Jeremiah Dodds
On Mon, Dec 1, 2008 at 12:25 PM, Fernando H. Sanches < [EMAIL PROTECTED]> wrote: > At first I also disliked print's new syntax, but later I realised it > could be useful. > > However, I agree that the parentheses are annoying. Not because of the > parens theirselves, but because of the Shift key.

Re: Reverse zip() ?

2008-12-02 Thread Zac Burns
More succinct failure: keys, values = zip(*{}.iteritems()) -- Zachary Burns (407)590-4814 Aim - Zac256FL Production Engineer (Digital Overlord) Zindagi Games On Tue, Dec 2, 2008 at 4:47 PM, Zac Burns <[EMAIL PROTECTED]> wrote: > There is a problem with this however, which prompted me to actual

Re: problem with optparse

2008-12-02 Thread John Machin
On Dec 3, 11:47 am, Neal Becker <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > Neal Becker wrote: > >> This example is right out of python library reference. What's wrong > >> here? > > >> import optparse > > >> def store_value(option, opt_str, value, parser): > >> setattr(parser.values,

Re: Reverse zip() ?

2008-12-02 Thread Bryan Olson
Zac Burns wrote: There is a problem with this however, which prompted me to actually write an unzip function. One might expect to be able to do something like so (pseudocode)... def filesAndAttributes(): files = walk() attributes = [attr(f) for f in files] return zip(files, attributes)

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread Aaron Brady
On Dec 2, 6:24 pm, r <[EMAIL PROTECTED]> wrote: > I added you name to my "for" list. thanks +1 entertaining thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple equates

2008-12-02 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >In message <[EMAIL PROTECTED]>, Cameron Laird wrote: > >> In article <[EMAIL PROTECTED]>, >> Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >> >>>Cameron Laird wrote: >>> I've been trying to decide if there's any

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-02 Thread George Sakkis
On Dec 2, 7:58 pm, "Zac Burns" <[EMAIL PROTECTED]> wrote: > Sorry for the long subject. > > I'm trying to create a subclass dictionary that runs extra init code > on the first __getitem__ call. However, the performance of __getitem__ > is quite important - so I'm trying in the subclassed __getitem

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-02 Thread Aaron Brady
On Dec 2, 6:58 pm, "Zac Burns" <[EMAIL PROTECTED]> wrote: > Sorry for the long subject. > > I'm trying to create a subclass dictionary that runs extra init code > on the first __getitem__ call. However, the performance of __getitem__ > is quite important - so I'm trying in the subclassed __getitem_

Re: Reverse zip() ?

2008-12-02 Thread Bryan Olson
John Machin wrote: Here's a version that makes it slightly easier to comprehend: Q: I know how to zip sequences together: | >>> a = (1, 2, 3) | >>> b = (4, 5, 6) | >>> z = zip(a, b) | >>> z | [(1, 4), (2, 5), (3, 6)] but how do I reverse the process? A: Use zip()! | >>> a2, b2 = zip(*z) | >>> a

Re: Mathematica 7 compares to other languages

2008-12-02 Thread George Sakkis
On Dec 2, 4:57 pm, Lew <[EMAIL PROTECTED]> wrote: > There is no reason for you to engage in an /ad hominem/ attack.  It > does not speak well of you to resort to deflection when someone > expresses a contrary opinion, as you did with both Jon Harrop and with > me.  I suggest that your ideas will b

Re: Mathematica 7 compares to other languages

2008-12-02 Thread Xah Lee
On Dec 2, 5:13 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: > XahLeewrote: > > On Dec 1, 4:06 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: > >> Mathematica is a whopping 700,000 times slower! > > > LOL Jon. r u trying to get me to do otimization for you free? > > > how about pay me $5 thru paypal? I'm pr

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-02 Thread Bryan Olson
Zac Burns wrote: Sorry for the long subject. I'm trying to create a subclass dictionary that runs extra init code on the first __getitem__ call. However, the performance of __getitem__ is quite important - so I'm trying in the subclassed __getitem__ method to first run some code and then patch i

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread r
"If we can laugh what else would we do" I'd like to touch also on some comments by ajaksu: [ajaksu] I'd like to try hacking some form of Python to work in SketchUp (on top of Ruby, that is). Now, why won't I try to? I'm a Linux user and we don't get a SU version. So much for FREEDOM. BTW, some thi

Re: Mathematica 7 compares to other languages

2008-12-02 Thread Lew
George Sakkis wrote: As a Slashdotter would put it... you must be new here ;-) For certain values of "here". I've seen Xah before, and I'm happy to engage if he behaves himself. Some of his initial ideas I actually find engaging. His followups leave a lot to be desired. f/u set to comp.la

Re: best way to do this

2008-12-02 Thread thor
On Dec 2, 10:09 pm, TP <[EMAIL PROTECTED]> wrote: > Hi everybody, > > >>> c=[(5,3), (6,8)] > > From c, I want to obtain a list with 5,3,6, and 8, in any order. > I do this: > > >>> [i for (i,j) in c] + [ j for (i,j) in c] > > [5, 6, 3, 8] > > Is there a quicker way to do this? > >>> c = [(5, 3), (

Re: Simple ini Config parser examples needed

2008-12-02 Thread Glenn Linderman
On approximately 12/2/2008 3:22 PM, came the following characters from the keyboard of Chris Rebert: On Tue, Dec 2, 2008 at 2:51 PM, Glenn Linderman <[EMAIL PROTECTED]> wrote: On approximately 12/2/2008 1:31 PM, came the following characters from the keyboard of Chris Rebert: On Tue, De

Re: Do more imported objects affect performance

2008-12-02 Thread Steve Holden
Filip Gruszczyński wrote: [something I moved to after Nick's reply, where it belongs] > 2008/12/1 Nick Craig-Wood <[EMAIL PROTECTED]>: >> Rafe <[EMAIL PROTECTED]> wrote: >>> On Dec 1, 7:26?am, "Filip Gruszczy?ski" <[EMAIL PROTECTED]> wrote: I have following question: if I use from m

Best way to run multiple Python processes without overloading CPU or disk i/o

2008-12-02 Thread python
Is there a cross-platform way to launch multiple Python processes and monitor CPU usage and disk i/o so that the maximum number of independent processes can be running at all times without overloading their environment? By process I mean independent application sessions vs. multiple threads of a si

Re: Determining number of dict key collisions in a dictionary

2008-12-02 Thread python
Roger, Apologies for responding directly to your email vs. the list (just realized this now). Thank you very much for your detailed answers and the reminder about premature optimization. You have answered all my questions. Regards, Malcolm - Original message - From: "Roger Binns" <[E

Re: Best way to run multiple Python processes without overloading CPU or disk i/o

2008-12-02 Thread Philip Semanchuk
On Dec 2, 2008, at 11:21 PM, [EMAIL PROTECTED] wrote: Is there a cross-platform way to launch multiple Python processes and monitor CPU usage os.getloadavg() might be useful. It certainly works on *nix, don't know about Windows. The documentation doesn't mention any platform limitations.

Re: [ANN] Pyjamas 0.4: Python Web Toolkit Release

2008-12-02 Thread Banibrata Dutta
Amazing concept, and glad that someone thought of this and implemented this. The book's formatting on IE and Chrome looked a bit unusual. Content wise it is already firly decent (i.e. enough to get a programmer started), but sometimes text appears in a long & narrow col. format instead of the more

Debugging a Python Program that Hangs

2008-12-02 Thread Kevin D . Smith
I have a fairly large python program that, when a certain combination of options is used, hangs. I have no idea where it is hanging, so simply putting in print statements to locate the spot would be quite difficult. Unfortunately, ctrl-C'ing the program doesn't print a traceback either. Look

porting modules to Python 3.0

2008-12-02 Thread Michele Simionato
Python 3.0 is going to be released Real Soon now and I realized that there big holes in my understanding of how libraries working both with Python 2.X and Python 3.X should be written. Let me consider pure Python libraries for the moment. I see various possibilities: 1. I just release two differen

Re: best way to do this

2008-12-02 Thread alex23
On Dec 3, 1:38 pm, thor <[EMAIL PROTECTED]> wrote: > >>> c = [(5, 3), (6, 8)] > >>> [x for t in zip(*c) for x in t] > [5, 6, 3, 8] The zip here is superfluous. >>> c = [(5, 3), (6, 8)] >>> zip(*c) [(5, 6), (3, 8)] Unless you're -only- using it to ensure your result is the same order as the OP...

Re: Query netgroup information through python

2008-12-02 Thread Joel Heenan
Well it doesn't appear that this exists in the standard library or in any other library, so I ended up writing my own C interface to the underlying functions. If you are trying to do the same thing, then you can find the module here: http://www.planetjoel.com/viewarticle/629/Python+NSS+netgroups+

Re: Debugging a Python Program that Hangs

2008-12-02 Thread alex23
On Dec 3, 2:19 am, Kevin D. Smith <[EMAIL PROTECTED]> wrote: > I have a fairly large python program that, when a certain combination > of options is used, hangs.  I have no idea where it is hanging, so > simply putting in print statements to locate the spot would be quite > difficult.  Unfortunatel

Re: Obama's Birth Certificate - Demand that US presidential electors investigate Obama's eligibility

2008-12-02 Thread Bryan Olson
[EMAIL PROTECTED] wrote: This message is not about the meaningless computer printout called More importantly, it's not about Python. I'm setting follow-ups to talk.politics. "Certification of Live Birth" that Obama propaganda machine calls his "Birth Certificate". The American people are st

Re: Reverse zip() ?

2008-12-02 Thread Stefan Behnel
Zac Burns wrote: > More succinct failure: > > keys, values = zip(*{}.iteritems()) Simple fix: some_iterable = {}.iteritems() keys, values = zip(*list(some_iterable)) or: keys, values = zip(*(some_iterable if isinstance(some_iterable, (list, tuple))

Re: noob needs help

2008-12-02 Thread Sambo
Peter Pearson wrote: > When you type "python helloworld.py", python looks for helloworld.py > in the current "working" directory, which is probably your personal > default directory ("~"). For better results, either save helloworld.py > to this directory, or copy it to this directory > ("cp Doc

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread Benjamin Kaplan
On Tue, Dec 2, 2008 at 10:06 PM, r <[EMAIL PROTECTED]> wrote: > "If we can laugh what else would we do" > > I'd like to touch also on some comments by ajaksu: > [ajaksu] > I'd like to try hacking some form of Python to work in SketchUp (on > top of Ruby, that is). Now, why won't I try to? I'm a Li

Re: porting modules to Python 3.0

2008-12-02 Thread Martin v. Löwis
> Is there something like that already in place? What are the > recommendations for library > authors willing to support both Python 2.X and 3.X in parallel? My recommendation is to use 3.0's build_py_2to3 implementation of the build_py command. See Demo/distutils/test2to3. You will have a single

Re: porting modules to Python 3.0

2008-12-02 Thread Terry Reedy
Martin v. Löwis wrote: Is there something like that already in place? What are the recommendations for library authors willing to support both Python 2.X and 3.X in parallel? My recommendation is to use 3.0's build_py_2to3 implementation of the build_py command. See Demo/distutils/test2to3. Yo

Obtaining SMTP address of a sender and receiver of an outlook mail

2008-12-02 Thread [EMAIL PROTECTED]
Hi all, I am trying to use python for extracting contents of an outlook email. For extracting the list of Recipients addresses I tried using the "MAPI.message.Recipients.Address" property, but the problem I am facing is that it is giving the complete DN name which is putting me in further co

Linear2D

2008-12-02 Thread Lawrence D'Oliveiro
I've decided to give Github a go, with a simple project containing some routines for performing 2D linear transformations . This takes a functional rather than procedural approach. For example, a function to construct a matrix that maps a source rectangle to a

<    1   2