Re: Standard Forth versus Python: a case study

2006-10-12 Thread Fredrik Lundh
Gabriel Genellina wrote: > At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote: > >> > > > fun median { >> > > > var x = 0. >> > > > while( *p++) { >> > > > if( (*p) > x) x = *p. >> > > > } >> > > > return x. >> > > > } >> >> clearly, i've forgotten the definition of the median of a

Re: always raise syntax error!

2006-10-12 Thread Steven D'Aprano
On Thu, 12 Oct 2006 23:25:58 -0700, daniel wrote: > I'm not quite new to this language, but such error has never happened > so frequently before. I have no idea what to do about it, because > there's actually no syntax error at all !! Looking into my crystal ball, I see that you are correct, ther

Re: Starting out.

2006-10-12 Thread [EMAIL PROTECTED]
Richard Jones wrote: > Tim Chase wrote: > > typed with just the top-row of keys > > '^[qwertyuiop]*$' > > The longest being "typewriter" :) Maybe you should say "amongst the longest" pepperwort perpetuity perruquier pirouetter proprietor repertoire typewriter But even that would be wrong. rupt

always raise syntax error!

2006-10-12 Thread daniel
I'm not quite new to this language, but such error has never happened so frequently before. I have no idea what to do about it, because there's actually no syntax error at all !! I'm using python 2.4.3 on windows, with gvim.. I realize this might because of the tab and space, so I use listchars in

Re: COM and Threads

2006-10-12 Thread Teja
Roger Upole wrote: > "Teja" <[EMAIL PROTECTED]> wrote: > > > > Roger Upole wrote: > > > >> "Teja" <[EMAIL PROTECTED]> wrote: > >> >I have an application which uses COM 's Dispatch to create a COM based > >> > object. Now I need to upgrade the application to a threaded one. But > >> > its giving a

Re: COM and Threads

2006-10-12 Thread Roger Upole
"Teja" <[EMAIL PROTECTED]> wrote: > > Roger Upole wrote: > >> "Teja" <[EMAIL PROTECTED]> wrote: >> >I have an application which uses COM 's Dispatch to create a COM based >> > object. Now I need to upgrade the application to a threaded one. But >> > its giving an error that COM and threads wont go

Re: Where is Python in the scheme of things?

2006-10-12 Thread Stephan Kuhagen
Magnus Lycka wrote: ... > I'd suggest that the OP look at the Wikipedia page in Unix > Philosophy. Read about Gancarz tenets, and replace shell scripts > with Python. (Of course, Python offers more elaborate communication > than pipes.) I'd also the link to Joel Spolsky's Biculturalism > article,

Re: Starting out.

2006-10-12 Thread malkarouri
Ahmer wrote: > Hi all! > > I am a 15 year old High School Sophomore. I would like to start > programming in Python. In school, we are learning Java (5) and I like > to use the Eclipse IDE, I also am learning PHP as well. > > What are some ways to get started (books, sites, etc.)? I am usually on >

Re: Starting out.

2006-10-12 Thread Paddy
Ahmer wrote: > Hi all! > > I am a 15 year old High School Sophomore. I would like to start > programming in Python. In school, we are learning Java (5) and I like > to use the Eclipse IDE, I also am learning PHP as well. > > What are some ways to get started (books, sites, etc.)? I am usually on >

Python Newbie question

2006-10-12 Thread insideview
Is it possible to combine or bundle separate .exe files into the compiled python .exe when using py2exe? If possible, how would that be described within setup.py . and how/where would I specify such .exe should be ran first in the pre-compiled scripts? My goal is to get the total package down t

Re: COM and Threads

2006-10-12 Thread Teja
hg wrote: > Teja wrote: > > hg wrote: > > > >> Teja wrote: > >>> I have an application which uses COM 's Dispatch to create a COM based > >>> object. Now I need to upgrade the application to a threaded one. But > >>> its giving an error that COM and threads wont go together. Specifically > >>> it

Re: COM and Threads

2006-10-12 Thread Teja
Roger Upole wrote: > "Teja" <[EMAIL PROTECTED]> wrote: > >I have an application which uses COM 's Dispatch to create a COM based > > object. Now I need to upgrade the application to a threaded one. But > > its giving an error that COM and threads wont go together. Specifically > > its an attribut

