Re: bags? 2.5.x?

2008-01-22 Thread Christian Heimes
Dan Stromberg wrote: > Is there a particular reason why bags didn't go into 2.5.x or 3000? > > I keep wanting something like them - especially bags with something akin > to set union, intersection and difference. Ask yourself the following questions: * Is the feature useful for the broad mass?

Re: Removing objects

2008-01-22 Thread Asun Friere
On Jan 23, 6:16 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > >>> x.pop(x.index(c)) Umm, of course you would simply use x.remove(c) ... force of (bad) habit. %/ -- http://mail.python.org/mailman/listinfo/python-list

Re: translating Python to Assembler

2008-01-22 Thread Christian Heimes
Wim Vander Schelden wrote: > Python modules and scripts are normally not even compiled, if they have > been, > its probably just the Python interpreter packaged with the scripts and > resources. No, that is not correct. Python code is compiled to Python byte code and execute inside a virtual machi

Re: Extract value from a attribute in a string

2008-01-22 Thread inFocus
On Wed, 23 Jan 2008 01:13:31 -0200, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >En Tue, 22 Jan 2008 23:45:22 -0200, <[EMAIL PROTECTED]> escribió: > >> I am looking for some help in reading a large text tile and extracting >> a value from an attribute? so I would need to find name=foo and >> ex

Re: pairs from a list

2008-01-22 Thread George Sakkis
On Jan 23, 1:39 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Given the human psychology displayed involved, in the absence of > definitive evidence one way or another it is a far safer bet to assume > that people are unnecessarily asking for "the fastest" out of a misguided > and often ignoran

Re: Removing objects

2008-01-22 Thread Robert Kern
[EMAIL PROTECTED] wrote: > I am writing a game, and it must keep a list of objects. I've been > representing this as a list, but I need an object to be able to remove > itself. It doesn't know it's own index. If I tried to make each object > keep track of it's own index, it would be invalidated whe

Re: Just for fun: Countdown numbers game solver

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 10:56 pm, [EMAIL PROTECTED] wrote: > Arnaud and Terry, > > Great solutions both of you! Much nicer than mine. I particularly like > Arnaud's latest one based on folding because it's so neat and > conceptually simple. For me, it's the closest so far to my goal of the > most elegant soluti

Re: Removing objects

2008-01-22 Thread Asun Friere
On Jan 23, 5:59 pm, [EMAIL PROTECTED] wrote: > I am writing a game, and it must keep a list of objects. I've been > representing this as a list, but I need an object to be able to remove > itself. It doesn't know it's own index. If I tried to make each object > keep track of it's own index, it woul

Is there a HTML parser who can reconstruct the original html EXACTLY?

2008-01-22 Thread ioscas
Hi, I am looking for a HTML parser who can parse a given page into a DOM tree, and can reconstruct the exact original html sources. Strictly speaking, I should be allowed to retrieve the original sources at each internal nodes of the DOM tree. I have tried Beautiful Soup who is really nice

Re: Just for fun: Countdown numbers game solver

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 9:05 am, Terry Jones <[EMAIL PROTECTED]> wrote: > Hi Arnaud > > > I've tried a completely different approach, that I imagine as 'folding'.  I > > thought it would improve performance over my previous effort but extremely > > limited and crude benchmarking seems to indicate disappointingl

python24 symbol file...pyhon24.pdb

2008-01-22 Thread over
I've seen a few references on the net to a python24.pdb file. I assume it's a symbol file along the lines of the pdb files issued by microsoft for their products. Maybe I'm wrong. Has anyone seen such an animal? Also, is there source code available for python24 for Windoze? I have seen reference

Re: subprocess and & (ampersand)

2008-01-22 Thread Steven Bethard
Steven D'Aprano wrote: > On Tue, 22 Jan 2008 22:53:20 -0700, Steven Bethard wrote: > >> I'm having trouble using the subprocess module on Windows when my >> command line includes special characters like "&" (ampersand):: >> >> >>> command = 'lynx.bat', '-dump', 'http://www.example.com/?x=1&y=2' >

