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

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: 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: 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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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 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 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: 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: 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: 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: 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: 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: 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: ffmpeg and python big problem

2009-05-21 Thread Rhodri James
On Thu, 21 May 2009 22:48:33 +0100, TerabyteST wrote: Hello. I am trying to make a video from images shot by my webcam in python. I use a module I found on the net (here http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html ) but, even if I think I am doing everything correctly, w

Re: 4 hundred quadrillonth?

2009-05-21 Thread Rob Clewley
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 hoping someone can e

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

2009-05-21 Thread MRAB
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't actually matter in this case; 'c' will still be bound to the n

Re: 4 hundred quadrillonth?

2009-05-21 Thread Gary Herron
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 / 5.0 0.80004 4 / 5.0 is 0.8. No more, no less

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

2009-05-21 Thread byron
On May 21, 6:57 pm, MRAB wrote: > byron wrote: > > I am using the lxml.etree library to validate an xml instance file > > with a specified schema that contains the data types of each element. > > This is some of the internals of a function that extracts the > > elements: > > >         schema_doc =

Re: 4 hundred quadrillonth?

2009-05-21 Thread MRAB
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 / 5.0 0.80004 4 / 5.0 is 0.8. No more, no less. So what's u

Re: 4 hundred quadrillonth?

2009-05-21 Thread Carl Banks
On May 21, 3:45 pm, norseman wrote: > Beyond that - just fix the money at 2, gas pumps at 3 and the > sine/cosine at 8 and let it ride. :) Or just use print. >>> print 4.0/5.0 0.8 Since interactive prompt is usually used by programmers who are inspecting values it makes a little more sense to

Re: defaultdict's bug or feature?

2009-05-21 Thread Rhodri James
On Thu, 21 May 2009 13:07:50 +0100, Red Forks wrote: from collections import defaultdict d = defaultdict(set) assert isinstance(d['a'], set) assert isinstance(d.get('b'), set) d['a'] is ok, and a new set object is insert to d, but d.get('b') won't. It's a bug, or just a feature? Feature.

Re: dbfpy - cannot store new record