Re: COM and Threads

2006-10-12 Thread hg
Teja wrote: > hg wrote: > >> Teja wrote: >>> I have an application which uses COM 's Dispatch to create a COM based >>> object. Now I need to upgrade the application to a threaded one. But >>> its giving an error that COM and threads wont go together. Specifically >>> its an attribute error at the

What is python(abi)?

2006-10-12 Thread Mandy.Lialie
Hi, I have searched for quite a long time, but still can't get it. When I install YUM or others, it embarrasses me. That says python(abi) = 2.4 is need. Previous I install python 2.4, then install 2.5 to have a try. Both work well. And build wxPython successfully with 2.5. OS: FC5 Any help? Thank

Re: Sending binary pickled data through TCP

2006-10-12 Thread Paul Rubin
David Hirschfield <[EMAIL PROTECTED]> writes: > Is there a reliable way to determine the byte count of some pickled > binary data? Can I rely on len() == bytes? Huh? Yes, of course len gives you the length. As for the network representation, DJB proposes this format: http://cr.yp.to/proto/netstr

Re: COM and Threads

2006-10-12 Thread Roger Upole
"Teja" <[EMAIL PROTECTED]> wrote: >I have an application which uses COM 's Dispatch to create a COM based > object. Now I need to upgrade the application to a threaded one. But > its giving an error that COM and threads wont go together. Specifically > its an attribute error at the point where COM

Professional Grant Proposal Writing Workshop (University of Washington, Seattle - December 2006)

2006-10-12 Thread Anthony Jones
Title: Email Template The Grant Institute: Certificate in Professional Program Development and Grant Communication will be held at the University of Washington, Seattle, December 4 - 8, 2006. Interested development professionals, researchers, faculty, and graduate students should register as soo

Re: COM and Threads

2006-10-12 Thread Teja
hg wrote: > Teja wrote: > > I have an application which uses COM 's Dispatch to create a COM based > > object. Now I need to upgrade the application to a threaded one. But > > its giving an error that COM and threads wont go together. Specifically > > its an attribute error at the point where COM

Re: Starting out.

2006-10-12 Thread Richard Jones
Tim Chase wrote: > typed with just the top-row of keys > '^[qwertyuiop]*$' The longest being "typewriter" :) hey, look, it's Friday -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending binary pickled data through TCP

2006-10-12 Thread Steve Holden
David Hirschfield wrote: > I have a pair of programs which trade python data back and forth by > pickling up lists of objects on one side (using > pickle.HIGHEST_PROTOCOL), and sending that data over a TCP socket > connection to the receiver, who unpickles the data and uses it. > > So far this

Re: python 2.5 & sqlite3

2006-10-12 Thread Steve Holden
Trent Mick wrote: >>if it doesn't, it wouldn't be the first time they'd (by accident or on >>purpose) left things out. > > > Other than SSL, do you have examples? > > > trust me, it'd cause a lot less confusion if > >>ActivePython was a true superset of the python.org distribution. > > >

Re: Python component model

2006-10-12 Thread Steve Holden
Paul Boddie wrote: > I'm not at the cutting edge here: 20j and 20k are the commands (replace > 20 with another suitable amount) which help me jump around in my editor > of choice. The other commands which may be more effective just aren't > in my "working set". > You *might* find CTRL/U and CTRL/

Re: Starting out.

2006-10-12 Thread Tim Chase
> (OT: Try to type 'proficient' with one hand on a US keyboard. :-)) A number of nice words like that: authenticity proficiency entitlement enchantment protozoans proficient antisocial tutorials tormentor shanghais shamrocks rhapsodic protozoan pantheism handiwork flamencos fishbowls firmament en

Re: COM and Threads

2006-10-12 Thread hg
Teja wrote: > I have an application which uses COM 's Dispatch to create a COM based > object. Now I need to upgrade the application to a threaded one. But > its giving an error that COM and threads wont go together. Specifically > its an attribute error at the point where COM object is invoked. An

Sending binary pickled data through TCP

