Re: defaultdict's bug or feature?

2009-05-21 Thread Red Forks
You mean 'get' method should not alter the dict, does 'dict[key]' should not alter the dict either? d = defaultdict(set) assert len(d) == 0 print d[1] assert len(d) == 1 auto insert value to dict, when value is not in dict, is what defaultdict try to do. On Fri, May 22, 2009 at 7:46 AM, Rhodri J

Re: lxml: traverse xml tree and retrieve element based on an attribute

2009-05-21 Thread byron
On May 21, 8:27 pm, MRAB wrote: > byron wrote: > > [snip] > > > Thanks. Yes i tried something like this, but I think I overwrite `c` > > when i wrote it, as in: > > >     if len(c) > 0: > >         c = fin_node(c, name) > >         if c is not None: > >             return c > > FYI, doing that won

Re: Streaming pdf with URLLib

2009-05-21 Thread Aahz
In article <04eacd56-5293-4553-bdb3-ad2e8266c...@z7g2000vbh.googlegroups.com>, Scooter wrote: > >#!/usr/bin/python > >import urllib > >u = urllib.urlopen('https://myinternal.server/pdfs/pdfstreamer.aspx') >print 'Content-type: application/pdf\n\n' ># print 'Content-type: application/x-msdownload;

Re: 4 hundred quadrillonth?

2009-05-21 Thread R. David Murray
Gary Herron wrote: > MRAB wrote: > > Grant Edwards wrote: > >> On 2009-05-21, Christian Heimes wrote: > >>> seanm...@gmail.com schrieb: > The explaination in my introductory Python book is not very > satisfying, and I am hoping someone can explain the following to me: > > >>> 4

Re: defaultdict's bug or feature?

2009-05-21 Thread MRAB
Red Forks wrote: You mean 'get' method should not alter the dict, does 'dict[key]' should not alter the dict either? d = defaultdict(set) assert len(d) == 0 print d[1] assert len(d) == 1 auto insert value to dict, when value is not in dict, is what defaultdict try to do. That's the behavio

Re: Is there a better way to chose a slice of a list?

2009-05-21 Thread Rhodri James
On Wed, 20 May 2009 17:08:08 +0100, walterbyrd wrote: I am processing a huge spreadsheet which I have converted to a csv format. Each row will be a wiki page with several sub-headings. The spreadsheet contains information about servers. Wiki sub-headings may include: 'hardware', 'software', '

Re: 4 hundred quadrillonth?

2009-05-21 Thread Gary Herron
R. David Murray wrote: Gary Herron wrote: MRAB wrote: Grant Edwards wrote: On 2009-05-21, Christian Heimes wrote: seanm...@gmail.com schrieb: The explaination in my introductory Python book is not very satisfying, and I am hoping someone can explain the f

Re: 4 hundred quadrillonth?

2009-05-21 Thread AggieDan04
On May 21, 5:45 pm, norseman wrote: > seanm...@gmail.com wrote: > > The explaination in my introductory Python book is not very > > satisfying, and I am hoping someone can explain the following to me: > > 4 / 5.0 > > 0.80004 > > > 4 / 5.0 is 0.8. No more, no less. So what's up wit

Re: 4 hundred quadrillonth?

2009-05-21 Thread AggieDan04
On May 21, 5:36 pm, Chris Rebert wrote: > On Thu, May 21, 2009 at 2:53 PM, Carl Banks wrote: > > On May 21, 2:05 pm, seanm...@gmail.com wrote: > >> The explaination in my introductory Python book is not very > >> satisfying, and I am hoping someone can explain the following to me: > > >> >>> 4 /

Re: 4 hundred quadrillonth?

2009-05-21 Thread Dave Angel
Rob Clewley wrote: On Thu, May 21, 2009 at 8:19 PM, Gary Herron wrote: MRAB wrote: Grant Edwards wrote: On 2009-05-21, Christian Heimes wrote: seanm...@gmail.com schrieb: The explaination in my introductory Python book is not very satisfying, and I am hop

Re: finding repeated data sequences in a column