Removing objects

2008-01-22 Thread bladedpenguin
I am writing a game, and it must keep a list of objects. I've been representing this as a list, but I need an object to be able to remove itself. It doesn't know it's own index. If I tried to make each object keep track of it's own index, it would be invalidated when any object with a lower index w

UNSUBSCRIBE

2008-01-22 Thread TezZ Da [EMAIL PROTECTED] MaN
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Diez B. Roggisch Sent: 22 January 2008 20:22 To: python-list@python.org Subject: Re: isgenerator(...) - anywhere to be found? Jean-Paul Calderone wrote: > On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggi

Re: pairs from a list

2008-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2008 18:32:22 -0800, George Sakkis wrote: > The OP didn't mention anything about the context; for all we know, this > might be a homework problem or the body of a tight inner loop. There is > this tendency on c.l.py to assume that every optimization question is > about a tiny subpro

Re: subprocess and & (ampersand)

2008-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2008 22:53:20 -0700, Steven Bethard wrote: > I'm having trouble using the subprocess module on Windows when my > command line includes special characters like "&" (ampersand):: > > >>> command = 'lynx.bat', '-dump', 'http://www.example.com/?x=1&y=2' > >>> kwargs = dict(stdin=subp

subprocess and & (ampersand)

2008-01-22 Thread Steven Bethard
I'm having trouble using the subprocess module on Windows when my command line includes special characters like "&" (ampersand):: >>> command = 'lynx.bat', '-dump', 'http://www.example.com/?x=1&y=2' >>> kwargs = dict(stdin=subprocess.PIPE, ... stdout=subprocess.PIPE, ...

Re: translating Python to Assembler

2008-01-22 Thread Steven D'Aprano
On Wed, 23 Jan 2008 04:58:02 +, Grant Edwards wrote: > On 2008-01-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> My expertise, if any, is in assembler. I'm trying to understand Python >> scripts and modules by examining them after they have been disassembled >> in a Windows environment

Re: Cleanup when a object dies

2008-01-22 Thread Raymond Hettinger
On Jan 22, 7:54 pm, Benjamin <[EMAIL PROTECTED]> wrote: > I writing writing a class to allow settings (options, preferences) to > written file in a cross platform manner. I'm unsure how to go a about > syncing the data to disk. Of course, it's horribly inefficient to > write the data every time som

Re: translating Python to Assembler

2008-01-22 Thread Grant Edwards
On 2008-01-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > My expertise, if any, is in assembler. I'm trying to > understand Python scripts and modules by examining them after > they have been disassembled in a Windows environment. You can't dissassemble them, since they aren't ever converted

monitoring device status with python ...

2008-01-22 Thread Ajay Deshpande
hi everyone: i am writing a program, which needs to keep monitoring whether a certain usb hard drive is connected/hot-plugged in or not. instead of repeatedly checking if its path exists or not, can i have the os let my program know that the device has been connected? i have read about the min

Professional Grant Proposal Writing Workshop (April 2008: Vancouver, British Columbia)

2008-01-22 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be held in Vancouver, British Columbia, April 14 - 16, 2008. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand means that seats will

Cleanup when a object dies

2008-01-22 Thread Benjamin
I writing writing a class to allow settings (options, preferences) to written file in a cross platform manner. I'm unsure how to go a about syncing the data to disk. Of course, it's horribly inefficient to write the data every time something changes a value, however I don't see how I can do it on d

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
On Jan 22, 7:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > I was asking this community if there was a simple way to use only the > > tools included with Python to parse a bit of html. > > If you *know* that your document is valid HTML, you can use the HTMLParser   > module in the stan

Re: possible to overide setattr in local scope?

2008-01-22 Thread Terry Reedy
"glomde" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | In a class it is poosible to override setattr, so that you can decide | how you should | handle setting of variables. | | Is this possible to do outside of an class on module level. | | mysetattr(obj, var, value): | print "He

Re: translating Python to Assembler...sorry if this is duplicated...it's unintentional