2006-10-12 Thread David Hirschfield
I have a pair of programs which trade python data back and forth by pickling up lists of objects on one side (using pickle.HIGHEST_PROTOCOL), and sending that data over a TCP socket connection to the receiver, who unpickles the data and uses it. So far this has been working fine, but I now need

COM and Threads

2006-10-12 Thread Teja
I have an application which uses COM 's Dispatch to create a COM based object. Now I need to upgrade the application to a threaded one. But its giving an error that COM and threads wont go together. Specifically its an attribute error at the point where COM object is invoked. Any pointers please???

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
At Thursday 12/10/2006 21:54, Paul Rubin wrote: Gabriel Genellina <[EMAIL PROTECTED]> writes: > That explains all. Finding the median in an efficient way (that is, > without sorting the data first) isn't trivial, so your claim of "I can > do that using only one temp variable" was a bit surprisin

Re: Starting out.

2006-10-12 Thread hg
Ahmer wrote: > Hi all! > > I am a 15 year old High School Sophomore. I would like to start > programming in Python. In school, we are learning Java (5) and I like > to use the Eclipse IDE, I also am learning PHP as well. > > What are some ways to get started (books, sites, etc.)? I am usually on

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Paul Rubin
Gabriel Genellina <[EMAIL PROTECTED]> writes: > That explains all. Finding the median in an efficient way (that is, > without sorting the data first) isn't trivial, so your claim of "I can > do that using only one temp variable" was a bit surprising... > BTW, the median is the value which sits just

Re: Appropriate way to quit Tkinter

2006-10-12 Thread mzdude
Fredrik Lundh wrote: [snip] > works for me. are you perhaps running this under some kind of IDE that > keeps the process running even after the program has terminated? > It works the same way if I run from IDLE or from the DOS command prompt. -- http://mail.python.org/mailman/listinfo/python-li

Re: Python component model

2006-10-12 Thread Peter Wang
Ilias Lazaridis wrote: > looks interesting. Thanks! > what about persistency? Um... what about it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Gabriel Genellina
At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote: > > > fun median { > > > var x = 0. > > > while( *p++) { > > > if( (*p) > x) x = *p. > > > } > > > return x. > > > } clearly, i've forgotten the definition of the median of a list. to that i plead faulty memory. That explains a

Re: Starting out.

2006-10-12 Thread Richard Jones
Andrew Poelstra wrote: > (OT: Try to type 'proficient' with one hand on a US keyboard. :-)) On the Internet, nobody wants to know when you're typing one-handed. Richard -- http://mail.python.org/mailman/listinfo/python-list

RE: php and python: how to unpickle using PHP?

2006-10-12 Thread Ted Zeng
Thanks for everyone who replied my question. I could not access to the messages from this list Until today. I will look up the solutions you guys suggested. Ted zeng -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Arnold Sent: Tuesday, October 03, 20

Re: Starting out.

