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

2007-04-03 Thread Cameron Laird
QOTW: This whole charset mess is not meant to be solved by mere mortals. - Thorsten Kampe, a day or so before solving his symptom with a codecs method: http://groups.google.com/group/comp.lang.python/msg/a2e573ccc54f66db

Re: Testing functions via command line

2007-04-03 Thread Steven D'Aprano
On Mon, 02 Apr 2007 22:32:26 -0700, pelon wrote: There must be a couple of lines that will replace the following: Yes, because otherwise the terrorists will have won. *wink* From the shell command line I wanted to send data to a specific function inside my module and execute that function

Re: exit to interpreter?

2007-04-03 Thread belinda thom
On Mar 24, 2007, at 4:30 AM, Dennis Lee Bieber wrote: On Fri, 23 Mar 2007 10:52:09 -0700, belinda thom [EMAIL PROTECTED] declaimed the following in comp.lang.python: Hi, I'm writing a function that polls the user for keyboard input, looping until it has determined that the user has

pyc file [Newbie Question]

2007-04-03 Thread Jim Aikin
Just starting to learn Python and going through the Tutorial in the Help file. FWIW, I'm a hobbyist programmer -- not extremely knowledgeable, but not entirely clueless. In 6.1.2 of the Tutorial, I find this: The modification time of the version of spam.py used to create spam.pyc is recorded

Re: python on mac os 10.4.x

2007-04-03 Thread Stephen Hansen
Check out: http://www.pythonmac.org/packages/ for the latest version of Python, which will run the latest version of wxPython fine. (I'm using wxPython 2.8 on Python 2.4) On 2 Apr 2007 22:00:55 -0700, 7stud [EMAIL PROTECTED] wrote: Hi, Python 2.3.5 comes pre-installed on mac os 10.4.7, and

Re: Opening Photoshop EPS with PIL?

2007-04-03 Thread [EMAIL PROTECTED]
On Apr 1, 12:01 pm, Méta-MCI [EMAIL PROTECTED] wrote: .eps == vector ; not bitmap I was under the impression that .eps could be opened with PIL (and by the way, their contents are actually raster (but with a work path which shouldn't be displayed anyway) Any ideas? --

Re: python on mac os 10.4.x

2007-04-03 Thread martin . laloux
Go to http://wiki.python.org/moin/MacPython and http://pythonmac.org/packages/ if you want to download macpython 2.5 or macpython 2.4.4 (framework builds). Installation is very easy (package) and you have all you want without problem with the 2.3.5 version wich remains installed and functional

Re: pyc file [Newbie Question]

2007-04-03 Thread Steven D'Aprano
On Mon, 02 Apr 2007 23:44:41 -0700, Jim Aikin wrote: Working through the tutorial, I created a file called fibo.py in my text editor, and imported it into Idle. It worked as expected. I then edited the file and resaved it. I used del fibo, followed by import fibo. That probably won't cause

Re: Tkinter Modified and bindtags ordering

2007-04-03 Thread Rob Wolfe
bytecolor wrote: [...] changing = False root = tk.Tk() t = tk.Text(master=root) t.pack() t.focus_set() t.tk.call(t._w, 'edit', 'modified', 0) What about instead of: t.bind('Modified', text_changed) this event: t.bind('KeyRelease', text_changed) root.mainloop() -- HTH, Rob --

Re: doing standart window icons unvisible in python

2007-04-03 Thread Tim Golden
gslm wrote: Hi! I want to do close-minimize icons unvisible in python.How can I do this?I want to do this especially for printing. And is it possible to provide .exe file for any program in python or only we can change the file as .pyw? I *think* -- and it's a bit hard to tell from your

Re: Generic logic/conditional class or library for classification of data

2007-04-03 Thread [EMAIL PROTECTED]
On Apr 3, 5:43 am, Basilisk96 [EMAIL PROTECTED] wrote: Thanks for the help, guys. Dictionaries to the rescue! Steven, it's certainly true that runtime creation of attributes does not fit well here. At some point, an application needs to come out of generics and deal with logic that is

Re: pyc file [Newbie Question]

2007-04-03 Thread Peter Otten
Jim Aikin wrote: Just starting to learn Python and going through the Tutorial in the Help file. FWIW, I'm a hobbyist programmer -- not extremely knowledgeable, but not entirely clueless. In 6.1.2 of the Tutorial, I find this: The modification time of the version of spam.py used to create

Re: pyc file [Newbie Question]

2007-04-03 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 02 Apr 2007 23:44:41 -0700, Jim Aikin wrote: Working through the tutorial, I created a file called fibo.py in my text editor, and imported it into Idle. It worked as expected. I then edited the file and resaved it. I used del fibo, followed

cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread phil . aerts . tln
Hi, for one of my python projects I need an user interface similar to that of cisco IOS or even better Juniper JUNOS. Does anyone know of existing python modules that gives this kind of functionality ? -P -- http://mail.python.org/mailman/listinfo/python-list

Re: socket read timeout

2007-04-03 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] wrote: Right, but collisions are *so* twentieth-century, aren't they. With a properly-implemented switched infrastructure Ethernet interfaces can transmit and receive at the same time. This is true, while A and B are not simultaneously trying to address C -

p2p chat framework

2007-04-03 Thread Ghirai
Hello python-list, Are there any p2p chat/filetransfer frameworks/examples floating around? If not, can someone give me some rough directions towards writing my own? Thanks. -- Best regards, Ghirai. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter Modified and bindtags ordering

2007-04-03 Thread bytecolor
On Apr 3, 3:16 am, Rob Wolfe [EMAIL PROTECTED] wrote: What about instead of: t.bind('Modified', text_changed) this event: t.bind('KeyRelease', text_changed) root.mainloop() -- HTH, Rob Hey Rob, I actually started with that event, until I came across the modified event. I'm

Parsing Problems

2007-04-03 Thread saif . shakeel
Hi, I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as given below: [Services]

Re: Mastering Python (OT)

2007-04-03 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] wrote: Speaking of which, here's a limerick To read it you need to know not only that Hampshire is colloquially know as Hants, but also that Salisbury's ancient Roman name is Sarum. There once was a young man of Salisbury Whose manners were most