2008-01-22 Thread Mike Driscoll
On Jan 22, 4:45 pm, [EMAIL PROTECTED] wrote: > My expertise, if any, is in assembler. I'm trying to understand Python > scripts and modules by examining them after they have been > disassembled in a Windows environment. > > I'm wondering if a Python symbols file is available. In the Windows > envir

Re: HTML parsing confusion

2008-01-22 Thread [EMAIL PROTECTED]
On Jan 22, 7:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > I was asking this community if there was a simple way to use only the > > tools included with Python to parse a bit of html. > > If you *know* that your document is valid HTML, you can use the HTMLParser > module in the stand

Re: Extract value from a attribute in a string

2008-01-22 Thread Gabriel Genellina
En Tue, 22 Jan 2008 23:45:22 -0200, <[EMAIL PROTECTED]> escribió: > I am looking for some help in reading a large text tile and extracting > a value from an attribute? so I would need to find name=foo and > extract just the value foo which can be at any location in the string. > The attribute name

Re: Don't want child process inheriting open sockets

2008-01-22 Thread Gabriel Genellina
En Tue, 22 Jan 2008 13:02:35 -0200, Steven Watanabe <[EMAIL PROTECTED]> escribió: > I'm using subprocess.Popen() to create a child process. The child > process is inheriting the parent process' open sockets, but I don't want > that. I believe that on Unix systems I could use the FD_CLOEXEC f

Re: pairs from a list

2008-01-22 Thread George Sakkis
On Jan 22, 1:34 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote: > > > > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wrote:> I want to > > > generate sequential pairs from a li

Re: Submitting with PAMIE

2008-01-22 Thread romo20350
On Jan 22, 7:49 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 22 Jan 2008 15:39:33 -0200, <[EMAIL PROTECTED]> escribió: > > > Hi I really need help. I've been looking around for an answer forever. > > I need to submit a form with no name and also the submit button has no > > name or

Extract value from a attribute in a string

2008-01-22 Thread inFocus
Hello, I am looking for some help in reading a large text tile and extracting a value from an attribute? so I would need to find name=foo and extract just the value foo which can be at any location in the string. The attribute name will be in almost each line. Thank you for any suggestions. --

Re: Using utidylib, empty string returned in some cases

2008-01-22 Thread Gabriel Genellina
En Tue, 22 Jan 2008 15:35:16 -0200, Boris <[EMAIL PROTECTED]> escribió: > I'm using debian linux, Python 2.4.4, and utidylib (http:// > utidylib.berlios.de/). I wrote simple functions to get a web page, > convert it from windows-1251 to utf8 and then I'd like to clean html > with it. Why the in

Re: Core Python Programming . . .

2008-01-22 Thread wesley chun
> > 6-11 Conversion. > >   (a) Create a program that will convert from an integer to an > > Internet Protocol (IP) address in the four-octet format of WWW.XXX.YYY.ZZZ > >   (b) Update your program to be able to do the vice verse of the above. > > I think it's is asking to convert a 32-bit int to th

Re: translating Python to Assembler

2008-01-22 Thread Luis Zarrabeitia
I second Wim's opinion. Learn python as a high level language, you won't regret it. About google, I'll give you a little gtip: > > For example a Google for "python.pdb" returns +python > > +pdb, so I get a ridiculous number of returns referring to the python > > debugger. I have mentioned this

Re: Submitting with PAMIE

2008-01-22 Thread Gabriel Genellina
En Tue, 22 Jan 2008 15:39:33 -0200, <[EMAIL PROTECTED]> escribió: > Hi I really need help. I've been looking around for an answer forever. > I need to submit a form with no name and also the submit button has no > name or value. How might I go about doing either of these. Thanks I think you'll ha

Re: translating Python to Assembler

2008-01-22 Thread James Matthews
The reason you were finding a Python Debugger when looking for the PDB files is because PDB is Python DeBugger! Also why would you be looking for a PDB file if you can read the C source! On Jan 22, 2008 11:55 PM, Wim Vander Schelden <[EMAIL PROTECTED]> wrote: > Python modules and scripts are norma