2006-10-12 Thread Andrew Poelstra
On Thu, 2006-10-12 at 16:37 -0700, Ahmer wrote: > Hi all! > > I am a 15 year old High School Sophomore. I would like to start > programming in Python. In school, we are learning Java (5) and I like > to use the Eclipse IDE, I also am learning PHP as well. > > What are some ways to get started (bo

Re: Python component model

2006-10-12 Thread Peter Wang
Edward, This isn't in response to any specific one of the 100+ posts on this thread, but I justed wanted to encourage you to continue your investigation into Python component models and maybe looking for some common ground between them. Frequently the individual developers are too heads-down on w

Starting out.

2006-10-12 Thread Ahmer
Hi all! I am a 15 year old High School Sophomore. I would like to start programming in Python. In school, we are learning Java (5) and I like to use the Eclipse IDE, I also am learning PHP as well. What are some ways to get started (books, sites, etc.)? I am usually on linux, but I have a windows

Re: 3D Vector Type Line-Drawing Program

2006-10-12 Thread Scott David Daniels
Ron Adam wrote: > Scott David Daniels wrote: >> Ron Adam wrote: >>> ... Is there a way to have the display show a wire frame image instead of >>> shaded shapes? >> You can draw the edges as lines. > > Is there a setting for this?, or are you suggesting reading the > coordinates and creating curv

Re: numpy slice: create view, not copy

2006-10-12 Thread Travis Oliphant
K. Jansma wrote: > Hi, > > given an array: > > import numpy > a = numpy.arange(100).reshape((10,10)) > print a > > [[ 0 1 2 3 4 5 6 7 8 9] > [10 11 12 13 14 15 16 17 18 19] > [20 21 22 23 24 25 26 27 28 29] > [30 31 32 33 34 35 36 37 38 39] > [40 41 42 43 44 45 46 47 48 49] > [50 5

Re: is there an easy way to create a database on the fly and let the user input values

2006-10-12 Thread [EMAIL PROTECTED]
Chris Lambacher wrote: > I've heard good things about Dabo: http://dabodev.com/ > On Wed, Oct 11, 2006 at 09:44:37PM -0700, [EMAIL PROTECTED] wrote: > > I don't realy care what database I use wx.grid or whatever. I > > wan't it to look at a line > > > > 128 9023 23428 exc and create the data

Re: Python component model

2006-10-12 Thread Peter Wang
Edward Diener wrote: > It looks as if traits is an attempt to create a "property" in the > component terminology which I originally specified. I will take a look > at it. Traits is frighteningly similar to the requirements that you laid out in your post (the example for Skip), including delegates!

Re: Insert characters into string based on re ?

2006-10-12 Thread John Machin
Matt wrote: > I am attempting to reformat a string, inserting newlines before certain > phrases. For example, in formatting SQL, I want to start a new line at > each JOIN condition. Noting that strings are immutable, I thought it > best to spllit the string at the key points, then join with '\n'.

Installing Python 2.3.5 - get "need administrator access" to install error.....

2006-10-12 Thread insideview
Hi there - when attempting to install Python 2.3.5, I receive the following message -- "You do not have access to make the required system configuration modifications." Please rerun this installation from an administrators account. I am running Windows XP in administrator mode, and have installed v

Re: 3D Vector Type Line-Drawing Program

2006-10-12 Thread Ron Adam
Scott David Daniels wrote: > Ron Adam wrote: >> Scott David Daniels wrote: >>> James Stroud wrote: > I'm looking for a program to do line-drawings in 3d, with output to > postscript or svg or pdf, etc. I would like to describe a scene > with certain 1-3d elements oriented in 3d space

Insert characters into string based on re ?

2006-10-12 Thread Matt
I am attempting to reformat a string, inserting newlines before certain phrases. For example, in formatting SQL, I want to start a new line at each JOIN condition. Noting that strings are immutable, I thought it best to spllit the string at the key points, then join with '\n'. Regexps can seem the

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Gerard Flanagan
RickMuller wrote: > One of my all-time favorite scripts is parseline, which is printed > below > > def parseline(line,format): > xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} > result = [] > words = line.split() > for i in range(len(format)): > f = format[i] >

SOAPpy and callback

2006-10-12 Thread fabien . benard
Hello, I'm trying to find how to use a callback in a SOAP client using SOAPpy. Does SOAPpy have to manage it, or does Python include some API to do it? Thanks a lot. Fabien -- http://mail.python.org/mailman/listinfo/python-list

Re: Enthought python - Traits

2006-10-12 Thread Peter Wang
Ash wrote: > Hello everyone ! > > I am trying to find some sort of a cookbook or more examples for using > Enthought Traits to build GUI's. I tried to follow the documentations > present at the enthought site, but couldnt get too far - especially on > how to handle a control event ? The traits man

Re: Python component model

2006-10-12 Thread Paul Boddie
Ed Jensen wrote: > Paul Boddie <[EMAIL PROTECTED]> wrote: > > People who bring up stuff about self and indentation are just showing > > their ignorance > > Ouch. That stings. > > Python's "indentation determines scope" makes it hard for me to discuss > Python via mediums like IRC and instant messe

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Fredrik Lundh
RickMuller wrote: > I'm posting this here because (1) I'm feeling smug at what a bright > little coder I am if you want to show off, and use a more pythonic interface, you can do it with a lot fewer lines. here's one example: def parseline(line, *types): result = [c(x) for (x, c) in zip(l

Re: Python component model

2006-10-12 Thread Ed Jensen
Paul Boddie <[EMAIL PROTECTED]> wrote: > People who bring up stuff about self and indentation are just showing > their ignorance Ouch. That stings. Python's "indentation determines scope" makes it hard for me to discuss Python via mediums like IRC and instant messengers. It also makes it hard t

Re: python 2.5 & sqlite3

2006-10-12 Thread Trent Mick
> if it doesn't, it wouldn't be the first time they'd (by accident or on > purpose) left things out. Other than SSL, do you have examples? > trust me, it'd cause a lot less confusion if > ActivePython was a true superset of the python.org distribution. For every extension except SSL support

Re: Is a list static when it's a class member?

2006-10-12 Thread Fredrik Lundh
Tom Plunket wrote: > Obviously, as is "sticking a gun in your mouth is perfectly fine, as > long as you understand that pulling the trigger will yield a large > hole in the back of your skull." in my experience, the "you're not old enough to understand this" approach to teaching usually means th

Re: IDLE won't run

2006-10-12 Thread Rob
hg <[EMAIL PROTECTED]> banged out in news:[EMAIL PROTECTED]: > > What kind of error do you see by calling idle from the command line > (ex: > "c:\\python.exe c:\\idle.py" > When I ran it that way, I got a raft of warnings about a "problem retrieving theme element 'builtin-forground'"

Guppy-PE 0.1.5 released

2006-10-12 Thread Sverker Nilsson
I would like to announce Guppy-PE 0.1.5 Guppy-PE is a library and programming environment for Python, currently providing in particular the Heapy subsystem, which supports object and heap memory sizing, profiling and debugging. It also includes a prototypical specification language, the Guppy Spec

Re: Standard Forth versus Python: a case study

2006-10-12 Thread [EMAIL PROTECTED]
Paul Rubin wrote: > Paul Rubin writes: > > > fun median { > > > var x = 0. > > > while( *p++) { > > > if( (*p) > x) x = *p. > > > } > > > return x. > > > } > > > > I count two variables, p and x. > > Also, that finds the maximum, not the median. I had stopped

Re: Appropriate way to quit Tkinter

2006-10-12 Thread Fredrik Lundh
mzdude wrote: > I've just started playing with Python. Installed 2.5 on Windows XP > system. I'm working through some of the examples in Programming Python > 3ed by Mark Lutz. Given the following example when the Quit All button > action is assigned to root.quit the windows aren't dismissed or > d

Re: IDLE won't run

2006-10-12 Thread Scott David Daniels
Rob wrote: > I have Python 2.4.3 installed on Windows XP on both a real computer and a > virtual machine under VMware. Just recently, IDLE stopped working. I would > select IDLE from the start menu or right click on a .PY file and open it in > IDLE, but nothing happens. I just uninstalled Python

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Tim Chase wrote: > Sounded like the OP wanted a behavior similar to "auto-globals" > that has been a long-cursed aspect of PHP. That, without > specifying it, local-variables should be global if their name > exists in the global namespace. Sounds like a source of many hard to track down bugs.

ANN: BayPIGgies, Oct 12, 7:30pm, Google, Mtn View

2006-10-12 Thread wesley chun
Final REMINDER: Tonight, the Silicon Valley/San Francisco Bay Area Python users group meets at Google in Mountain View from 7:30-9p. the featured speaker is Alex Martelli, author of O'Reilly's Python in a Nutshell and editor of the Python Cookbook(s). the topic is Python 2.5. for more info and

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread RickMuller
Wow! 6 responses in just a few minutes. Thanks for all of the great feedback! [EMAIL PROTECTED] wrote: > Rick> def parseline(line,format): > Rick> xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} > Rick> result = [] > Rick> words = line.split() > Rick> for i in

ConfigParser: whitespace leading comment lines

2006-10-12 Thread [EMAIL PROTECTED]
Hello all, I'd like to propose the following change to ConfigParser.py. I won't call it a bug-fix because I don't know the relevant standards. This change will enable multiline comments as follows: [section] item=value ;first of multiline comment ;second of multiline comment Right n

Re: prefix search on a large file

2006-10-12 Thread Scott David Daniels
Tim Chase wrote: >> def leaders(sorted_list): >> held = None >> for phrase in held: > ... I suspect you mean > for phrase in sorted_list: > no? Ooops -- renaming code before posting should get its own test. You are absolutely correct. --Scott David Daniels [EMAIL PROTE

Re: SECURITY ADVISORY [PSF-2006-001] Buffer overrun in repr() for UCS-4 encoded unicode strings

2006-10-12 Thread Anthony Baxter
On Thursday 12 October 2006 17:31, Anthony Baxter wrote: >SECURITY ADVISORY [PSF-2006-001] > Buffer overrun in repr() for UCS-4 encoded unicode strings > > http://www.python.org/news/security/PSF-2006-001/ As a few people noted in email to me - the patch directory was not _quite_

Re: strings in the global section

2006-10-12 Thread Tim Chase
>> Works, but something different ? > > Excuse me, what do you mean? Sounded like the OP wanted a behavior similar to "auto-globals" that has been a long-cursed aspect of PHP. That, without specifying it, local-variables should be global if their name exists in the global namespace. Python s

Re: IDLE won't run

2006-10-12 Thread hg
Rob wrote: > I have Python 2.4.3 installed on Windows XP on both a real computer and a > virtual machine under VMware. Just recently, IDLE stopped working. I would > select IDLE from the start menu or right click on a .PY file and open it in > IDLE, but nothing happens. I just uninstalled Python

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread skip
Rick> def parseline(line,format): Rick> xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} Rick> result = [] Rick> words = line.split() Rick> for i in range(len(format)): Rick> f = format[i] Rick> trans = xlat.get(f,'None') Rick>

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Neil Cerutti
On 2006-10-12, Pierre Quentel <[EMAIL PROTECTED]> wrote: >> >>> parseline( 'A 1 22 3 6', 'sdxf') >> ['A', 1, None, 3.0] > > Yes, but in this case the OP expects to get ['A',1,3.0] > > A shorter version : > > def parseline(line,format): > xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} >

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
> >>> parseline( 'A 1 22 3 6', 'sdxf') > ['A', 1, None, 3.0] Yes, but in this case the OP expects to get ['A',1,3.0] A shorter version : def parseline(line,format): xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} result = [ xlat[f](w) for f,w in zip(format,line.split()) if xl

Re: Standard Forth versus Python: a case study

2006-10-12 Thread John Doty
Juho Schultz wrote: > John Doty wrote: > >> The problem: >> >> I have a bunch of image files in FITS format. For each raster row in >> each file, I need to determine the median pixel value and subtract it >> from all of the pixels in that row, and then write out the results as >> new FITS files. >

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Istvan Albert
RickMuller wrote: > One of my all-time favorite scripts is parseline, which is printed here is another way to write that: def parseline(line, format): trans = {'x':lambda x:None,'s':str,'f':float,'d':int,'i':int} return [ trans[f](w) for f,w in zip(format, line.split() ) ] >>> parseli

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
Hi Rick, Nice little script indeed ! You probably mean > trans = xlat.get(f,None) instead of > trans = xlat.get(f,'None') in the case where an invalid format character is supplied. The string 'None' evaluates to True, so that trans(words[i]) raises an exception A variant, with a

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Phoe6 wrote: > #!/usr/bin/python > global astring > astring = "This is a String" A global declaration just says "look for this name in the module namespace". Since you /are/ in the module namespace here, there's no need to put "global" here. > Works, but something different ? Excuse me, what d

Re: prefix search on a large file

2006-10-12 Thread Tim Chase
> def leaders(sorted_list): > held = None > for phrase in held: Ummm...that for phrase in None: doesn't do a whole lot other than give a traceback. :*) I suspect you mean for phrase in sorted_list: no? -tkc -- http://mail.python.org/mailman/listinfo/

Re: Python component model

2006-10-12 Thread Peter Maas
Peter Decker wrote: > I think you should take a good look at Dabo and the visual tools they > are creating. Thanks for the hint, Peter. I've heard of Dabo and it's on my list of things to be inspected. Perhaps my postings have been misunderstood. I don't feel uneasy with Python. I'm using it since

Re: Compile python on Solaris 64bit

2006-10-12 Thread Martin v. Löwis
Martijn de Munnik schrieb: > anybody succesfully compiled python on solaris? If that's really all you want to know: yes, I did. It works for me on 32-bit SPARC, and 64-bit SPARC. If you want to know more, you have to be *a lot* more precise as to what precisely you are trying to achieve, and how

Re: prefix search on a large file

2006-10-12 Thread Scott David Daniels
Try: def leaders(sorted_list): held = None for phrase in held: if held is None or not phrase.startswith(held): held = row yield held print list(leaders(sorted(data))) --Scott David Daniels [EMAIL PROTECTED] -- http://ma

Enthought python - Traits

2006-10-12 Thread Ash
Hello everyone ! I am trying to find some sort of a cookbook or more examples for using Enthought Traits to build GUI's. I tried to follow the documentations present at the enthought site, but couldnt get too far - especially on how to handle a control event ? Also while i am on the topic: say i

IDLE won't run

2006-10-12 Thread Rob
I have Python 2.4.3 installed on Windows XP on both a real computer and a virtual machine under VMware. Just recently, IDLE stopped working. I would select IDLE from the start menu or right click on a .PY file and open it in IDLE, but nothing happens. I just uninstalled Python on the virtual mac

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Paul Rubin
"RickMuller" <[EMAIL PROTECTED]> writes: > def parseline(line,format): > xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} > result = [] > words = line.split() > for i in range(len(format)): > f = format[i] > trans = xlat.get(f,'None') > if trans: result.ap