Re: Parsing Problems

2007-04-03 Thread Daniel Nogradi
I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as given below: [Services]

Re: Parsing Problems

2007-04-03 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], saif.shakeel wrote: I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as given

Re: Parsing Problems

2007-04-03 Thread irstas
[EMAIL PROTECTED] wrote: Hi, I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as given below:

Re: Parsing Problems

2007-04-03 Thread bytecolor
On Apr 3, 5:13 am, [EMAIL PROTECTED] wrote: Hi, I have just started learning python.I need to parse an XML file and present the contents in a particular format.The format is called as ini file.I have written some code.A section of the format needs the data to be present in format as

Re: Question about text in Python

2007-04-03 Thread Steven D'Aprano
On Tue, 03 Apr 2007 12:26:47 +1000, Ben Finney wrote: Steve [EMAIL PROTECTED] writes: Yes it is [a homework question]. Where else to ask for help but here. That's between you, your teacher, and your teaching institute's plagiarism guidelines. Plagiarism is a serious example of fraud,

Re: Tkinter Modified and bindtags ordering

2007-04-03 Thread Rob Wolfe
bytecolor wrote: Hey Rob, I actually started with that event, until I came across the modified event. I'm working on syntax highlighting. So I need any text change. Also, colorizing on a key release is annoyingly noticeable to the user. I tried it :) I'm sure there are going to be other

Re: Any consumer review generators available?

2007-04-03 Thread nullified
On Fri, 30 Mar 2007 22:15:20 +0200, Schraalhans Keukenmeester [EMAIL PROTECTED] wrote: nullified wrote: On 30 Mar 2007 07:01:16 -0700, Evil Otto [EMAIL PROTECTED] wrote: On Mar 30, 3:46 am, nullified [EMAIL PROTECTED] wrote: On 29 Mar 2007 20:34:26 -0700, Evil Otto [EMAIL PROTECTED] wrote:

Re: cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread Ben Finney
[EMAIL PROTECTED] writes: for one of my python projects I need an user interface similar to that of cisco IOS or even better Juniper JUNOS. Does anyone know of existing python modules that gives this kind of functionality? I suspect you've not checked the standard library index: Python

Re: Tkinter Modified and bindtags ordering