Re: HTML parsing confusion

2008-01-22 Thread Gabriel Genellina
En Tue, 22 Jan 2008 19:20:32 -0200, Alnilam <[EMAIL PROTECTED]> escribió: > On Jan 22, 11:39 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Alnilam wrote: >> > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: >> >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, >>

Re: UDP Client/Server

2008-01-22 Thread Guilherme Polo
2008/1/22, Martin Marcher <[EMAIL PROTECTED]>: > Hello, > > I created a really simple udp server and protocol but I only get every 2nd > request (and thus answer just every second request). > > Maybe someone could shed some light, I'm lost in the dark(tm), sorry if this > is a bit oververbose but t

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Paul McGuire
On Jan 22, 10:57 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: > Hi, > > I need to parse a fairly complex HTML page that has XML embedded in > it. I've done parsing before with the xml.dom.minidom module on just > plain XML, but I cannot get it to work with this HTML page. > > The XML looks like thi

Re: Just for fun: Countdown numbers game solver

2008-01-22 Thread dg . google . groups
Arnaud and Terry, Great solutions both of you! Much nicer than mine. I particularly like Arnaud's latest one based on folding because it's so neat and conceptually simple. For me, it's the closest so far to my goal of the most elegant solution. So anyone got an answer to which set of numbers give

UDP Client/Server

2008-01-22 Thread Martin Marcher
Hello, I created a really simple udp server and protocol but I only get every 2nd request (and thus answer just every second request). Maybe someone could shed some light, I'm lost in the dark(tm), sorry if this is a bit oververbose but to me everything that happens here is black magic, and I hav

Re: translating Python to Assembler

2008-01-22 Thread Wim Vander Schelden
Python modules and scripts are normally not even compiled, if they have been, its probably just the Python interpreter packaged with the scripts and resources. My advice is that if you want to learn Python, is that you just read a book about it or read only resources. Learning Python from assemble

Re: translating Python to Assembler

2008-01-22 Thread John Machin
On Jan 23, 9:24 am, [EMAIL PROTECTED] wrote: > My expertise, if any, is in assembler. I'm trying to understand Python > scripts and modules by examining them after they have been > disassembled in a Windows environment. > DB "Wrong way. Go back. Read the tutorials." RET -- http://mail.python.

translating Python to Assembler...sorry if this is duplicated...it's unintentional

2008-01-22 Thread over
My expertise, if any, is in assembler. I'm trying to understand Python scripts and modules by examining them after they have been disassembled in a Windows environment. I'm wondering if a Python symbols file is available. In the Windows environment, a symbol file normally has a PDB extension. It's

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Paul Boddie
On 22 Jan, 21:48, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Jan 22, 11:32 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > [1]http://www.python.org/pypi/libxml2dom > > I must have tried this module quite a while ago since I already have > it installed. I see you're the author of the module, so

Re: difflib confusion

2008-01-22 Thread Paul Hankin
On Jan 22, 6:57 pm, "krishnakant Mane" <[EMAIL PROTECTED]> wrote: > hello all, > I have a bit of a confusing question. > firstly I wanted a library which can do an svn like diff with two files. > let's say I have file1 and file2 where file2 contains some thing which > file1 does not have.  now if I

translating Python to Assembler

2008-01-22 Thread over
My expertise, if any, is in assembler. I'm trying to understand Python scripts and modules by examining them after they have been disassembled in a Windows environment. I'm wondering if a Python symbols file is available. In the Windows environment, a symbol file normally has a PDB extension. It's

Anyone into Paimei?? Need some help.

2008-01-22 Thread over
Hi. I have been trying to get Paimei running on Windoze but find it very inconsistent. It works on certain apps really well, like Notepad, but fails on other apps, especially those written in languages like Delphi. There isn't a lot out there on Paimei and the author's site is very terse on the app

translating Python to Assembler

2008-01-22 Thread over
My expertise, if any, is in assembler. I'm trying to understand Python scripts and modules by examining them after they have been disassembled in a Windows environment. I'm wondering if a Python symbols file is available. In the Windows environment, a symbol file normally has a PDB extension. It's