Re: problem including tests in unittest

2006-10-12 Thread Peter Otten
Chris Fonnesbeck wrote: > I have a module for which I am trying to code a unit test. However, > when I run unittest.main(), I get: > > In [1]: import PyMC > > In [2]: PyMC.unittest.main() > > -- > Ran 0 tests in 0.000s > > OK

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Juho Schultz
John Doty wrote: > The problem: > > I have a bunch of image files in FITS format. For each raster row in > each file, I need to determine the median pixel value and subtract it > from all of the pixels in that row, and then write out the results as > new FITS files. > This may be personal bias...

Re: Standard Forth versus Python: a case study

2006-10-12 Thread Neil Cerutti
On 2006-10-12, Neal Bridges <[EMAIL PROTECTED]> wrote: > "John Doty" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > [snip] >> Here's a K&R C function I wrote almost 20 years ago. > [code snipped] > > John, 'man indent' right away! As far as I know, he just forgot to strip out the

paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread RickMuller
One of my all-time favorite scripts is parseline, which is printed below def parseline(line,format): xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} result = [] words = line.split() for i in range(len(format)): f = format[i] trans = xlat.get(f,'None') if

Re: Compile python on Solaris 64bit

2006-10-12 Thread MrJean1
I did build Python 2.5 on a Solaris 10 Ultra 20 machine (Opteron) but using the SUN compilers. Two changes were needed in the Makefile: CXX=CC and CCSHARED=-KPIC. There are a few issues which I have not investigated further (like Tcl and ffitarget.h), but the tests pass except for 3 unexpected sk