2009-05-21 Thread John Machin
On May 22, 1:53 am, Laszlo Nagy wrote: > 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["SOM

Re: finding repeated data sequences in a column

2009-05-21 Thread norseman
3-A,3-A2,7-A4... and the two 78s would pair with a G and with a G2 (78-G, 78-G2) beyond that I'm a bit lost. 20090521 Steve The correct answer supposed to be A and A2... if I were asked for pressures 56 and 78 the correct answer supossed to be valves G and G2... Valves = ['A','A&

Re: A list with periodic boundary conditions

2009-05-21 Thread Rhodri James
On Thu, 21 May 2009 13:08:39 +0100, wrote: Hi, I'm trying to create a new class of list that has periodic boundary conditions. Here's what I have so far: class wrappedList(list): def __getitem__(self, p): return list.__getitem__(self, p%len(self)) def __setitem__(self, p, v):

Re: join two selects

2009-05-21 Thread gert
On May 21, 4:54 pm, Tim Golden wrote: > gert wrote: > > I am trying to figure out how to join two selects ? > > > SELECT * FROM search > > SELECT eid, SUM(pnt) AS total_votes FROM vote > > > CREATE TABLE votes ( > >     eid  INTEGER PRIMARY KEY, > >     uid  VARCHAR(64), > >     pnt  INETEGER DEFA

Re: 4 hundred quadrillonth?

2009-05-21 Thread Grant Edwards
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 / 5.0 >> 0.80004 >> >> 4 / 5.0 is 0.8. No more, no less. So what's up

Re: reseting an iterator

2009-05-21 Thread Terry Reedy
norseman wrote: Terry Reedy wrote: I will clarify by starting over with current definitions. Ob is an iterator iff next(ob) either returns an object or raises StopIteration and continues to raise StopIteration on subsequent calls. Ob is an iterable iff iter(ob) raturns an iterator. It is in

Re: reseting an iterator

2009-05-21 Thread norseman
Terry Reedy wrote: I will clarify by starting over with current definitions. Ob is an iterator iff next(ob) either returns an object or raises StopIteration and continues to raise StopIteration on subsequent calls. Ob is an iterable iff iter(ob) raturns an iterator. It is intentional that th

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

2009-05-21 Thread MRAB
byron wrote: I am using the lxml.etree library to validate an xml instance file with a specified schema that contains the data types of each element. This is some of the internals of a function that extracts the elements: schema_doc = etree.parse(schema_fn) schema = etree.XMLSche

Re: 4 hundred quadrillonth?

2009-05-21 Thread norseman
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 with that 4 at the end. It bothers me. ===

Re: 4 hundred quadrillonth?

2009-05-21 Thread Chris Rebert
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 / 5.0 >> >> 0.80004 >> >> 4 / 5.0 is 0.8

Re: 4 hundred quadrillonth?

2009-05-21 Thread Chris Rebert
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 / 5.0 >> >> 0.80004 >> >> 4 / 5.0 is 0.8

Re: reseting an iterator

2009-05-21 Thread Terry Reedy
I will clarify by starting over with current definitions. Ob is an iterator iff next(ob) either returns an object or raises StopIteration and continues to raise StopIteration on subsequent calls. Ob is an iterable iff iter(ob) raturns an iterator. It is intentional that the protocol definitio

Re: python3 module for dbus ?

2009-05-21 Thread Stephen Hansen
> > > Do you know if I can get dbus bindings for python3 and glib bindings for >>> python3 ? Or could I use them otherwise (like without the modules) ? >>> >> >> Sorry, no answers to your questions off-hand, but what's wrong with >> using 2.x? >> > > It is now old and will be replaced by 3.0 > And

Re: Slicing an array in groups of eight

2009-05-21 Thread Robert Kern
On 2009-05-21 15:51, Graham Arden wrote: A python novice writes. Hello, I'm trying to extract certain frames from a stack of images as part of a project. In order to do this I need to produce an array which consists of a group of eight, then misses the next 8, then selects the next eight e

Re: PyXML difficulties

2009-05-21 Thread Paul Boddie
On 21 Mai, 22:58, emperorcezar wrote: > I'm new to using the xml libs. I'm trying to create xml pragmatically, > but I'm finding an issue. I have two elements I'm creating using > createElementNS two elements (soap:Envelope and context). Each having > a different namespace. When I print the create

Re: ffmpeg and python big problem

2009-05-21 Thread Emile van Sebille
On 5/21/2009 2:48 PM TerabyteST said... Hello. I am trying to make a video from images shot by my webcam in python. I use a module I found on the net (here http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html ) but, even if I think I am doing everything correctly, what I only get i

Re: dbfpy - cannot store new record

2009-05-21 Thread David Lyon
well, dbfpy isn't super sophisticated. If you make your own code fixes, maybe you can provide them back to the package author. On Thu, 21 May 2009 17:53:38 +0200, Laszlo Nagy wrote: > Here is the next problem. For boolean/logical fields, I can set their > value to True/False easily. However,

Re: Slicing an array in groups of eight

2009-05-21 Thread Emile van Sebille
On 5/21/2009 1:51 PM Graham Arden said... A python novice writes. Hello, I'm trying to extract certain frames from a stack of images as part of a project. In order to do this I need to produce an array which consists of a group of eight, then misses the next 8, then selects the next eight

Re: Wrapping methods of built-in dict

2009-05-21 Thread shailesh
On May 20, 7:31 pm, Steven D'Aprano wrote: > On Wed, 20 May 2009 18:42:38 -0700, shailesh wrote: > > The reason as far as I understand is that the methods on the built-in > > dict are not of MethodType or FunctionType > > That seems to be true: > > >>> type({}.get) > > >>> type(dict.get> > > > >

Re: 4 hundred quadrillonth?

2009-05-21 Thread Carl Banks
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 / 5.0 > > 0.80004 > > 4 / 5.0 is 0.8. No more, no less. That would depend on how you define the n

ffmpeg and python big problem

2009-05-21 Thread TerabyteST
Hello. I am trying to make a video from images shot by my webcam in python. I use a module I found on the net (here http://osdir.com/ml/python.matplotlib.general/2005-10/msg00145.html ) but, even if I think I am doing everything correctly, what I only get is a grey video with some multi-color squar

Re: Slicing an array in groups of eight

2009-05-21 Thread Vlastimil Brom
2009/5/21 Graham Arden : > A python novice writes. > > Hello, > > I'm trying to extract certain frames from a stack of images as part of > a project.  In order to do this I need to produce an array which > consists of a group of eight, then misses the next 8, then selects the > next eight etc.

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

2009-05-21 Thread byron
I am using the lxml.etree library to validate an xml instance file with a specified schema that contains the data types of each element. This is some of the internals of a function that extracts the elements: schema_doc = etree.parse(schema_fn) schema = etree.XMLSchema(schema_doc)

Re: 4 hundred quadrillonth?

2009-05-21 Thread seanm . py
On May 21, 5:36 pm, 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 / 5.0 > > 0.80004 > > > 4 / 5.0 is 0.8. No more, no less. So w

Re: 4 hundred quadrillonth?

2009-05-21 Thread Christian Heimes
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 / 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 bothers me. Welcom

Re: 4 hundred quadrillonth?

2009-05-21 Thread MRAB
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 with that 4 at the end. It bothers me. Read http://docs.pytho

Re: Overlapping region resolution

2009-05-21 Thread Scott David Daniels
psaff...@googlemail.com wrote: This may be an algorithmic question, but I'm trying to code it in Python, so... I have a list of pairwise regions, each with an integer start and end and a float data point. There may be overlaps between the regions. I want to resolve this into an ordered list with

4 hundred quadrillonth?

2009-05-21 Thread seanm . py
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 bothers me. -- http://mail.python.org/mailman/listinfo/python

PyXML difficulties

2009-05-21 Thread emperorcezar
I'm new to using the xml libs. I'm trying to create xml pragmatically, but I'm finding an issue. I have two elements I'm creating using createElementNS two elements (soap:Envelope and context). Each having a different namespace. When I print the created xml, the namespace attribute gets moved from

Slicing an array in groups of eight

2009-05-21 Thread Graham Arden
A python novice writes. Hello, I'm trying to extract certain frames from a stack of images as part of a project. In order to do this I need to produce an array which consists of a group of eight, then misses the next 8, then selects the next eight etc. i.e (0, 1, 2, 3, 4, 5, 6, 7, 16, 17,18

Re: python3 module for dbus ?

2009-05-21 Thread Timothy Madden
Aahz wrote: In article <4a1281ef$0$90271$14726...@news.sunsite.dk>, Timothy Madden wrote: [...] Do you know if I can get dbus bindings for python3 and glib bindings for python3 ? Or could I use them otherwise (like without the modules) ? Sorry, no answers to your questions off-hand, but wha

Re: How to get path.py ? http://www.jorendorff.com/ is down

2009-05-21 Thread Jorge Vargas
On Thu, May 21, 2009 at 3:43 PM, Jorge Vargas wrote: > Hello. > > Anyone knows what is the problem with this package? apparently the > author's site is down which prevents pip from installing it. I can > download the zip and go from there but It seems most of the docs are > gone with the site. >

How do I install these C modules in python? The tale of the C programming snake.

2009-05-21 Thread Luis Zarrabeitia
I don't know the answer, but to do you a favour (and increase the visibility), I'm replying with a more... explicit subject line. === Original message === On Thursday 21 May 2009 09:19:23 am Craig wrote: > http://downloads.emperorlinux.com/contrib/pyiw > http://downloads.emperorlinux.com/contri

How to get path.py ? http://www.jorendorff.com/ is down

2009-05-21 Thread Jorge Vargas
Hello. Anyone knows what is the problem with this package? apparently the author's site is down which prevents pip from installing it. I can download the zip and go from there but It seems most of the docs are gone with the site. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Spawn a process with P_NOWAIT and pass it some data ?

2009-05-21 Thread Nick Craig-Wood
Barak, Ron wrote: > This is my first try at IPC in Python, and I would like to ask your help wi= > th the following problem: > > I would like to spawn a process with P_NOWAIT, and pass some data to the ch= > ild process. > > I created two scripts to try IPC (in a blocking way): > > $ cat

Re: python question

2009-05-21 Thread Dave Angel
Craig wrote: How do i install this.i never seen a python write in c before. Well, I've never seen a snake program in any language, python or otherwise. And I believe python was named after Monty Python, not the snake. But once it got its name, snake puns abound. Anyway, why not tell yo

Re: A question regd configobj

2009-05-21 Thread Dave Angel
Srijayanth Sridhar wrote: Hello, I am wondering if it is possible to have hexadecimal strings in a ini file and have configobj parse it correctly. for eg: moonw...@trantor:~/python/config$ cat foo foo="\x96\x97" . . . a=ConfigObj("foo") a ConfigObj({'foo': '\\x96\\x97'}) a['fo

Re: making a python program in windows

2009-05-21 Thread Dave Angel
Rustom Mody wrote: I know how to make a python script behave like a (standalone) program in unix -- 1. put a #! path/to/python as the first line 2. make the file executable The closest I know how to do this in windows is: r-click the file in win-explorer goto properties goto open with change p

Re: Performance java vs. python

2009-05-21 Thread namekuseijin
On May 21, 7:47 am, s...@viridian.paintbox (Sion Arrowsmith) wrote: > Duncan Booth   wrote: > > >namekuseijin wrote: > >> I find it completely unimaginable that people would even think > >> suggesting the idea that Java is simpler.  It's one of the most stupidly > >> verbose and cranky languages o

Re: reseting an iterator

2009-05-21 Thread norseman
Terry Reedy wrote: Jan wrote: Wouldn't it be easy for Python to implement generating functions so that the iterators they return are equipped with a __reset__() method? No. Such a method would have to poke around in the internals of the __next__ function in implementation specific ways. The

Re: SpellChecker

2009-05-21 Thread abosalim
On May 20, 12:37 pm, Mike Kazantsev wrote: > abosalim wrote: > > I used this code.It works fine,but on word not whole text.I want to > > extend this code to correct > > text file not only a word,but i don't know.If you have any help,please > > inform me. > ... > > def correct(word): > >     candid

Re: Your Favorite Python Book

2009-05-21 Thread Esmail
Gökhan SEVER wrote: Hello, I received an autographed copy of CPP, 2nd Edition after joining to Safari's "What is Python" webcast. They published the recorded session online as well. Check http://www.safaribooksonline.com/Corporate/DownloadAndResources/webcasts.php As you will see from the

Re: Performance java vs. python

2009-05-21 Thread Sion Arrowsmith
Lie Ryan wrote: >Sion Arrowsmith wrote: >> Once, when faced with a rather hairy problem that client requirements >> dictated a pure Java solution for, I coded up a fully functional >> prototype in Python to get the logic sorted out, and then translated >> it. [And it wasn't pleasant.] > >Jython ?

Re: popen - reading strings - constructing a list from the strings

2009-05-21 Thread norseman
BUTTONS # SubNB= [] for mode, text in NB_SUB: c = Radiobutton(frameSub, text=text, indicatoron=0, variable=SubVal, value=mode, command=getSub) SubNB.append(c) c.pack() # # # -- Sub

Re: dbfpy - cannot store new record

2009-05-21 Thread MRAB
Laszlo Nagy wrote: 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 F

Re: Simple question about accessing instance properties.

2009-05-21 Thread Lacrima
On May 21, 7:04 pm, MRAB wrote: > Lacrima wrote: > > Hello! > > > I think I have a very simple question, but I can't understand how to > > access object properties in a way described below. > > For example I have an instance of any class: > > class Person: > >    def __init__(self): > >      

Re: Simple question about accessing instance properties.

2009-05-21 Thread MRAB
Lacrima wrote: Hello! I think I have a very simple question, but I can't understand how to access object properties in a way described below. For example I have an instance of any class: class Person: def __init__(self): self.name = 'John' self.email =

Re: A fast way to read last line of gzip archive ?

2009-05-21 Thread MRAB
Barak, Ron wrote: Hi, I need to read the end of a 20 MB gzip archives (To extract the date from the last line of a a gzipped log file). The solution I have below takes noticeable time to reach the end of the gzip archive. Does anyone have a faster solution to read the last line of a gzip ar

Simple question about accessing instance properties.

2009-05-21 Thread Lacrima
Hello! I think I have a very simple question, but I can't understand how to access object properties in a way described below. For example I have an instance of any class: >>> class Person: def __init__(self): self.name = 'John' self.email = 'j...@example.c

Re: Overlapping region resolution

2009-05-21 Thread MRAB
psaff...@googlemail.com wrote: This may be an algorithmic question, but I'm trying to code it in Python, so... I have a list of pairwise regions, each with an integer start and end and a float data point. There may be overlaps between the regions. I want to resolve this into an ordered list with

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["SOMEFIELD3

A fast way to read last line of gzip archive ?

2009-05-21 Thread Barak, Ron
Hi, I need to read the end of a 20 MB gzip archives (To extract the date from the last line of a a gzipped log file). The solution I have below takes noticeable time to reach the end of the gzip archive. Does anyone have a faster solution to read the last line of a gzip archive ? Thanks, Ron.

Re: Adding a Par construct to Python?

2009-05-21 Thread Nick Craig-Wood
Steven D'Aprano wrote: > On Tue, 19 May 2009 05:52:04 -0500, Grant Edwards wrote: > > > On 2009-05-19, Steven D'Aprano > > wrote: > >> On Mon, 18 May 2009 02:27:06 -0700, jeremy wrote: > >> > >>> Let me clarify what I think par, pmap, pfilter and preduce would mean > >>> and how they would be i

Overlapping region resolution

2009-05-21 Thread psaff...@googlemail.com
This may be an algorithmic question, but I'm trying to code it in Python, so... I have a list of pairwise regions, each with an integer start and end and a float data point. There may be overlaps between the regions. I want to resolve this into an ordered list with no overlapping regions. My init

Re: Performance java vs. python

2009-05-21 Thread Lie Ryan
Sion Arrowsmith wrote: OTOH, I consider it a productive day if I end up with fewer lines of code than I started with. A friend once justified a negative LOC count as being the sign of a good day with the following observation: Code that doesn't exist contains no bugs. Code that doesn't exist t

Re: dbfpy - cannot store new record

2009-05-21 Thread MRAB
Laszlo Nagy wrote: [snip] I have never seen such a construct before. Index a tuple with a boolean??? self.stream = file(f, ("r+b", "rb")[bool(readOnly)]) Python originally didn't have Boolean; it used 0 for false and 1 for true. When the Boolean class was added it was subclasse

Re: join two selects

2009-05-21 Thread Tim Golden
gert wrote: I am trying to figure out how to join two selects ? SELECT * FROM search SELECT eid, SUM(pnt) AS total_votes FROM vote CREATE TABLE votes ( eid INTEGER PRIMARY KEY, uid VARCHAR(64), pnt INETEGER DEFAULT 0, ); CREATE TABLE search ( eid INTEGER PRIMARY KEY, tx

join two selects

2009-05-21 Thread gert
I am trying to figure out how to join two selects ? SELECT * FROM search SELECT eid, SUM(pnt) AS total_votes FROM vote CREATE TABLE votes ( eid INTEGER PRIMARY KEY, uid VARCHAR(64), pnt INETEGER DEFAULT 0, ); CREATE TABLE search ( eid INTEGER PRIMARY KEY, txt VARCHAR(64)

Re: dbfpy - cannot store new record

2009-05-21 Thread Laszlo Nagy
David Lyon írta: Hi, Try not opening the file in append mode (no "a+") Inside the logic, there is already a seek to the end of the file and the record counters at the start of the file need updating too. The first thing I tried is to use a filename instead of the file object but it didn't w

Re: dbfpy - cannot store new record

2009-05-21 Thread David Lyon
Hi, Try not opening the file in append mode (no "a+") Inside the logic, there is already a seek to the end of the file and the record counters at the start of the file need updating too. Regards David On Thu, 21 May 2009 13:25:04 +0200, Laszlo Nagy wrote: > Given this example program: > >

Re: Your Favorite Python Book

2009-05-21 Thread Gökhan SEVER
Hello, I received an autographed copy of CPP, 2nd Edition after joining to Safari's "What is Python" webcast. They published the recorded session online as well. Check http://www.safaribooksonline.com/Corporate/DownloadAndResources/webcasts.php As you will see from the lecture, he is a very motiv

About dictionary in combobox in pygtk

2009-05-21 Thread shruti surve
hi all, My data has thousands of entries. I 'd like to feed the combobox with dictionary.how to use dictionary in combobox? Regards, shruti surve -- http://mail.python.org/mailman/listinfo/python-list

Re: LaTeXing python programs

2009-05-21 Thread John Reid
Edward Grefenstette wrote: I'm trying to figure out how to use pygments. Are there any good usage examples out there? The documentation worked for me: http://pygments.org/docs/cmdline/ There is also a LaTeX package to call pygments at latex compilation time I forget what that is called thou

Generating zipped or gzipped attachment with email package?

2009-05-21 Thread skip
I have a script which allows me to generate MIME messages with appropriate attachments. It's essentially a lightly modified version of the second example from this page of the email package docs: http://docs.python.org/library/email-examples.html I want to modify my script to automatically z

Re: dbfpy - cannot store new record

2009-05-21 Thread MRAB
Laszlo Nagy wrote: Given this example program: import dbfpy def dbf_open(tblname): fpath = os.path.join(local.DB_DIR,tblname) f = file(fpath,"ab+") f.seek(0) tbl = dbf.Dbf(f) return tbl tbl = dbf_open("partners.dbf") rec = tbl.newRecord() rec["FIELDNAME1"] = 1 rec["FIELDNAME2"] =

[no subject]

2009-05-21 Thread Craig
http://downloads.emperorlinux.com/contrib/pyiw http://downloads.emperorlinux.com/contrib/pywpa Sorry fro the 2 post.How do i install a python moudles write en in C? -- http://mail.python.org/mailman/listinfo/python-list

python question

2009-05-21 Thread Craig
How do i install this.i never seen a python write in c before. -- http://mail.python.org/mailman/listinfo/python-list

Re: Your Favorite Python Book

2009-05-21 Thread Esmail
Shawn Milochik wrote: On Mon, May 11, 2009 at 5:52 PM, wrote: Sam, In no specific order (I brought them all): Wesley Chun's "Core Python Programming" http://mail.python.org/mailman/listinfo/python-list I second the Wesley Chun recommendation wholeheartedly. This book keeps getting men

Re: Adding a Par construct to Python?

2009-05-21 Thread Luis Alberto Zarrabeitia Gomez
Quoting Carl Banks : > I don't have any reply to this post except for the following excerpts: > > On May 20, 8:10 pm, Luis Alberto Zarrabeitia Gomez > wrote: > > 2- in [almost] every other language, _you_ have to be aware of the > critical > > sections when multithreading. > [snip] > > That's n

Re: defaultdict's bug or feature?

2009-05-21 Thread MRAB
Red Forks wrote: from collections import defaultdict d = defaultdict(set) assert isinstance(d['a'], set) assert isinstance(d.get('b'), set) d['a'] is ok, and a new set object is insert to d, but d.get('b') won't. It's a bug, or just a feature? A feature. I think dict.get() method is just a

  1   2   >