Re: get the size of a dynamically changing file fast ?

2008-01-22 Thread Stef Mientki
Mike Driscoll wrote: > On Jan 22, 3:35 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > >> Mike Driscoll wrote: >> >>> On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: >>> hello, I've a program (not written in Python) that generates a few thousands >>>

Re: Hebrew in idle ans eclipse (Windows)

2008-01-22 Thread iu2
On Jan 17, 10:35 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > ... > print lines[0].decode("").encode("") > ... > Regards, > Martin Ok, I've got the solution, but I still have a question. Recall: When I read data using sql I got a sequence like this: \x88\x89\x85 But when I entered heberw

Re: Processing XML that's embedded in HTML

2008-01-22 Thread John Machin
On Jan 23, 7:48 am, Mike Driscoll <[EMAIL PROTECTED]> wrote: [snip] > I'm not sure what is wrong here...but I got lxml to create a tree from > by doing the following: > > > from lxml import etree > from StringIO import StringIO > > parser = etree.HTMLParser() > tree = etree.parse(filename, parser

Re: get the size of a dynamically changing file fast ?

2008-01-22 Thread Mike Driscoll
On Jan 22, 3:35 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > Mike Driscoll wrote: > > On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > > >> hello, > > >> I've a program (not written in Python) that generates a few thousands > >> bytes per second, > >> these files are dumped in 2 buffe

Re: get the size of a dynamically changing file fast ?

2008-01-22 Thread Stef Mientki
Mike Driscoll wrote: > On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > >> hello, >> >> I've a program (not written in Python) that generates a few thousands >> bytes per second, >> these files are dumped in 2 buffers (files), at in interval time of 50 msec, >> the files can be read

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
On Jan 22, 11:39 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Alnilam wrote: > > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: > >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, > >> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous > >>

Re: Bug in __init__?

2008-01-22 Thread Bart Ogryczak
On 2008-01-22, citizen Bruno Desthuilliers testified: >> from copy import copy >> ### see also deepcopy >> self.lst = copy(val) > > What makes you think the OP wants a copy ? I´m guessing he doesn´t want to mutate original list, while

Re: question

