Re: Pivot Table/Groupby/Sum question

2007-12-27 Thread John Machin
On Dec 28, 10:05 am, [EMAIL PROTECTED] wrote: > On Dec 27, 10:59 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > On Dec 28, 4:56 am, [EMAIL PROTECTED] wrote: > > > > from itertools import groupby > > > You seem to have overlooked this important sentence in the > > documentation: "Generally, the it

Re: Taxicab Numbers

2007-12-27 Thread Terry Jones
> "rgalgon" == rgalgon <[EMAIL PROTECTED]> writes: rgalgon> I'm new to Python and have been putting my mind to learning it rgalgon> over my holiday break. I've been looking over the functional rgalgon> programming aspects of Python and I'm stuck trying to come up with rgalgon> some concise co

Re: Taxicab Numbers

2007-12-27 Thread Paul Hankin
On Dec 27, 9:48 pm, rgalgon <[EMAIL PROTECTED]> wrote: > I'm new to Python and have been putting my mind to learning it over my > holiday break. I've been looking over the functional programming > aspects of Python and I'm stuck trying to come up with some concise > code to find Taxicab numbers (ht

Python-URL! - weekly Python news and links (Dec 28)

2007-12-27 Thread Gabriel Genellina
QOTW: "However, inspection of a vast corpus of code might lead one to believe that any commenting capability was completely unnecessary." - Jim B. Wilson "The Python people also piped [up] to say 'everything's just fine here', but then they always do; I really must learn that language." - Tim Bra

Re: Dynamic DNS with a python script

2007-12-27 Thread Delta
Some registrars provide a Dynamic DNS service. The one I use (namecheap) provides it and I think all I had to do was edit my ddclient.conf to use it instead of dyndns once I got my domain. However, if you're going to use ipcheck you'll have to change some of the args to use the registrars utilities

Re: Python DLL in Windows Folder

2007-12-27 Thread Martin v. Löwis
> It's one of Microsoft guidelines. The "'Designed for Microsoft Windows > XP' Application Specification" only allows DLLs to be installed in the > system directory if it's required for backwards compatiblity. I guess you are referring to 2.6 here. I think Python perfectly meets the specification

Re: Python DLL in Windows Folder

2007-12-27 Thread Ross Ridge
<[EMAIL PROTECTED]> wrote: > I think Python perfectly meets the specification (i.e. is designed >for Windows XP) in this respect (*): >- python25.dll is a shared component >- it is not private to a single software vendor >- it is not a control panel item >- it is not a service or device driver >- i

Re: Taxicab Numbers

2007-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2007 13:48:36 -0800, rgalgon wrote: > I'm new to Python and have been putting my mind to learning it over my > holiday break. I've been looking over the functional programming aspects > of Python and I'm stuck trying to come up with some concise code to find > Taxicab numbers (http:

Remove namespace declaration from ElementTree in lxml

2007-12-27 Thread Zero Piraeus
: I want to remove an unused namespace declaration from the root element of an ElementTree in lxml. There doesn't seem to be any documented way to do this, so at the moment I'm reduced to sticking the output through str.replace() ... which is somewhat inelegant. Is there a better way? -[]z. --

Understanding tempfile.TemporaryFile

2007-12-27 Thread byte8bits
Wondering if someone would help me to better understand tempfile. I attempt to create a tempfile, write to it, read it, but it is not behaving as I expect. Any tips? >>> x = tempfile.TemporaryFile() >>> print x ', mode 'w+b' at 0xab364968> >>> print x.read() >>> print len(x.read()) 0 >>> x.write(

Re: Pivot Table/Groupby/Sum question

2007-12-27 Thread John Machin
On Dec 28, 11:48 am, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 28, 10:05 am, [EMAIL PROTECTED] wrote: > > > > If you have any ideas about how to solve this pivot table issue, which > > seems to be scant on Google, I'd much appreciate it. I know I can do > > this in Excel easily with the auto

Re: Python DLL in Windows Folder

2007-12-27 Thread Martin v. Löwis
> No, that doesn't follow from the requirements given. The only exception > for something that isn't a service or device driver is for backwards > compatibility. Also, pretty much any DLL supports side-by-side > installation. Hmm. How do I have to build and install python25.dll exactly to make t

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread John Machin
On Dec 28, 1:49 pm, [EMAIL PROTECTED] wrote: > Wondering if someone would help me to better understand tempfile. I > attempt to create a tempfile, write to it, read it, but it is not > behaving as I expect. Any tips? > > >>> x = tempfile.TemporaryFile() > >>> print x > > ', mode 'w+b' at 0xab364968

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread Shane Geiger
import tempfile tmp = tempfile.mktemp() import os os.remove(tmp) [EMAIL PROTECTED] wrote: > Wondering if someone would help me to better understand tempfile. I > attempt to create a tempfile, write to it, read it, but it is not > behaving as I expect. Any tips? > > x = tempfile.Temporar

Re: Taxicab Numbers