2007-04-03 Thread bytecolor
On Apr 3, 5:48 am, Rob Wolfe [EMAIL PROTECTED] wrote: Have you looked at ColorDelegator.py from idlelib? There has been done such a syntax highlighting based on Tkinter.Text. -- HTH, Rob I've been poking around it a bit. I actually use the tabpage module in my app. Guess I should take a

Standard Library Structure (was Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed)

2007-04-03 Thread Paul Boddie
On 2 Apr, 20:17, Kay Schluehr [EMAIL PROTECTED] wrote: Note that the conflict of putting modules on top level or better within separate packages is not an either-or decision from a programmers point of view who just wants to access those modules. A top level module like lib or std can be

Re: Numeric compiling problem under QNX 4.25

2007-04-03 Thread [EMAIL PROTECTED]
Hi, unfortunately I don't have a solution. However, if you're not forced to use Python2.2 and Numeric you should use Numpy (the successor for both, Numeric and Numarray). Numpy requires Python2.3, though. Bernhard On Apr 3, 7:32 am, ZMY [EMAIL PROTECTED] wrote: Dear all, I am a real newbie

Re: Question about text in Python

2007-04-03 Thread Ben Finney
Steven D'Aprano [EMAIL PROTECTED] writes: On Tue, 03 Apr 2007 12:26:47 +1000, Ben Finney wrote: Steve [EMAIL PROTECTED] writes: Yes it is [a homework question]. Where else to ask for help but here. That's between you, your teacher, and your teaching institute's plagiarism

XML DTD analysis, diffing ...

2007-04-03 Thread olive
Hi, I have a bunch of similar DTDs written by different coders. I would like to normalize, sort elements and attributes by name and compare those files. Do you know any XML DTD parser/normalizer written in Python ? If not, how would you perform that task in Python language ? Please, Olive.

Re: Question about text in Python

2007-04-03 Thread Bjoern Schliessmann
Steve wrote: Yes it is. Where else to ask for help but here. http://www.catb.org/~esr/faqs/smart-questions.html#homework RegardsGood luck, Björn -- BOFH excuse #247: Due to Federal Budget problems we have been forced to cut back on the number of users able to access the system at one

Re: Inserting '-' character in front of all numbers in a string

2007-04-03 Thread Jorgen Grahn
On 30 Mar 2007 08:38:27 -0700, kevinliu23 [EMAIL PROTECTED] wrote: Hey guys, I want to be able to insert a '-' character in front of all numeric values in a string. I want to insert the '-' character to use in conjunction with the getopt.getopt() function. ... 2a 3ab into -2a -3ab. Are you

Finding and copying files with python.

2007-04-03 Thread gtb
I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM, NN, and SS can be one to three digits. Example directory: other.zip dx_ver_1.1.63.zip dx_ver_1.2.01.zip

Re: python installation destination directory

2007-04-03 Thread Kushal Kumaran
On Apr 3, 9:33 am, ZMY [EMAIL PROTECTED] wrote: Hi all, I am installing python 2.2 on QNX4.25 but can't get it into /usr/local/ bin/ directory. Here is what I did: 1) untar Python-2.2 into directory /openqnx/Python-2.2/ 2) use command: CONFIG_SHELL=/usr/local/bin/bash CC=cc RANLIB=:

raw_input just continues anyway?

2007-04-03 Thread [EMAIL PROTECTED]
Hey Everyone, This is probably going to sound like a bit of a stupid question - but why does (in the following code) the script just continue to run past the raw_input, when the user hasn't entered anything? if __name__ == __main__: bucket_name = raw_input('Name of the bucket you wish

Re: XML DTD analysis, diffing ...

2007-04-03 Thread kyosohma
On Apr 3, 7:38 am, olive [EMAIL PROTECTED] wrote: Hi, I have a bunch of similar DTDs written by different coders. I would like to normalize, sort elements and attributes by name and compare those files. Do you know any XML DTD parser/normalizer written in Python ? If not, how would you

Re: Finding and copying files with python.