2008-01-22 Thread Wildemar Wildenburger
Hi there :) A little tip upfront: In the future you might want to come up with a more descriptive subject line. This will help readers decide early if they can possibly help or not. [EMAIL PROTECTED] wrote: > def albumInfo(theBand): > def Rush(): > return ['Rush', 'Fly By Night', 'C

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Mike Driscoll
On Jan 22, 11:32 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > The rest of the document is html, javascript div tags, etc. I need the > > information only from the row where the Relationship tag = Owner and > > the Priority tag = 1. The rest I can ignore. When I tried parsing it > > with minidom,

Re: bags? 2.5.x?

2008-01-22 Thread MRAB
On Jan 21, 11:13 pm, Dan Stromberg <[EMAIL PROTECTED]> wrote: > On Thu, 17 Jan 2008 18:18:53 -0800, Raymond Hettinger wrote: > >> >> I keep wanting something like them - especially bags with something > >> >> akin to set union, intersection and difference. > > >> > How about this recepie > >> > htt

Re: question

2008-01-22 Thread Tim Chase
> def albumInfo(theBand): > def Rush(): > return ['Rush', 'Fly By Night', 'Caress of Steel', '2112', 'A Farewell to Kings', 'Hemispheres'] > > def Enchant(): > return ['A Blueprint of the World', 'Wounded', 'Time Lost'] > > The only problem with the code above though is that

Re: pairs from a list

2008-01-22 Thread Raymond Hettinger
[Peter Otten] > You can be bolder here as the izip() docs explicitly state > > """ > Note, the left-to-right evaluation order of the iterables is > guaranteed. This makes possible an idiom for clustering a data series into > n-length groups using "izip(*[iter(s)]*n)". > """ . . . > is about zip(),

Re: question

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 7:58 pm, <[EMAIL PROTECTED]> wrote: > I'm still learning Python and was wanting to get some thoughts on this.  I > apologize if this sounds ridiculous...  I'm mainly asking it to gain some > knowledge of what works better.  The main question I have is if I had a lot > of lists to choo

Re: PyGTK, Glade, and ComboBoxEntry.append_text()

2008-01-22 Thread Yann Leboulanger
Greg Johnston wrote: > Hey all, > > I'm a relative newbie to Python (switched over from Scheme fairly > recently) but I've been using PyGTK and Glade to create an interface, > which is a combo I'm very impressed with. > > There is, however, one thing I've been wondering about. It doesn't > seem p

Re: question

2008-01-22 Thread James Matthews
Since you aren't familyer with classes i will keep this within the scope of functions... If you have code like this def a(): def b(): a+=1 Then you can only call function b when you are within function a James On Jan 22, 2008 8:58 PM, <[EMAIL PROTECTED]> wrote: > I'm still learning Pyt

Re: pairs from a list

2008-01-22 Thread Peter Otten
Arnaud Delobelle wrote: > On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > >> http://bugs.python.org/issue1121416> >> >> fwiw, >> Alan Isaac > > Thanks. So I guess I shouldn't take the code snippet I quoted as a > specification of izip but rather as an illustration. You can be bolde

Re: A global or module-level variable?

2008-01-22 Thread Paul Rubin
Bret <[EMAIL PROTECTED]> writes: > nextport=42000 > > def getNextPort(): > nextport += 1 > return nextport If you have to do it that way, use: def getNextPort(): global nextport nextport += 1 return nextport the global declaration stops the compiler from trea

question

2008-01-22 Thread jyoung79
I'm still learning Python and was wanting to get some thoughts on this. I apologize if this sounds ridiculous... I'm mainly asking it to gain some knowledge of what works better. The main question I have is if I had a lot of lists to choose from, what's the best way to write the code so I'm n

A global or module-level variable?

2008-01-22 Thread Bret
This has to be easier than I'm making it I've got a module, remote.py, which contains a number of classes, all of whom open a port for communication. I'd like to have a way to coordinate these port numbers akin to this: So I have this in the __init__.py file for a package called cstore: nex

Re: Problem with processing XML

2008-01-22 Thread John Carlyle-Clarke
Paul McGuire wrote: > > Here is a pyparsing hack for your problem. Thanks Paul! This looks like an interesting approach, and once I get my head around the syntax, I'll give it a proper whirl. -- http://mail.python.org/mailman/listinfo/python-list

Re: printing escape character

2008-01-22 Thread hrochonwo
On Jan 22, 7:58 pm, "Jerry Hill" <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I want to print string without "decoding" escaped characters to > > newline etc. > > like print "a\nb" -> a\nb > > is there a simple way to do it in python or

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 6:34 pm, Paddy <[EMAIL PROTECTED]> wrote: [...] > Hi George, > You need to 'get it right' first. Micro optimizations for speed > without thought of the wider context is a bad habit to form and a time > waster. > If the routine is all that needs to be delivered and it does not > perform a

Re: printing escape character

2008-01-22 Thread Jerry Hill
On Jan 22, 2008 1:38 PM, hrochonwo <[EMAIL PROTECTED]> wrote: > Hi, > > I want to print string without "decoding" escaped characters to > newline etc. > like print "a\nb" -> a\nb > is there a simple way to do it in python or should i somehow use > string.replace(..) function ? >>> print 'a\nb'.enc

difflib confusion

2008-01-22 Thread krishnakant Mane
hello all, I have a bit of a confusing question. firstly I wanted a library which can do an svn like diff with two files. let's say I have file1 and file2 where file2 contains some thing which file1 does not have. now if I do readlines() on both the files, I have a list of all the lines. I now wan

rpy registry

2008-01-22 Thread [EMAIL PROTECTED]
Howdy, I've been using rpy (1.0.1) and python (2.5.1) on my office computer with great success. When I went to put rpy on my laptop, however, I get an error trying to load rpy. "Unable to determine R version from the registry. Trying another method." followed by a few lines of the usual error me

Re: Beginners question about debugging (import)

2008-01-22 Thread Diez B. Roggisch
Albert van der Horst schrieb: > I'm starting with Python. First with some interactive things, > working through the tutorial, > then with definitions in a file called sudoku.py. > Of course I make lots of mistakes, so I have to include that file > time and again. > > I discovered (the hard way) th

printing escape character

2008-01-22 Thread hrochonwo
Hi, I want to print string without "decoding" escaped characters to newline etc. like print "a\nb" -> a\nb is there a simple way to do it in python or should i somehow use string.replace(..) function ? thanks for any reply hrocho -- http://mail.python.org/mailman/listinfo/python-list

Re: pairs from a list

2008-01-22 Thread Paddy
On Jan 22, 5:34 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 22, 12:15 am, Paddy <[EMAIL PROTECTED]> wrote: > > > On Jan 22, 3:20 am, Alan Isaac <[EMAIL PROTECTED]> wrote:> I want to > > generate sequential pairs from a list. > > <> > > > What is the fastest way? (Ignore the import time.)

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Steven Bethard
Diez B. Roggisch wrote: > Jean-Paul Calderone wrote: > >> On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" >> <[EMAIL PROTECTED]> wrote: >>> Jean-Paul Calderone wrote: >>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > For a simple greenlet/

Re: pairs from a list

2008-01-22 Thread Alan Isaac
Arnaud Delobelle wrote: > pairs4 wins. Oops. I see a smaller difference, but yes, pairs4 wins. Alan Isaac import time from itertools import islice, izip x = range(51) def pairs1(x): return izip(islice(x,0,None,2),islice(x,1,None,2)) def pairs2(x): xiter = iter(x) while True:

Beginners question about debugging (import)

2008-01-22 Thread Albert van der Horst
I'm starting with Python. First with some interactive things, working through the tutorial, then with definitions in a file called sudoku.py. Of course I make lots of mistakes, so I have to include that file time and again. I discovered (the hard way) that the second time you invoke from sudok

Submitting with PAMIE

2008-01-22 Thread romo20350
Hi I really need help. I've been looking around for an answer forever. I need to submit a form with no name and also the submit button has no name or value. How might I go about doing either of these. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Using utidylib, empty string returned in some cases

2008-01-22 Thread Boris
Hello I'm using debian linux, Python 2.4.4, and utidylib (http:// utidylib.berlios.de/). I wrote simple functions to get a web page, convert it from windows-1251 to utf8 and then I'd like to clean html with it. Here is two pages I use to check my program: http://www.ya.ru/ (in this case everythin

Re: Processing XML that's embedded in HTML

2008-01-22 Thread Paul Boddie
On 22 Jan, 17:57, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > I need to parse a fairly complex HTML page that has XML embedded in > it. I've done parsing before with the xml.dom.minidom module on just > plain XML, but I cannot get it to work with this HTML page. It's HTML day on comp.lang.python

Re: Curses and Threading

2008-01-22 Thread Ian Clark
On 2008-01-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> In fact you have *two* threads: the main thread, and the one you create >> explicitly. > >> After you start the clock thread, the main thread continues executing, >> immediately entering the finally clause. >> If you want to wait for th

Re: Boa constructor debugging - exec some code at breakpoint?

2008-01-22 Thread Mike Driscoll
On Jan 22, 1:23 am, Joel <[EMAIL PROTECTED]> wrote: > Can you please tell me how this can be done.. > are there any other IDEs for the same purpose if Boa can't do it? > > Joel > > On Jan 6, 11:01 am, Joel <[EMAIL PROTECTED]> wrote: > > > Hey there.. > > I'm using boa constructor to debug a python

Processing XML that's embedded in HTML

2008-01-22 Thread Mike Driscoll
Hi, I need to parse a fairly complex HTML page that has XML embedded in it. I've done parsing before with the xml.dom.minidom module on just plain XML, but I cannot get it to work with this HTML page. The XML looks like this: Owner 1 07/16/2007 No Doe, John 1905 S

Re: Problem with processing XML

2008-01-22 Thread Paul Boddie
On 22 Jan, 15:11, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote: > > I wrote some code that works on my Linux box using xml.dom.minidom, but > it will not run on the windows box that I really need it on. Python > 2.5.1 on both. > > On the windows machine, it's a clean install of the Python .msi fr

Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
On 1/21/2008 9:02 AM, Bernard Desnoues wrote: > Hi, > > I've got a problem with the use of Redmon (redirection port monitor). I > intend to develop a virtual printer so that I can modify data sent to > the printer. FWIW: there is a nice update the RedMon (v1.7) called RedMon EE (v1.81) availab

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 4:10 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > http://bugs.python.org/issue1121416> > > fwiw, > Alan Isaac Thanks. So I guess I shouldn't take the code snippet I quoted as a specification of izip but rather as an illustration. -- Arnaud -- http://mail.python.org/mailman/listinfo/

Re: HTML parsing confusion

2008-01-22 Thread Diez B. Roggisch
Alnilam wrote: > On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: >> > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, >> > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous >> > 200-modules PyXML package installed. And you don't want the 75Kb >> > Beau

Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote: > Hi, > > This is Windows bug that is described here: > http://support.microsoft.com/default.aspx?kbid=321788 > > This article also contains solution: you need to add registry value: > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVe

Re: Curses and Threading

2008-01-22 Thread Brett . Friermood
> In fact you have *two* threads: the main thread, and the one you create > explicitly. > After you start the clock thread, the main thread continues executing, > immediately entering the finally clause. > If you want to wait for the other thread to finish, use the join() method. > But I'm unsure

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread james . pye
On Jan 22, 6:20 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > For a simple greenlet/tasklet/microthreading experiment I found myself in > the need to ask the question > > isgenerator(v) > > but didn't find any implementation in the usual suspects - builtins or > inspect. types.GeneratorType

Re: pairs from a list

2008-01-22 Thread Alan Isaac
Arnaud Delobelle wrote: > According to the docs [1], izip is defined to be equivalent to: > > def izip(*iterables): > iterables = map(iter, iterables) > while iterables: > result = [it.next() for it in iterables] > yield tuple(result) > > This guar

Re: pairs from a list

2008-01-22 Thread Arnaud Delobelle
On Jan 22, 1:19 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > I suppose my question should have been, > is there an obviously faster way? > Anyway, of the four ways below, the > first is substantially fastest.  Is > there an obvious reason why? Can you post your results? I get different ones (pairs

Re: Problem with processing XML

2008-01-22 Thread Alnilam
On Jan 22, 9:11 am, John Carlyle-Clarke <[EMAIL PROTECTED]> wrote: > By the way, is pyxml a live project or not?  Should it still be used? > It's odd that if you go tohttp://www.python.org/and click the link > "Using python for..." XML, it leads you tohttp://pyxml.sourceforge.net/topics/ > > If yo

Re: HTML parsing confusion

2008-01-22 Thread Alnilam
On Jan 22, 8:44 am, Alnilam <[EMAIL PROTECTED]> wrote: > > Pardon me, but the standard issue Python 2.n (for n in range(5, 2, > > -1)) doesn't have an xml.dom.ext ... you must have the mega-monstrous > > 200-modules PyXML package installed. And you don't want the 75Kb > > BeautifulSoup? > > I wasn'

Re: isgenerator(...) - anywhere to be found?

2008-01-22 Thread Jean-Paul Calderone
On Tue, 22 Jan 2008 15:52:02 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: > > [snip] >> >> Sorry, I still don't understand. Why is a generator different from any >> other iterator? > >Because you can use send(value) on it for example. Which you can't with >ever

Re: pairs from a list

2008-01-22 Thread bearophileHUGS
Alan Isaac>What is the fastest way? (Ignore the import time.)< Maybe someday someone will realize such stuff belongs to the python STD lib... If you need a lazy generator without padding, that splits starting from the start, then this is the faster to me if n is close to 2: def xpartition(seq, n

  1   2   >