Re: Is a list static when it's a class member?

2006-10-12 Thread Tom Plunket
Fredrik Lundh wrote: > so what's the practical difference between > > def __init__(self, name): > self.name = name > self.data = [] > > and > > def __init__(self, name): > self.name = name > self.data=[] Ignoring nerd-extreme-pedantic-mode for this ci

Re: numpy slice: create view, not copy

2006-10-12 Thread Terry Reedy
"K. Jansma" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > given an array: > > import numpy > a = numpy.arange(100).reshape((10,10)) > print a Numpy questions are best asked on the numpy mailing list. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python component model

2006-10-12 Thread Peter Maas
Kay Schluehr wrote: > Peter Maas wrote: >> How many programmers don't use Python because of the self issue? > > The only reason I know why self shall not be inforced is reducing the > number of troll postings. The only method that works to reduce the number of troll postings is: spot them, then i

Appropriate way to quit Tkinter

2006-10-12 Thread mzdude
I've just started playing with Python. Installed 2.5 on Windows XP system. I'm working through some of the examples in Programming Python 3ed by Mark Lutz. Given the following example when the Quit All button action is assigned to root.quit the windows aren't dismissed or destroyed. The application

Re: Python 2.4 online certification - new items available for Beta testing

2006-10-12 Thread skip
Randy> There is a free Beta test of a Python 2.4 Certification test Randy> available at Brainbench.com. They are a provider of skills-based Randy> certification exams. Go to the link below to find the test. It Randy> is free to take the test. Randy> http://www.brainbench.com/