2007-04-03 Thread [EMAIL PROTECTED]
Just sort them and then select the bottom one from a list by using a negative indices. I.e.: list[-1] Would return the bottom result out of a list On Apr 3, 2:21 pm, gtb [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts

Re: Finding and copying files with python.

2007-04-03 Thread kyosohma
On Apr 3, 8:21 am, gtb [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM, NN, and SS can be one to three digits. Example directory:

Re: raw_input just continues anyway?

2007-04-03 Thread kyosohma
On Apr 3, 8:27 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey Everyone, This is probably going to sound like a bit of a stupid question - but why does (in the following code) the script just continue to run past the raw_input, when the user hasn't entered anything? if __name__ ==

Re: print the screen shot in python

2007-04-03 Thread kyosohma
On Apr 2, 4:24 pm, gslm [EMAIL PROTECTED] wrote: Hi! I want to print an application view in python.I use labels and frames in my program.And ý want to know if it is possible to print all of the view of my program? Thanks a lot... You need to give us more details. Are you using wxPython,

Re: Finding and copying files with python.

2007-04-03 Thread gtb
On Apr 3, 8:31 am, [EMAIL PROTECTED] wrote: On Apr 3, 8:21 am, gtb [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM, NN, and

Re: raw_input just continues anyway?

2007-04-03 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: if __name__ == __main__: bucket_name = raw_input('Name of the bucket you wish the files to be placed into? ') update_s3() Basically, it just asks the question and continues anyway? It reads stdin until a line break. Then it continues. Exactly what

Re: XML DTD analysis, diffing ...

2007-04-03 Thread olive
Mike, I know all of these tools and I already suspected xmlproc as a good candidate. The problem is I can't download it for the moment since Lars website is blocked here at my work and PyXML is dead. Maybe there is an alternative download link ? Thank you for the Cookbook recipe anyway.

Re: XML DTD analysis, diffing ...

2007-04-03 Thread Paul Boddie
On 3 Apr, 15:52, olive [EMAIL PROTECTED] wrote: I know all of these tools and I already suspected xmlproc as a good candidate. The problem is I can't download it for the moment since Lars website is blocked here at my work and PyXML is dead. Maybe there is an alternative download link ?

Re: XML DTD analysis, diffing ...

2007-04-03 Thread kyosohma
On Apr 3, 8:52 am, olive [EMAIL PROTECTED] wrote: Mike, I know all of these tools and I already suspected xmlproc as a good candidate. The problem is I can't download it for the moment since Lars website is blocked here at my work and PyXML is dead. Maybe there is an alternative download

Re: Finding and copying files with python.

2007-04-03 Thread kyosohma
On Apr 3, 8:47 am, gtb [EMAIL PROTECTED] wrote: On Apr 3, 8:31 am, [EMAIL PROTECTED] wrote: On Apr 3, 8:21 am, gtb [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the

Re: Finding and copying files with python.

2007-04-03 Thread Steve Holden
gtb wrote: On Apr 3, 8:31 am, [EMAIL PROTECTED] wrote: On Apr 3, 8:21 am, gtb [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM,

Re: XML DTD analysis, diffing ...

2007-04-03 Thread olive
Thanks Paul and Mike, I've found the good link and just downloaded pyXML. Olive. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding and copying files with python.

2007-04-03 Thread Daniele Varrazzo
I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM, NN, and SS can be one to three digits. Example directory: other.zip dx_ver_1.1.63.zip

numpy performance and list comprehension

2007-04-03 Thread TG
Hi there. Reading the page on python performance ( http://scipy.org/PerformancePython ) made me realize that I can achieve tremendous code acceleration with numpy just by using u[:,:] kind of syntax the clever way. Here is a little problem (Oja's rule of synaptic plasticity) * W is a matrix

Problem installing Python 2.5

2007-04-03 Thread Sebastian Bassi
I was trying to install Python 2.5 compiling from sources. I used: ./compile It run OK. Then: make altintall After a lot of output, got this: Listing /usr/local/lib/python2.5/xml/sax ... Compiling /usr/local/lib/python2.5/xml/sax/__init__.py ... Compiling

Problem with filter()

2007-04-03 Thread Boudreau, Emile
Hey all, So I'm trying to filter a list with the built-in function filter(). My list looks something like this: ['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep', 'rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz'] Calling filter like this: compFiles =

Re: raw_input just continues anyway?

2007-04-03 Thread [EMAIL PROTECTED]
Hi There, Here's the full code, if it helps: Takes a list of filenames via standard input and uploads them to Amazon S3. Requires S3.py: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134categoryID=47 Usage: cd /directory/with/media/files/ find |

Re: Finding and copying files with python.

2007-04-03 Thread gtb
On Apr 3, 9:42 am, Daniele Varrazzo [EMAIL PROTECTED] wrote: I wish to copy the highest version number of a file from directory \ \ \fileserver\D:\scripts to C:\scripts where the file names are of the form filename_MM.NN.SS.zip, where MM, NN, and SS can be one to three

RE: Problem with filter()

2007-04-03 Thread Boudreau, Emile
Sorry folks my mistake def is_dev should be: def is_Dev(stringy): stringx = stringy.split('-') if stringx[0] == '': if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 But now the results of the filter is an empty list and

Re: numpy performance and list comprehension

2007-04-03 Thread irstas
On Apr 3, 5:42 pm, TG [EMAIL PROTECTED] wrote: Hi there. Reading the page on python performance (http://scipy.org/PerformancePython ) made me realize that I can achieve tremendous code acceleration with numpy just by using u[:,:] kind of syntax the clever way. Here is a little problem

Re: XML DTD analysis, diffing ...

2007-04-03 Thread Stéphane Muller
olive a écrit : Hi, I have a bunch of similar DTDs written by different coders. I would like to normalize, sort elements and attributes by name and compare those files. Do you know any XML DTD parser/normalizer written in Python ? Yes, you can try

Re: Problem installing Python 2.5

2007-04-03 Thread Jaroslaw Zabiello
Dnia Tue, 3 Apr 2007 11:52:55 -0300, Sebastian Bassi napisał(a): I was trying to install Python 2.5 compiling from sources. I used: ./compile It run OK. Then: make altintall After a lot of output, got this: Listing /usr/local/lib/python2.5/xml/sax ... Compiling

low level networking in python

2007-04-03 Thread Maxim Veksler
Hello, I wish to do some low level network stuff using python. I've googled somewhat and came up with pylibpcap[1], trouble is I can't compile it on my Ubuntu 6.10 workstation. Can someone please suggest a way to read some bits from random ports? I'm looking to write a simple pen-testing tool

Re: Problem with filter()

2007-04-03 Thread Jerry Hill
On 4/3/07, Boudreau, Emile [EMAIL PROTECTED] wrote: Sorry folks my mistake def is_dev should be: def is_Dev(stringy): stringx = stringy.split('-') if stringx[0] == '': if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return

Re: XML/encoding/prolog/python hell...

2007-04-03 Thread fscked
Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: pyc file [Newbie Question]

2007-04-03 Thread Jim Aikin
Thanks, Steven. I'm sure that answers the question. The Tutorial is very good, but there are numerous topics that it slides past (as it would have to do, in order to avoid being ten times as long). I haven't yet gotten deep enough into Python to even know where to look for a full explanation

Re: low level networking in python

2007-04-03 Thread kyosohma
On Apr 3, 10:29 am, Maxim Veksler [EMAIL PROTECTED] wrote: Hello, I wish to do some low level network stuff using python. I've googled somewhat and came up with pylibpcap[1], trouble is I can't compile it on my Ubuntu 6.10 workstation. Can someone please suggest a way to read some bits from

Re: raw_input just continues anyway?

2007-04-03 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: if __name__ == __main__: bucket_name = raw_input('Name of the bucket you wish the files to be placed into? ') update_s3() Basically I pipe some files into the script - so would this cause a linebreak? Yes of course.

Re: Problem installing Python 2.5

2007-04-03 Thread Sebastian Bassi
On 4/3/07, Jaroslaw Zabiello [EMAIL PROTECTED] wrote: After executing ./configure you have to edito Modules/Setup file and uncomment the following line: #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz Then continue with normal make; make install. Thank you. I already

Re: getattr/setattr q.

2007-04-03 Thread Paulo da Silva
7stud escreveu: On Apr 2, 10:08 pm, Paulo da Silva [EMAIL PROTECTED] wrote: Is it possible to use getattr/setattr for variables not inside classes...? What does the python documentation say about the definition of setattr()? I didn't read the full python documentation, yet! I hope to

Re: getattr/setattr q.

2007-04-03 Thread Paulo da Silva
Steven Bethard escreveu: Paulo da Silva wrote: ... If you're at the module level, you can do:: globals()['x'] = 10 If you're inside a function, you probably want to look for another way of doing what you're doing. What's the actual task you're trying to accomplish here? None. I

Re: low level networking in python

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: On Apr 3, 10:29 am, Maxim Veksler [EMAIL PROTECTED] wrote: Hello, I wish to do some low level network stuff using python. I've googled somewhat and came up with pylibpcap[1], trouble is I can't compile it on my Ubuntu 6.10 workstation. Can someone please suggest a

Stack experiment

2007-04-03 Thread tom
Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self):

Python at Google

2007-04-03 Thread olsongt
Here's an article about python at google. Apologies in advance. http://valleywag.com/tech/google/missing-python-tracked-down-249208.php -- http://mail.python.org/mailman/listinfo/python-list

Re: getattr/setattr q.

2007-04-03 Thread Steve Holden
Paulo da Silva wrote: Steven Bethard escreveu: Paulo da Silva wrote: ... If you're at the module level, you can do:: globals()['x'] = 10 If you're inside a function, you probably want to look for another way of doing what you're doing. What's the actual task you're trying to

Re: Stack experiment

2007-04-03 Thread irstas
[EMAIL PROTECTED] wrote: Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item):

Re: Stack experiment

2007-04-03 Thread kyosohma
On Apr 3, 10:57 am, [EMAIL PROTECTED] wrote: Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item):

How to have a list of lists (or array of lists)

2007-04-03 Thread bahoo
Hi, I want to have many lists, such as list0, list1, list2, ..., each one holding different number of items. Is there something like list[0] list[1] list[2] so that I can iterate through this list of lists? Thanks! bahoo -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack experiment

2007-04-03 Thread Richard Brodie
[EMAIL PROTECTED] wrote in message There may be something wrong with the re code in your example, but I don't know enough about that to help in that area. There is a stray leading space in it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack experiment

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item):

Re: How to have a list of lists (or array of lists)

2007-04-03 Thread irstas
On Apr 3, 7:12 pm, bahoo [EMAIL PROTECTED] wrote: Hi, I want to have many lists, such as list0, list1, list2, ..., each one holding different number of items. Is there something like list[0] list[1] list[2] so that I can iterate through this list of lists? Thanks! bahoo listOfLists =

Re: Stack experiment

2007-04-03 Thread irstas
On Apr 3, 7:14 pm, Richard Brodie [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote in message There may be something wrong with the re code in your example, but I don't know enough about that to help in that area. There is a stray leading space in it. Nah, I'd say there's a stray ([^0-9])

Re: Stack experiment

2007-04-03 Thread Matimus
On Apr 3, 8:57 am, [EMAIL PROTECTED] wrote: Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item):

Problem with filter()

2007-04-03 Thread Birone Lynch
Sorry folks my mistake def is_dev should be: def is_Dev(stringy): stringx = stringy.split('-') if stringx[0] == '': if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 But now the results of the filter is an empty list

Retrieve an item from a dictionary using an arbitrary object as the key

2007-04-03 Thread abcd
Hi, I have a class such as, class Type: def __init__(self, val): self.val = val class Person: def __init__(self, name, age): self.name = name self.age = age So I have a dictionary which maps an instance of Type to an instance of Person. Now I need to

Re: Stack experiment

2007-04-03 Thread Richard Brodie
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] There is a stray leading space in it. Nah, I'd say there's a stray ([^0-9]) after the space. If you regard the spaces as being a required part of the postfix grammar, it would be simpler. But who would design a language where white

Re: Stack experiment

2007-04-03 Thread Terry Reedy
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Hi! Im new to Python and doing exercise found from internet. It is | supposed to evaluate expression given with postfix operator using | Stack() class. | | class Stack: | def __init__(self): | self.items = [] | | def

Re: Retrieve an item from a dictionary using an arbitrary object as the key

2007-04-03 Thread irstas
On Apr 3, 7:26 pm, abcd [EMAIL PROTECTED] wrote: Hi, I have a class such as, class Type: def __init__(self, val): self.val = val class Person: def __init__(self, name, age): self.name = name self.age = age So I have a dictionary which maps an

Re: getattr/setattr q.

2007-04-03 Thread Steven Bethard
Steve Holden wrote: You don't need setattr/getattr if you know in advance the name of the attribute you need to access and you can get a reference to the object whose attribute it is. So: x = Hello, Paulo import sys sys.modules['__main__'].x 'Hello, Paulo' a.k.a import

Re: getattr/setattr q.

2007-04-03 Thread Steve Holden
Steven Bethard wrote: Steve Holden wrote: You don't need setattr/getattr if you know in advance the name of the attribute you need to access and you can get a reference to the object whose attribute it is. So: x = Hello, Paulo import sys sys.modules['__main__'].x 'Hello, Paulo'

Re: Stack experiment

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] Steve, How do you do tokenList = split(expr)? There is no builtin called split. Mike Sorry, that should have been a call to the .split() method of expr, i.e.: tokenList = expr.split() regards Steve -- Steve Holden +44 150 684 7255 +1 800 494

Re: Numeric compiling problem under QNX 4.25

2007-04-03 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hi, unfortunately I don't have a solution. However, if you're not forced to use Python2.2 and Numeric you should use Numpy (the successor for both, Numeric and Numarray). Numpy requires Python2.3, though. He's already asked about numpy. He is stuck with 2.2. --

How can I kill a running thread when exiting from __main__

2007-04-03 Thread care02
Hi! I have the following problem: I have written a short Python server that creates an indefinite simulation thread that I want to kill when quitting (Ctrl-C) from Python. Googling around has not given me any hints on how to cleanly kill running threads before exiting. Any help is appreciated!

Extracting a file from a tarball

2007-04-03 Thread Boudreau, Emile
I am trying to extract one file from a tarball, without success. This is the code I'm using to open the tarball and extract the file: tar = tarfile.open(component+'-win32-app-'+bestVersion+'-dev.tar.gz', 'r') extractedFile = tar.extractfile('symbols.xml') And this is my error: Traceback (most

Re: numpy performance and list comprehension

2007-04-03 Thread Robert Kern
TG wrote: Hi there. Reading the page on python performance ( http://scipy.org/PerformancePython ) made me realize that I can achieve tremendous code acceleration with numpy just by using u[:,:] kind of syntax the clever way. Here is a little problem (Oja's rule of synaptic plasticity)

Re: How can I kill a running thread when exiting from __main__

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hi! I have the following problem: I have written a short Python server that creates an indefinite simulation thread that I want to kill when quitting (Ctrl-C) from Python. Googling around has not given me any hints on how to cleanly kill running threads before

Re: How can I kill a running thread when exiting from __main__

2007-04-03 Thread kyosohma
On Apr 3, 12:21 pm, [EMAIL PROTECTED] wrote: Hi! I have the following problem: I have written a short Python server that creates an indefinite simulation thread that I want to kill when quitting (Ctrl-C) from Python. Googling around has not given me any hints on how to cleanly kill running

Re: XML DTD analysis, diffing ...

2007-04-03 Thread olive
Thank you Stephane, it is almost what I want. I'm going to improve it a little and then provide the code back. Where is the best place ? Olive. -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieve an item from a dictionary using an arbitrary object as the key

2007-04-03 Thread abcd
You'll need __eq__ for testing if two objects are equivalent, and __hash__ for calculating object's hash value. class Type: def __init__(self, val): self.val = val def __eq__(self, other): return self.val == other.val def __hash__(self): return

Re: Stack experiment

2007-04-03 Thread kyosohma
On Apr 3, 11:17 am, Steve Holden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self):

Re: Extracting a file from a tarball

2007-04-03 Thread Carsten Haese
On Tue, 2007-04-03 at 13:26 -0400, Boudreau, Emile wrote: I am trying to extract one file from a tarball, without success. This is the code I'm using to open the tarball and extract the file: tar = tarfile.open(component+'-win32-app-'+bestVersion+'-dev.tar.gz', 'r') extractedFile =

Re: Numeric compiling problem under QNX 4.25

2007-04-03 Thread Robert Kern
ZMY wrote: Dear all, I am a real newbie for both python and QNX, but I am still trying to compile Numeric-24.2 under QNX4.25 with python 2.2. I got following error message: $ sudo python setup.py install Password: running install ... building '_numpy' extension skipping

  1   2   3   >