2009-05-21 Thread Rhodri James
On Thu, 21 May 2009 08:55:45 +0100, yadin wrote: this is the program...I wrote but is not working I have a list of valves, and another of pressures; If I am ask to find out which ones are the valves that are using all this set of pressures, wanted best pressures this is the program i wrote but

Re: When does the escape character work within raw strings?

2009-05-21 Thread walterbyrd
I guess I am confused about when when escape characters are are interpersonal as escape characters, and escape characters are not treated as escape characters. Sometimes escape characters in regular strings are treated as escape characters, sometimes not. Same seems to go for raw strings. So how d

Re: Cursor movement question

2009-05-21 Thread Jive Dadson
Gosh, you guys are slow. :-) I figured it out. -- http://mail.python.org/mailman/listinfo/python-list

Re: When does the escape character work within raw strings?

2009-05-21 Thread Rhodri James
On Fri, 22 May 2009 03:42:18 +0100, walterbyrd wrote: I guess I am confused about when when escape characters are are interpersonal as escape characters, and escape characters are not treated as escape characters. No, you're confused about the number of entirely different things that are in

Re: Adding a Par construct to Python?

2009-05-21 Thread Rhodri James
On Wed, 20 May 2009 09:19:50 +0100, wrote: On 20 May, 03:43, Steven D'Aprano wrote: On Tue, 19 May 2009 03:57:43 -0700, jeremy wrote: > As I wrote before, concurrency is one of the hardest things for > professional programmers to grasp. For 'amateur' programmers we need to > make it as s

Re: defaultdict's bug or feature?

2009-05-21 Thread Rhodri James
Please don't top-post, it makes the thread of argument hard to follow. On Fri, 22 May 2009 01:44:37 +0100, Red Forks wrote: You mean 'get' method should not alter the dict, does 'dict[key]' should not alter the dict either? d = defaultdict(set) assert len(d) == 0 print d[1] assert len(d) ==

Re: Wrapping methods of built-in dict

2009-05-21 Thread George Sakkis
On May 21, 5:55 pm, shailesh wrote: > There doesn't seem to be a predicate returning method wrappers. Is > there an alternate way to query an object for attributes that are of > method wrappers? Sure: >>> MethodWrapper = type({}.__init__) >>> isinstance([].__len__, MethodWrapper) True But you'r

Re: monitoring friendly applications

2009-05-21 Thread Tim Roberts
Imbaud Pierre wrote: > >I have A LOT of batch applications to monitor, on linux machines, mostly >written in python. >I have to know: >- which are active, at a given moment? >- when did the last run occur? How long did it last? >- for some daemons: are they stuck? generally, waiting for i/o, or l

Re: making a python program in windows

2009-05-21 Thread Tim Roberts
Dave Angel wrote: > >Anyway, now you can see two batch files you could use to make a >particular version of Python active. The first one uses assoc and ftype >to fix the asssociations. And the other changes the environment variable >PATHEXT to make the extension optional. Note that changing t

Re: 4 hundred quadrillonth?

2009-05-21 Thread Andre Engels
On Thu, May 21, 2009 at 11:05 PM, wrote: > The explaination in my introductory Python book is not very > satisfying, and I am hoping someone can explain the following to me: > 4 / 5.0 > 0.80004 > > 4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end. > It bother

Re: dbfpy - cannot store new record

2009-05-21 Thread Laszlo Nagy
Here is the next problem. For boolean/logical fields, I can set their value to True/False easily. However, setting NULL seems impossible: rec = tbl.newRecord() rec["SOMEFIELD1"] = True # Works fine rec["SOMEFIELD2"] = False # Works fine rec["SOMEFIELD3"] = None # Will store False rec["SOMEFIELD

Re: dbfpy - cannot store new record

2009-05-21 Thread David Lyon
On Fri, 22 May 2009 08:34:17 +0200, Laszlo Nagy wrote: > Now I also tried to set -1. In any of the above cases, if I open that > dbf file with a commercial DBF editor application then I see that the > value is not null. > > - Borland Database Desktop shows "False" value > - CDBF shows an invali

<    1   2