Re: Python's handling of unicode surrogates

2007-04-20 Thread Neil Hodgson
Paul Boddie: > Do we have a volunteer? ;-) I won't volunteer to do a real implementation - the Unicode type in Python is currently around 7000 lines long and there is other code to change in, for example, regular expressions. Here's a demonstration C++ implementation that stores an array o

Re: Python and XML?

2007-04-20 Thread Leonard J. Reder
Stefan, This package is looking better I tried the validation example, but it did not work with 1.3beta so I grabbed 1.2. If objectify works well I think this is a great pick for anyone using xml. Please post to me and the python announce when 1.3 is released. thanks, Len Stefan Behnel wrote:

Unexpected exception from socket.getaddrinfo on Unicode URL

2007-04-20 Thread John Nagle
Here's a strange little bug. "socket.getaddrinfo" blows up if given a bad domain name containing ".." in Unicode. The same string in ASCII produces the correct "gaierror" exception. Actually, this deserves a documentation mention. The "socket" module, given a Unicode string, calls the

Re: Significance of "start" parameter to string method "endswith"

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 23:20:39 -0300, Gabriel Genellina wrote: >>> ... but increases the care and attention required when coding: >> >> There are always trade-offs. > > ... and you still need more attention when replying - read again your own > reply :) D'oh! -- Steven. -- http://mail.pyt

TK-grid problem, please help

2007-04-20 Thread Ray
hi, I have a question about how to use .grid_forget (in python/TK) I need to work on grid repeatly. everytime when a button is pressed, the rows of grid is different. such like, first time, it generate 10 rows of data. 2nd time, it maybe only 5 rows. so I need a way to RESET the grid data every t

Re: using tkinter to display html

2007-04-20 Thread Stephen M. Gava
On Thu, 19 Apr 2007 23:42:49 -0700, Glenn Hutchings wrote: > On 20 Apr, 02:54, "Stephen M. Gava" <[EMAIL PROTECTED]> > wrote: >> yeah. i feel like i'm being forced to use wxwidgets/wxpython just >> because i need pretty good html display though. > > You could always use a real web browser: > >

Re: using tkinter to display html

2007-04-20 Thread Stephen M. Gava
On Fri, 20 Apr 2007 09:45:16 -0400, Kevin Walzer wrote: > PySol has an HTML viewer. Here's a link to some discusison about it: > > http://mail.python.org/pipermail/tkinter-discuss/2006- January/000614.html > > PySol is GPL, so if your application is also GPL, then it might be an > option. thank

Re: using tkinter to display html

2007-04-20 Thread Stephen M. Gava
On Fri, 20 Apr 2007 03:28:22 -0700, Rob Wolfe wrote: >> > The following thread has various ideas in it: >> > http://mail.python.org/pipermail/python-list/2001-October/107989.html >> >> thanks mike, i found that thread before i posted here, it doesn'rt >> answer my question though. > > Why not? Did

Re: comparison with None

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 23:48:02 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >> Reference Manual, 5.9 Comparisons >> >> "The objects need not have the same type. If both are numbers, they are >> converted to a common type. Otherwise, objects of d

Re: how to transfer integer on socket?

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 23:48:58 -0300, Frank Potter <[EMAIL PROTECTED]> escribió: > Is there any easy way to transfer 4 bit integer on socket? Extend it to 8 bits (1 byte) and use a single character (string of length 1) > I want to send like this: > > a=5 > send_integer(socket_s,a) socket_s.se

how to transfer integer on socket?

2007-04-20 Thread Frank Potter
Is there any easy way to transfer 4 bit integer on socket? I want to send like this: a=5 send_integer(socket_s,a) and receive like this: a=receive_integer(socket_s) Sending and receiving is in binary form, not transfer it to string. Is there any easy way to do this? -- http://mail.python.org/

Re: comparison with None

2007-04-20 Thread Alex Martelli
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 20 Apr 2007 11:40:00 -0300, Alex Martelli <[EMAIL PROTECTED]> > escribió: > > > I'm still interested to know where that erroneous quote from Alan Isaac > > comes from, because if it's in Python's docs, it can be fixed. > > It was a partial