2007-12-27 Thread Steven D'Aprano
I hate having to correct myself... On Fri, 28 Dec 2007 02:31:50 +, Steven D'Aprano wrote: > You seem to be treating n as the number to be split into the sum of > cubes, Not quite... in your code, n appears to be the largest number to test. That is, if n is twelve, you test up to 12 cubed.

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2007 18:49:06 -0800, byte8bits wrote: > Wondering if someone would help me to better understand tempfile. I > attempt to create a tempfile, write to it, read it, but it is not > behaving as I expect. Any tips? You need to seek to the part of the file you want to read: >>> x = temp

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread byte8bits
On Dec 27, 10:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > Check out the seek method. Ah yes... thank you: >>> import tempfile >>> x = tempfile.TemporaryFile() >>> x.write("test") >>> print x.read() >>> x.seek(0) >>> print x.read() test -- http://mail.python.org/mailman/listinfo/python-li

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2007 21:17:01 -0600, Shane Geiger wrote: > import tempfile > tmp = tempfile.mktemp() > > import os > os.remove(tmp) Not only does that not answer the Original Poster's question, but I don't think it does what you seem to think it does. >>> tmp = tempfile.mktemp() >>> tmp '/tmp/

Re: Understanding tempfile.TemporaryFile

2007-12-27 Thread Shane Geiger
Yes, I knew this. Good call, it was just a bad copy and paste example of lines that showed up close together in a file. My apologies. >> import tempfile >> tmp = tempfile.mktemp() >> >> import os >> os.remove(tmp) >> > > Not only does that not answer the Original Poster's question, but I do

Re: Python DLL in Windows Folder

2007-12-27 Thread Ross Ridge
Ross Ridge writes: > No, that doesn't follow from the requirements given. The only exception > for something that isn't a service or device driver is for backwards > compatibility. Also, pretty much any DLL supports side-by-side > installation. <[EMAIL PROTECTED]> wrote: >Hmm. How do I have to b

Understanding tempfile.TemporaryFile

2007-12-27 Thread Brad
Wondering if someone would help me to better understand tempfile. I attempt to create a tempfile, write to it, read it, but it is not behaving as I expect. Any tips? >>> x = tempfile.TemporaryFile() >>> print x ', mode 'w+b' at 0xab364968> >>> print x.read() >>> print len(x.read()) 0 >>> x

Re: list in a tuple

2007-12-27 Thread Gabriel Genellina
En Thu, 27 Dec 2007 16:38:07 -0300, <[EMAIL PROTECTED]> escribió: > On Dec 27, 8:20 pm, Wildemar Wildenburger > <[EMAIL PROTECTED]> wrote: >> > >> >> From that post: >> > Ok, I do admit that doing >> > >> > a = ([1], 2) >> > a[0].append(2) >> > >> > also doesn't throw an error, but this onl

Re: Happy Christmas Pythoneers

2007-12-27 Thread Aahz
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Wed, 26 Dec 2007 21:32:54 -0800, [EMAIL PROTECTED] wrote: >> >> Hey, my version of the person module doesn't have an is_appropriate_sex >> attribute, but an is_opposite_sex attribute instead. Is this a new >> version?

Re: os.fork leaving processes behind

2007-12-27 Thread Gabriel Genellina
En Thu, 27 Dec 2007 21:36:36 -0300, Falcolas <[EMAIL PROTECTED]> escribió: > This may be more of a Linux question, but it relates to how Python > forks... Yes; every book describing how to use fork tells about zombie processes and the wait/waitpid functions. Just do the same thing in Python. >

Dynamically created objects

2007-12-27 Thread Michael Bernhard Arp Sørensen
Hi there. I need to create objects on the fly in my program. The names of the objects must be unique, obviously, and I need to put them in a list for later use. How do i set the name of an object if the name is stored in another variable? I've looked in the O'Reiley Python Cookbook and on goo

Re: Happy Christmas Pythoneers

2007-12-27 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: > On Thu, 27 Dec 2007 09:09:49 +0200, Hendrik van Rooyen wrote: > > > "Zentrader" wrote: > > > >> And if you're not a Christian it would be Type Error bug. Anyway, > >> happy New Years as well to all in the group. > > > > Followers of Shushla celebrate the new year

Re: Dynamically created objects

2007-12-27 Thread Gabriel Genellina
En Fri, 28 Dec 2007 04:14:43 -0300, Michael Bernhard Arp Sørensen <[EMAIL PROTECTED]> escribió: > I need to create objects on the fly in my program. The names of the > objects must be unique, obviously, and I need to put them in a list for > later use. > > How do i set the name of an object if t

Re: Dynamically created objects

2007-12-27 Thread Steven D'Aprano
On Fri, 28 Dec 2007 08:14:43 +0100, Michael Bernhard Arp Sørensen wrote: > Hi there. > > I need to create objects on the fly in my program. The names of the > objects must be unique, obviously, and I need to put them in a list for > later use. Why do you think they need names? If you have them i

<    1   2