Re: strings in the global section

2006-10-12 Thread Phoe6
Bjoern Schliessmann wrote: > If you assign "astring" inside the function body, it's a local name. > > > - What should I do to overwrite the string variable in the global > > section within functions? > > Put a "global astring" in the function to access the global name > instead. #!/usr/bin/python

Re: strings in the global section

2006-10-12 Thread Tim Chase
Phoe6 wrote: > I write a script: > #!/usr/bin/python > astring = "This is a String" > > def fun1(): > astring = "I modify it in fun1" > def fun2(): > astring = "I modify it in fun2" > def main(): > print astring > fun1() > print astring > fun2() >

Re: strings in the global section

2006-10-12 Thread Bjoern Schliessmann
Phoe6 wrote: > But it is not so. It always prints This is a String. astring > declared outside all the functions, is not in global section and > values be overwritten by functions accessing it? > > - How is this working? If you assign "astring" inside the function body, it's a local name. > -

strings in the global section

2006-10-12 Thread Phoe6
I write a script: #!/usr/bin/python astring = "This is a String" def fun1(): astring = "I modify it in fun1" def fun2(): astring = "I modify it in fun2" def main(): print astring fun1() print astring fun2() print astring if __name__ == '__mai

Re: prefix search on a large file

2006-10-12 Thread Peter Otten
js wrote: > By eliminating list cloning, my function got much faster than before. > I really appreciate you, John. > > def prefixdel_recursively2(alist): > if len(alist) < 2: > return alist > > first = alist.pop(0) > unneeded = [no for no, line in enumerate(alist) if > line.star

problem including tests in unittest

2006-10-12 Thread Chris Fonnesbeck
I have a module for which I am trying to code a unit test. However, when I run unittest.main(), I get: In [1]: import PyMC In [2]: PyMC.unittest.main() -- Ran 0 tests in 0.000s OK This is confusing, because I have set up a cl

Python 2.4 online certification - new items available for Beta testing

2006-10-12 Thread Randy Kraemer
There is a free Beta test of a Python 2.4 Certification test available at Brainbench.com. They are a provider of skills-based certification exams. Go to the link below to find the test. It is free to take the test. http://www.brainbench.com/xml/bb/common/testcenter/betatests.xml -- http://mail.p

Re: Pickling an instance of a class containing a dict doesn't work

2006-10-12 Thread Peter Otten
Marco Lierfeld wrote: > Jon Clements wrote: > >>> if you change the above to: >>> >>> class subproject: >>> def __init__(self): >>> configuration = { } >>> build_steps = [ ] >> >> Of course, I actually meant to write self.configuration and >> self.build_steps; d0h! > > Thank

numpy slice: create view, not copy

2006-10-12 Thread K. Jansma
Hi, given an array: import numpy a = numpy.arange(100).reshape((10,10)) print a [[ 0 1 2 3 4 5 6 7 8 9] [10 11 12 13 14 15 16 17 18 19] [20 21 22 23 24 25 26 27 28 29] [30 31 32 33 34 35 36 37 38 39] [40 41 42 43 44 45 46 47 48 49] [50 51 52 53 54 55 56 57 58 59] [60 61 62 63 64 6

Re: How to be a good programmers?

2006-10-12 Thread Bruno Desthuilliers
Gasikara wrote: > I have already started to learn the language (python) since 4 months, > I love this language program! I have read some of example of zope and I > see that it look like with html programming, Well... Zope being a web app server, this may not be that surprising. Now there's much

  1   2   >