wx.TextCtrl.SetDefaultStyle not working?

2007-04-20 Thread [EMAIL PROTECTED]
I'm running Python2.5 with wxPython v2.8.3.0 under WinXP and I cannot get the SetDefaultStyle method to work. I'm trying: self.output.SetDefaultStyle(wx.TextAttr(wx.RED)) self.output.AppendText(text) self.output.SetDefaultStyle(wx.TextAttr()) where "self.output" is a Text

Re: Python's handling of unicode surrogates

2007-04-20 Thread Rhamphoryncus
On Apr 20, 6:21 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I don't believe this specific variant has been discussed. > > Now that you clarify it: no, it hasn't been discussed. I find that > not surprising - this proposal is so strange and unnatural that > probably nobody dared to suggest

Re: Significance of "start" parameter to string method "endswith"

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 23:13:23 -0300, Steven D'Aprano <[EMAIL PROTECTED]> escribió: > On Fri, 20 Apr 2007 15:21:56 -0700, John Machin wrote: > >> On Apr 20, 9:12 am, Steven D'Aprano >> <[EMAIL PROTECTED]> wrote: >>> >>> You can do this: >>> >>> p = 0 >>> while text: >>> p = text.find('parrot',

Re: Newbie question regarding string.split()

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 12:15:33 -0700, kyosohma wrote: > One hack to make it work is to add the following line right before you > print "projectOptions": > > projectOptions.pop(0) # pop the first element out of the list Which will introduce a nice bug into the Original Poster's code when the input

Re: Python's handling of unicode surrogates

2007-04-20 Thread Rhamphoryncus
On Apr 20, 5:49 pm, Ross Ridge <[EMAIL PROTECTED]> wrote: > Rhamphoryncus <[EMAIL PROTECTED]> wrote: > >The only code that will be changed is that which doesn't handle > >surrogates properly. Some will start working properly. Some (ie > >random.choice(u'\U0010\u')) will fail explicitly (

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 15:36:00 -0700, [EMAIL PROTECTED] wrote: > > >> The article explains that, amongst other things, tuples are faster >> than lists, so if you are working with constant values (inmutables) >> they are more indicated than lists. > > Thanks. I thought Python's design wasn't so c

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 15:53:45 -0700, garrickp wrote: > Speaking of inessential but very useful things, I'm also a big fan of > the tuple swap... > a = 2 > b = 3 > (a, b) = (b, a) Since tuples are made by commas, not brackets, that can be written more cleanly as: a, b = b, a The only exception is

Re: Significance of "start" parameter to string method "endswith"

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 15:21:56 -0700, John Machin wrote: > On Apr 20, 9:12 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Thu, 19 Apr 2007 13:57:16 -0700, Boris Dusek wrote: >> >> > what is the use-case of parameter "start" in string's "endswith" >> >> > method? >> >> >> def foo(function,ins

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Scott David Daniels
Steven W. Orr wrote: > I really tried. I give up. > > I got this one last time (for which I'm very grateful). > ... Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. > > And for extra credit, I need the s

Re: When to clear a dictionary...

2007-04-20 Thread Steven D'Aprano
On Fri, 20 Apr 2007 09:48:07 -0700, Bill Jackson wrote: > What is the benefit of clearing a dictionary, when you can just reassign > it as empty? They are two different things. In the first place, you clear the dictionary. In the second place, you reassign the name to a new object (which may be

Re: Beginner: Simple Output to a Dialog PyQt4

2007-04-20 Thread David Boddie
On Tuesday 17 April 2007 07:42, Glen wrote: > I've written a script in python and put together a simple QFrame with a > QTextBrowser with Designer. I've translated the C++ into python using > puic4. Just to avoid any misunderstanding: the form is actually stored as XML. You can create C++

Re: Beginner: Formatting text output (PyQt4)

2007-04-20 Thread David Boddie
On Thursday 19 April 2007 00:50, Glen wrote: > What seems to be happening is that the font that pyqt is using is not > fixed width, so I did this: > qTxtFormat = QTextCharFormat() > qTxtFormat.setFontFixedPitch(True) > ui.textEdit.setCurrentCharFormat(qTxtFormat) It may be that the font you're us

Re: PYQT 3 communication with 2 windows

2007-04-20 Thread David Boddie
On Thursday 19 April 2007 22:38, Marcpp wrote: > Hi, I'm introducing to program in python + pyqt. > I have a main window that call a second window (to introduce a info > with textedit) > when press the second window button I need to return to the main > window the info > introduced in the second w

Re: service for file monitoring

2007-04-20 Thread Martin v. Löwis
> well i tried reading that but that way i'll have to make the program > monitor each and every directory. > when a file is created or deleted or filename modified , a call must > be made to the os kernel . > isn't there any way i can utilize that with any api or package > functions so that i can m

Re: Python's handling of unicode surrogates

2007-04-20 Thread Martin v. Löwis
> I don't believe this specific variant has been discussed. Now that you clarify it: no, it hasn't been discussed. I find that not surprising - this proposal is so strange and unnatural that probably nobody dared to suggest it. > s[5] does not exist. You would get an IndexError indicating that i

Re: Testing GUI's

2007-04-20 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Stephen Lewitowski <[EMAIL PROTECTED]> wrote: >Can any of you guy's out there point me to information on automating >GUI's that use Tkinter. > >I would like to find out more and possibly get involved if there are any > projects under development.

Re: Python's handling of unicode surrogates

2007-04-20 Thread Ross Ridge
Rhamphoryncus <[EMAIL PROTECTED]> wrote: >The only code that will be changed is that which doesn't handle >surrogates properly. Some will start working properly. Some (ie >random.choice(u'\U0010\u')) will fail explicitly (rather than >silently). You're falsely assuming that any code tha

Re: how to get a wrap aound slice of numpy array

2007-04-20 Thread danfan1981
Thanks. I didn't know numpy can do vector indexing as in Matlab. -- http://mail.python.org/mailman/listinfo/python-list

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread James Stroud
[EMAIL PROTECTED] wrote: > On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > >>One inessential but very useful thing about tuples when you have a lot >>of them is that they are allocated the minimum possible amount of >>memory. OTOH lists are created with some slack so that appending et

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread garrickp
On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote: > One inessential but very useful thing about tuples when you have a lot > of them is that they are allocated the minimum possible amount of > memory. OTOH lists are created with some slack so that appending etc > can avoid taking quadratic

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread John Machin
On Apr 21, 7:09 am, Luis M. González <[EMAIL PROTECTED]> wrote: > On Apr 20, 3:28 pm, Bjoern Schliessmann > [EMAIL PROTECTED]> wrote: > > Luis M. González wrote: > > > I don't remember exactly where I read about it, but Guido said > > > once that tuples are being kept mainly for historical reasons

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread [EMAIL PROTECTED]
> The article explains that, amongst other things, tuples are faster > than lists, so if you are working with constant values (inmutables) > they are more indicated than lists. Thanks. I thought Python's design wasn't so concerned with optimizations. Adding a new type "just" for optimization re

Testing GUI's

2007-04-20 Thread Stephen Lewitowski
Can any of you guy's out there point me to information on automating GUI's that use Tkinter. I would like to find out more and possibly get involved if there are any projects under development. Thanks in advance. Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Significance of "start" parameter to string method "endswith"

2007-04-20 Thread John Machin
On Apr 20, 9:12 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 19 Apr 2007 13:57:16 -0700, Boris Dusek wrote: > >> > what is the use-case of parameter "start" in string's "endswith" > >> > method? > > >> def foo(function,instance,param): > >> if function(instance,param,2,4): > >>

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Fuzzyman
On Apr 20, 6:09 pm, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > Please help me think of an example where immutable tuples are > > essential. > > When used as dictionary keys (also everywhere else where they must > be in a constant order). > > Yes, this *is* used in practice. > Yup -

Re: service for file monitoring

2007-04-20 Thread Carles Pina i Estany
Hi, On Apr/20/2007, Gabriel Genellina wrote: > En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]> > escribió: > > > i am designing a desktop search engine using python. > > i am having a query , is there a package available that contains > > functions for retrieving the files being

Re: When to clear a dictionary...

2007-04-20 Thread Larry Bates
Gabriel Genellina wrote: > En Fri, 20 Apr 2007 14:28:00 -0300, Larry Bates > <[EMAIL PROTECTED]> escribió: > >> Bill Jackson wrote: >>> What is the benefit of clearing a dictionary, when you can just reassign >>> it as empty? >> >> If you have objects that point to the dictionary (something like a

Re: Do other Python GUI toolkits require this? (OT)

2007-04-20 Thread Roel Schroeven
hg schreef: > Roel Schroeven wrote: > >> Hendrik van Rooyen schreef: >>> "Steve Holden" <[EMAIL PROTECTED]> wrote: >>> >>> Perhaps in Belgium they prefer climbing mountains over walking up and down gentle hills? >>> Mountains ? Hills ? In Belgium ?? >>> >>> Its not called the batt

Re: how to get a wrap aound slice of numpy array

2007-04-20 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi, I am learning Numpy and using it for a course project. Welcome! You might want to ask more numpy questions on the numpy mailing list. Answers to numpy questions here tend to be hit-or-miss. http://www.scipy.org/Mailing_Lists > Suppose x = [0, 1, 2, 3, 4], I know

Re: Do other Python GUI toolkits require this? (OT)

2007-04-20 Thread hg
Roel Schroeven wrote: > Hendrik van Rooyen schreef: >> "Steve Holden" <[EMAIL PROTECTED]> wrote: >> >> >>> Perhaps in Belgium they prefer climbing mountains over walking up and >>> down gentle hills? >> >> Mountains ? Hills ? In Belgium ?? >> >> Its not called the battlefield of Europe f

Re: Do other Python GUI toolkits require this?

2007-04-20 Thread Jorge Godoy
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > But is it a "wrong idea" if 999 people interpret the phrase one way, > and just 1 insists upon an interpretation that, while correct in a small > technical area, results in misunderstanding when speaking with the other > 999? You remind me of

Re: service for file monitoring

2007-04-20 Thread rohit
On Apr 21, 1:36 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]> > escribió: > > > For windows you can use the techniques described > here:http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_fo... > > -- > Gabriel Gen

Re: getting from command line options to file

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 17:48:10 -0300, CSUIDL PROGRAMMEr <[EMAIL PROTECTED]> escribió: > On Apr 16, 1:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote: >> CSUIDL PROGRAMMEr wrote: >> > hi folks >> > I am new to python. I have a module does call a os.command(cmd) where >> > cmd is a rpm command. >>

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Luis M . González
On Apr 20, 3:28 pm, Bjoern Schliessmann wrote: > Luis M. González wrote: > > I don't remember exactly where I read about it, but Guido said > > once that tuples are being kept mainly for historical reasons. > > Weren't tuples added when lists already existed? > > Regards, > > Björn > > -- > BOFH e

Re: When to clear a dictionary...

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 14:28:00 -0300, Larry Bates <[EMAIL PROTECTED]> escribió: > Bill Jackson wrote: >> What is the benefit of clearing a dictionary, when you can just reassign >> it as empty? > > If you have objects that point to the dictionary (something like a cache) > then you want to clear t

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 15:28:51 -0300, Bjoern Schliessmann <[EMAIL PROTECTED]> escribió: > Luis M. González wrote: > >> I don't remember exactly where I read about it, but Guido said >> once that tuples are being kept mainly for historical reasons. > > Weren't tuples added when lists already existe

Re: getting from command line options to file

2007-04-20 Thread CSUIDL PROGRAMMEr
On Apr 16, 1:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote: > CSUIDL PROGRAMMEr wrote: > > hi folks > > I am new to python. I have a module does call a os.command(cmd) where > > cmd is a rpm command. > > Instead of using os.command and getting the results on command line , > > i would like to du

Re: service for file monitoring

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]> escribió: > i am designing a desktop search engine using python. > i am having a query , is there a package available that contains > functions for retrieving the files being edited , created,deleted in > the file system. For window

how to get a wrap aound slice of numpy array

2007-04-20 Thread danfan1981
Hi, I am learning Numpy and using it for a course project. Suppose x = [0, 1, 2, 3, 4], I know that x[0:2] would give [0,1], and x[-1] give [4], is there a way that I can get [4,0,1]. I try x[-1:2], but it returns an empty array. I am doing convolution (e.g. convolve [0, 1, 2, 3, 4] with [1,-2,1])

Re: Newbie question regarding string.split()

2007-04-20 Thread Steve Holden
Tommy Grav wrote: > On Apr 20, 2007, at 3:15 PM, [EMAIL PROTECTED] wrote: >> On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote: >>> ['', 'b34bx5b', 'c4a5a6'] >>> >>> My question is, why is the first element of projectOptions an empty >>> string? What can I do so that the first element is not

Re: Do other Python GUI toolkits require this?

2007-04-20 Thread Gabriel Genellina
En Thu, 19 Apr 2007 17:33:19 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > On Apr 19, 6:54 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: >> I don't know how you come to the conclusion that it is a mathematical >> absurdity but consider this: If you find that common usage propagates >>

Re: urlopen.read()

2007-04-20 Thread Steve Holden
ken wrote: > Hi, > > When I call urlopen.read() like this: > > data = urlopen("http://localhost";).read(). > > Does that mean I will read the whole document to data, regardless how > many data being sent back? > > Thank you. > Yes. However you can read (and presumably process)one line at a tim

Python-URL! - weekly Python news and links (Apr 18)

2007-04-20 Thread Cameron Laird
QOTW: "I can't say enough about Python and agile programming. Piecing together small, well-documented, well-tested pieces of software makes solving big problems easier." - Shannon Behrens of Foxmarks; May DDJ http://www.ddj.com/dept/architect/198800578 "Automatic type inference may be su

service for file monitoring

2007-04-20 Thread rohit
hi, i am designing a desktop search engine using python. i am having a query , is there a package available that contains functions for retrieving the files being edited , created,deleted in the file system. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: matplotlib basic question

2007-04-20 Thread Tommy Grav
On Apr 20, 2007, at 3:49 PM, Robert Kern wrote: > Tommy Grav wrote: >> On Apr 20, 2007, at 2:44 PM, Robert Kern wrote: >>> Colin J. Williams wrote: >>> I'm not sure that scipy has been updated to Python 2.5 >>> ? scipy certainly works with 2.5. Are you referring to something >>> else perhaps?

Re: Domain Keys in Python

2007-04-20 Thread Andrew Veitch
--- Andrew Veitch <[EMAIL PROTECTED]> wrote: > In Perl I would just use Crypt:RSA which has a sign > method with an armour option which generates exactly > what I want but I can't find a way of doing this in > Python. I've worked it out, just for the archives the answer is: import base64 from M2

Re: Newbie question regarding string.split()

2007-04-20 Thread Tommy Grav
On Apr 20, 2007, at 3:15 PM, [EMAIL PROTECTED] wrote: > On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote: >> ['', 'b34bx5b', 'c4a5a6'] >> >> My question is, why is the first element of projectOptions an empty >> string? What can I do so that the first element is not an empty >> string? but

urlopen.read()

2007-04-20 Thread ken
Hi, When I call urlopen.read() like this: data = urlopen("http://localhost";).read(). Does that mean I will read the whole document to data, regardless how many data being sent back? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: How To Find Currently Selected Tile.Notebook Tab?

2007-04-20 Thread [EMAIL PROTECTED]
> > How can I determine what tab is currently selected in a Tile.Notebook > > widget? > > > The best suggestion I've been able to find via Google is > > "mynotebook.index('current')", but that gets an exception from Tcl. > > How about > > mynotebook.index.current() No good: AttributeError: 'funct

Re: matplotlib basic question

2007-04-20 Thread Robert Kern
Tommy Grav wrote: > On Apr 20, 2007, at 2:44 PM, Robert Kern wrote: >> Colin J. Williams wrote: >> >>> I'm not sure that scipy has been updated to Python 2.5 >> ? scipy certainly works with 2.5. Are you referring to something >> else perhaps? > > A side question: Is there any plans of updating t

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread pdpi
Iou need only consider having cartesian coordinate sets as the keys for an example. A 2 dimensional list might be overly expensive if your coordinates span a large area but are relatively sparse. -- http://mail.python.org/mailman/listinfo/python-list

Re: matplotlib basic question

2007-04-20 Thread Tommy Grav
On Apr 20, 2007, at 2:44 PM, Robert Kern wrote: > Colin J. Williams wrote: > >> I'm not sure that scipy has been updated to Python 2.5 > > ? scipy certainly works with 2.5. Are you referring to something > else perhaps? A side question: Is there any plans of updating the scipy.org Superpack bu

Re: regular expression for parsing an html element

2007-04-20 Thread abcd
thanks, forgot that. -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression for parsing an html element

2007-04-20 Thread Wojciech Muła
abcd wrote: > My regex so far is: src=\"(.*)\" however the group in this case > would end up being, image/blah/a.jpg" id="d">blah blah blah a>. > > how can I tell the regex group (.*) to end when it gets to the first > " ? Use non-greedy matching, i.e. src=\"(.*?)\" (question mark af

Re: Newbie question regarding string.split()

2007-04-20 Thread Stephen Lewitowski
kevinliu23 wrote: > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') > print projectOptions > > ['', 'b34bx5b', 'c4a5a6'] > > My que

regular expression for parsing an html element

2007-04-20 Thread abcd
I have some HTML such as blah blah blah I wnat to pull out the text that lies inside the quotes of the src attribute. So in this example I would get image/blah/a.jpg My regex so far is: src=\"(.*)\" however the group in this case would end up being, image/blah/a.jpg" id="d">bla

Re: comparison with None

2007-04-20 Thread Gabriel Genellina
En Fri, 20 Apr 2007 11:40:00 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > I'm still interested to know where that erroneous quote from Alan Isaac > comes from, because if it's in Python's docs, it can be fixed. It was a partial quote, that's why it appeared to be wrong: Library reference

Re: Python un-plugging the Interpreter

2007-04-20 Thread John Nagle
Steve Holden wrote: > Marc 'BlackJack' Rintsch wrote: > >> In <[EMAIL PROTECTED]>, John Nagle wrote: >> >>> Many cases are easy. If a smart compiler sees >>> >>> for i in range(n) : >>>... # something >>> >>> and there are no other assignments to "i", then it's clear that >>> "i"

Re: Beautiful Soup iterator question....

2007-04-20 Thread Paul McGuire
On Apr 20, 2:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > > did you try something like (untested) > > cell1, cell2, cell3, cell4, cell5, \ > cell6, cell7, cell8 = row.findAll("td") > > No need for the "for" if you want to handle each cell differently, you > won;t be iterating o

Re: Newbie question regarding string.split()

2007-04-20 Thread kyosohma
On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote: > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') > print projectOptions > >

Re: Newbie question regarding string.split()

2007-04-20 Thread Steve Holden
kevinliu23 wrote: > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > First of all, the string module is pretty much deprecated nowadays. What you are actually using, the .split() method of a string, is the preferred way to

Re: matplotlib basic question

2007-04-20 Thread Robert Kern
Colin J. Williams wrote: > I'm not sure that scipy has been updated to Python 2.5 ? scipy certainly works with 2.5. Are you referring to something else perhaps? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad att

Beautiful Soup iterator question....

2007-04-20 Thread cjl
P: I am screen-scraping a table. The table has an unknown number of rows, but each row has exactly 8 cells. I would like to extract the data from the cells, but the first three cells in each row have their data nested inside other tags. So I have the following code: for row in table.findAll("tr

Re: Newbie question regarding string.split()

2007-04-20 Thread Grant Edwards
On 2007-04-20, kevinliu23 <[EMAIL PROTECTED]> wrote: > Hey guys, > > So I have a question regarding the split() function in the string > module. Let's say I have an string... > > input = "2b 3 4bx 5b 2c 4a 5a 6" > projectOptions = (input.replace(" ", "")).split('2') > print projectOptions > > ['',

Re: Beautiful Soup iterator question....

2007-04-20 Thread Steve Holden
cjl wrote: > P: > > I am screen-scraping a table. The table has an unknown number of rows, > but each row has exactly 8 cells. I would like to extract the data > from the cells, but the first three cells in each row have their data > nested inside other tags. > > So I have the following code: >

Newbie question regarding string.split()

2007-04-20 Thread kevinliu23
Hey guys, So I have a question regarding the split() function in the string module. Let's say I have an string... input = "2b 3 4bx 5b 2c 4a 5a 6" projectOptions = (input.replace(" ", "")).split('2') print projectOptions ['', 'b34bx5b', 'c4a5a6'] My question is, why is the first element of proj

Re: Python Feature Request: Explicit variable declarations

2007-04-20 Thread Bjoern Schliessmann
Dennis Lee Bieber wrote: > Unless it should be interpreted as (C/C)++, which would result in > 2 No, since postfix ++ "returns before and increments after". But what you say is true for ++(C/C). Regards, Björn -- BOFH excuse #274: It was OK before you touched it. -- http://mail.python.org

Re: matplotlib basic question

2007-04-20 Thread Colin J. Williams
orangeDinosaur wrote: > OK, I'll go with the enthought installation. This seems to be the > path of least resistance. For those of you who have been in my > position, is there a reason NOT to go with the enthought installation > and do things piecemeal instead? > > thanks, > trevis > > On Apr 2

Re: Calculating CIDR blocks

2007-04-20 Thread Pekka Järvinen
On 20 huhti, 18:30, [EMAIL PROTECTED] (Eddie Corns) wrote: > =?iso-8859-1?q?Pekka_J=E4rvinen?= <[EMAIL PROTECTED]> writes: > >On 20 huhti, 14:34, [EMAIL PROTECTED] (Eddie Corns) wrote: > >> Look at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466298 > >> it handles most of the logic of c

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Bjoern Schliessmann
Luis M. González wrote: > I don't remember exactly where I read about it, but Guido said > once that tuples are being kept mainly for historical reasons. Weren't tuples added when lists already existed? Regards, Björn -- BOFH excuse #101: Collapsed Backbone -- http://mail.python.org/mailm

Re: Expanding tkinter widgets to fill the window

2007-04-20 Thread jim-on-linux
On Friday 20 April 2007 13:56, Anton Vredegoor wrote: > KDawg44 wrote: > > I am writing a GUI front end in Python using > > Tkinter. I have developed the GUI in a grid > > and specified the size of the window. The > > widgets are centered into the middle of the > > window. I would like them to

Re: matplotlib basic question

2007-04-20 Thread orangeDinosaur
OK, I'll go with the enthought installation. This seems to be the path of least resistance. For those of you who have been in my position, is there a reason NOT to go with the enthought installation and do things piecemeal instead? thanks, trevis On Apr 20, 11:36 am, Pete Forman <[EMAIL PROTECT

Re: Expanding tkinter widgets to fill the window

2007-04-20 Thread Anton Vredegoor
KDawg44 wrote: > I am writing a GUI front end in Python using Tkinter. I have > developed the GUI in a grid and specified the size of the window. The > widgets are centered into the middle of the window. I would like them > to fill the window. I tried using the sticky=E+W+N+S option on the > w

Re: When to clear a dictionary...

2007-04-20 Thread Larry Bates
Bill Jackson wrote: > What is the benefit of clearing a dictionary, when you can just reassign > it as empty? If you have objects that point to the dictionary (something like a cache) then you want to clear the existing dictionary instead of just assigning it to empty. If nothing points to it, as

python-list@python.org

2007-04-20 Thread Anton Vredegoor
Anton Vredegoor wrote: > def xsplitter(seq, pred): > Q = deque(),deque() > it = iter(seq) > def gen(p): > for x in it: > Q[pred(x) == p].append(x) > while Q[p]: yield Q[p].popleft() > while Q[p]: yield Q[p].popleft() > return gen(1)

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Luis M . González
On Apr 20, 2:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Please help me think of an example where immutable tuples are > essential. > > It seems that everywhere a tuple is used one could just as easily use > a list instead. > > chris I don't remember exactly where I read about it, but

Re: When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Please help me think of an example where immutable tuples are > essential. When used as dictionary keys (also everywhere else where they must be in a constant order). Yes, this *is* used in practice. Regards, Björn -- BOFH excuse #14: sounds like a Windows probl

When are immutable tuples *essential*? Why can't you just use lists *everywhere* instead?

2007-04-20 Thread [EMAIL PROTECTED]
Please help me think of an example where immutable tuples are essential. It seems that everywhere a tuple is used one could just as easily use a list instead. chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast and capable XML parser?

2007-04-20 Thread Magnus Lycka
Larry Bates wrote: > I don't know if it meets ALL of your requirements but this might > help: > > http://www.reportlab.org/pyrxp.html AFAIK, there is no XML Schema support in PyRXP. This is really bad enough. GPL is not an option for us, and a commercial licence is less good than e.g. MIT or LGP

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jerry Hill
On 4/20/07, Steven W. Orr <[EMAIL PROTECTED]> wrote: > I really tried. I give up. > > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. >>> ''.join(set([s[0] for s in calendar.month_abbr[1:]])) 'ADFJMONS'

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steven W. Orr wrote: > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. "".join(set(m[0] for m in calendar.month_abbr[1:])) > And for extra credit, I need the string whose

Re: When to clear a dictionary...

2007-04-20 Thread Bill Jackson
Bill Jackson wrote the following on 04/20/2007 09:48 AM: > >>> import some_function > > >>> a = {1:2,3:4} > >>> b = {1:2:4:3} > >>> a.clear() > >>> a.update(b) > > >>> a = {1:2,3:4} > >>> b = {1:2,4:3} > >>> for key in b: > a[key] = b[key] Clearly, this won't have the same resul

When to clear a dictionary...

2007-04-20 Thread Bill Jackson
What is the benefit of clearing a dictionary, when you can just reassign it as empty? Similarly, suppose I generate a new dictionary b, and need to have it accessible from a. What is the best method, under which circumstances? >>> import some_function >>> a = {1:2,3:4} >>> b = {1:2:4:3}

Re: Fast and capable XML parser?

2007-04-20 Thread Steven Bethard
Magnus Lycka wrote: > I'm looking for some library to parse XML code > much faster than the libs built into Python 2.4 > (I'm stuck with 2.4 for quite a while) and I > also need XML Schema validation, and would > appreciate support for e.g. XPath and XInclude. > I also want an API which is more Pyt

I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Steven W. Orr
I really tried. I give up. I got this one last time (for which I'm very grateful). import calendar months = dict([(month,ii) for ii,month in enumerate(calendar.month_abbr)][1:]) Now I want something that's going to give me a string whose value is the set of all of the first letters of months. O

Re: matplotlib basic question

2007-04-20 Thread Pete Forman
orangeDinosaur <[EMAIL PROTECTED]> writes: > [...] But now, the figure window is completely unresponsive -- I > can't even close it without getting the "your program is not > repsonding" business. What am I missing? This behavior so far > seems pretty unintuitive. The best way out of this i

python-list@python.org

2007-04-20 Thread Anton Vredegoor
Anton Vredegoor wrote: > What's up here? Was it a fata morgana? Am I overlooking something? Even more crazy version: def xsplitter(seq, pred): Q = deque(),deque() it = iter(seq) def gen(p): for x in it: Q[pred(x) == p].append(x) while Q[p]: yiel

Expanding tkinter widgets to fill the window

2007-04-20 Thread KDawg44
Hi, I am writing a GUI front end in Python using Tkinter. I have developed the GUI in a grid and specified the size of the window. The widgets are centered into the middle of the window. I would like them to fill the window. I tried using the sticky=E+W+N+S option on the widgets themselves and

  1   2   >