Re: 3d programming without opengl

2006-10-30 Thread Fredrik Lundh
nelson - wrote: >i want to build up a simple 3d interactive geometry application in > python. Since i want to run it without 3D acceleration (a scene will > be quite simple) the scene is simple so I don't want to use a well-supported and widely used standard API because it might use hardware

Re: Python windows interactive.

2006-10-30 Thread Hendrik van Rooyen
"notejam" <[EMAIL PROTECTED]> Top posted: > Thanks everyone for the help. I got a simple two line program to work > from a text file. > Can not figure out how to write more than one line in interpreter mode. > Is that all interpreter is good for, testing one liners? I have it > run the progra

Tkinter Listbox string formatting question - how to kill a dancing snake ?

2006-10-30 Thread Hendrik van Rooyen
I am populating a listbox from a directory that looks like this: variable_dict = {"funny_long_or_short_variable_name_as_key": (2,45),.. the tuple represents a "card, line" pair. medf is a font object and a forward reference here. I write: for x in variable_dict: txt = x while medf.m

3d programming without opengl

2006-10-30 Thread nelson -
hi! i want to build up a simple 3d interactive geometry application in python. Since i want to run it without 3D acceleration (a scene will be quite simple) I was wondering if there was a library in python that allow me to build 3D graphic without the need to use OpenGL I google but i can't

Re: unescape HTML entities

2006-10-30 Thread Rares Vernica
Thanks a lot for all the answers! Ray Frederic Rentsch wrote: > Rares Vernica wrote: >> Hi, >> >> How can I unescape HTML entities like " "? >> >> I know about xml.sax.saxutils.unescape() but it only deals with "&", >> "<", and ">". >> >> Also, I know about htmlentitydefs.entitydefs, but not only

Re: Event driven server that wastes CPU when threaded doesn't

2006-10-30 Thread Bryan Olson
Snor wrote: > I'm attempting to create a lobby & game server for a multiplayer game, > and have hit a problem early on with the server design. I am stuck > between using a threaded server, and using an event driven server. I've > been told time and time again that I should use an event driven serve

Re: make a simple search function for homepage

2006-10-30 Thread James Stroud
HYRY wrote: > I want to add some simple search function for my homepage. It need to > search through all the html files of my homepage (about 300 pages), and > highlight the search words. > > I made some test with HTMLParser, it works but slow. So, my question is > how can I improve its speed? >

create global variables?

2006-10-30 Thread aking
J. Clifford Dyer wrote: > Alistair King wrote: > >> Hi, >> >> is there a simple way of creating global variables within a function? >> >> ive tried simply adding the variables in: >> >> def function(atom, Xaa, Xab): >> Xaa = onefunction(atom) >> Xab = anotherfunction(atom) >> >> if i c

Re: Adding a comment to an image using PIL

2006-10-30 Thread Fredrik Lundh
Jeffrey Barish wrote: > I am trying to use PIL to add a comment to an image. I have never used PIL > before, but I discovered that it is possible to print an existing comment > with the following: > > im = PIL.Image.open('filename.jpg') > print im.app['COM'] > > I figured that I could write a c

[no subject]

2006-10-30 Thread aking
J. Clifford Dyer wrote: > Alistair King wrote: > >> Hi, >> >> is there a simple way of creating global variables within a function? >> >> ive tried simply adding the variables in: >> >> def function(atom, Xaa, Xab): >> Xaa = onefunction(atom) >> Xab = anotherfunction(atom) >> >> if i ca

Re: enumerate improvement proposal

2006-10-30 Thread Paddy
James Stroud wrote: > Steve Holden wrote: > > How could you end up marrying > > someone who counts from one and not zero? ;-) > > She's the only other person I've ever met who used vi key binding at the > command line. > Wow. Now I see! It's only Python. Just add one to indices where appropriate,

make a simple search function for homepage

2006-10-30 Thread HYRY
I want to add some simple search function for my homepage. It need to search through all the html files of my homepage (about 300 pages), and highlight the search words. I made some test with HTMLParser, it works but slow. So, my question is how can I improve its speed? from HTMLParser import HTM

Re: scared about refrences...

2006-10-30 Thread J. Clifford Dyer
SpreadTooThin wrote: > J. Clifford Dyer wrote: >> SpreadTooThin wrote: >>> Steven D'Aprano wrote: On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: >>> I seems that some of the objects in the list don't get along well with >>> deep copy.. >>> See my second example post that us

Re: Talks at PyCon that Teach How to Be Better Programmers

2006-10-30 Thread jeff
Paul Rubin <"http://phr.cx"@NOSPAM.invalid> writes: > "Robert Brewer" <[EMAIL PROTECTED]> writes: >> 2. Dynamic languages naturally more lang-maven oriented? >>See http://osteele.com/archives/2004/11/ides > > Not sure what you mean by this, even after reading that (interesting) > article. The

Cann't connect zope server

2006-10-30 Thread steve
Can I ask question about zope here? I started Zserver but could not connect to it using firefox.The runzope gave message: /usr/bin/zope/instance/bin/runzope -X debug-mode=on 2006-10-31 12:50:45 INFO ZServer HTTP server started at Tue Oct 31 12:50:45 2006 Hostname: 0.0.0.0 Port: 80

Re: slice's indices() method

2006-10-30 Thread smichr
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > Is there any reason not to change the behavior of the indices() method > > so it gives indices that can be used in range (to give indices > > corresponding to elements that would be extracted by a given slice) > > *and* used as arguments for sl

Re: Serious wxPython Error while executing..

2006-10-30 Thread Paul McNett
kath wrote: > Hello, sorry about the lengthy message. > > I finding difficult to execute this program. The wx.Notebook i created > is coming on the splitted frame(self.p2). How do I that. I am started > to learn wxPython, and when I run the code, the code doesnot close > gracefully, it throughs m

Adding a comment to an image using PIL

2006-10-30 Thread Jeffrey Barish
I am trying to use PIL to add a comment to an image. I have never used PIL before, but I discovered that it is possible to print an existing comment with the following: im = PIL.Image.open('filename.jpg') print im.app['COM'] I figured that I could write a comment by reversing this procedure: im

Re: import in threads: crashes & strange exceptions on dual core machines

2006-10-30 Thread Klaas
It seems clear that the import lock does not include fully-executing the module contents. To fix this, just import cookielib before the threads are spawned. Better yet, use your own locks around the acquisition of the opener instance (this code seems fraughtfully thread-unsafe--fix that and you s

Re: beginner's refcount questions

2006-10-30 Thread Scott David Daniels
Jens Theisen wrote: > python uses gc only where refcounts alone haven't yet done the > job. Thus, the following code > class Foo: > def __del__(self): >print "deled!" ... In c++, this is a central technique used for all sorts of tasks, whereas in garbage collected languages

Re: Python windows interactive.

2006-10-30 Thread Steve Holden
notejam wrote: > Thanks everyone for the help. I got a simple two line program to work > from a text file. > Can not figure out how to write more than one line in interpreter mode. > Is that all interpreter is good for, testing one liners? I have it > run the program everytime I hit return, and

python, threading and a radio timer

2006-10-30 Thread Renato
Dear all, I found this nifty article on how to record your favourite radio show using cron and mplayer: http://grimthing.com/archives/2004/05/20/recording-streaming-audio-with-mplayer/ Because I couldn't get the date in the filename (and was too lazy to look into sh/bash manuals), I decided to us

Re: Error importing .pyd python extension

2006-10-30 Thread Toby
P.S. I have run 'depends', and all the dll's are there, the only error its throwing up is: "Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module." The offending file is mpr.dll in c:\windows\system32\ Any ideas? Toby Toby wrote

Re: enumerate improvement proposal

2006-10-30 Thread Ben Finney
Mark Elston <[EMAIL PROTECTED]> writes: > * James Stroud wrote (on 10/30/2006 4:39 PM): > > She's the only other person I've ever met who used vi key binding > > at the command line. > > Well, there's your problem. You need to C-x C-f a new mate. :) I don't have the commitment for that. What if

Re: Python windows interactive.

2006-10-30 Thread Tiefeng Wu
> notejam wrote: > Thanks everyone for the help. I got a simple two line program to work > from a text file. > Can not figure out how to write more than one line in interpreter mode. > Is that all interpreter is good for, testing one liners? I have it > run the program everytime I hit return, an

Re: ANN: Leo 4.4.2.1 final released

2006-10-30 Thread Edward K. Ream
>I downloaded the Windows exe, ran it and a small blank message window poped >up and that was it. > I am still running 2.3. I assume you mean Python 2.3, not Leo 2.3 :-) I know for sure that Leo works with Python 2.3. In the future, please report problems to one of Leo's forums. And when repo

Re: Python windows interactive.

2006-10-30 Thread Gabriel Genellina
At Monday 30/10/2006 21:15, notejam wrote: Thanks everyone for the help. I got a simple two line program to work from a text file. Can not figure out how to write more than one line in interpreter mode. Is that all interpreter is good for, testing one liners? I have it run the program everyt

Re: Python windows interactive.

2006-10-30 Thread BartlebyScrivener
Try this, assuming you're in IDLE. http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html You can enter as many lines as you want in the interpreter. Then press ENTER twice to get the result. Or try here if you're looking for some tutorials. http://tinyurl.com/w7wgp rd -- http://mai

Re: scared about refrences...

2006-10-30 Thread Gabriel Genellina
At Monday 30/10/2006 20:37, Nick Vatamaniuc wrote: In Python all the primitives are copied and all other entities are references. What do you mean? primitives==builtin classes? entities==objects? In Python, objects are never automatically copied, either builtin or user-defined. Even 123 is a

Re: enumerate improvement proposal

2006-10-30 Thread Mark Elston
* James Stroud wrote (on 10/30/2006 4:39 PM): > Steve Holden wrote: >> How could you end up marrying someone who counts from one and not >> zero? ;-) > > She's the only other person I've ever met who used vi key binding at the > command line. > > James > > Well, there's your problem. You ne

Re: enumerate improvement proposal

2006-10-30 Thread James Stroud
Steve Holden wrote: > How could you end up marrying > someone who counts from one and not zero? ;-) She's the only other person I've ever met who used vi key binding at the command line. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 ht

Error importing .pyd python extension

2006-10-30 Thread Toby
Hi, I've managed to get my hands on the ms 2003 toolkit, and have successfully (i think) created a .pyd file in win xp (setup.py is provided intersystems cache): C:\CacheSys\Dev\python>setup.py install enter directory where you i

Re: scared about refrences...

2006-10-30 Thread SpreadTooThin
J. Clifford Dyer wrote: > SpreadTooThin wrote: > > Steven D'Aprano wrote: > >> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: > >> > > How do I specify or create deep copies of objects that may contain > > other objects that may contain other object that may contain other > >

Re: Python windows interactive.

2006-10-30 Thread notejam
Thanks everyone for the help. I got a simple two line program to work from a text file. Can not figure out how to write more than one line in interpreter mode. Is that all interpreter is good for, testing one liners? I have it run the program everytime I hit return, and can not figure out how t

Re: I want to work on Python

2006-10-30 Thread [EMAIL PROTECTED]
I could use help with my project. It should be very popular when more of it is done and credit may be a good way to build your resume https://sourceforge.net/projects/dex-tracker ArdPy wrote: > Hi there, these days I am desperately searching everywhere on the > Internet for part time python job

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread Ben Finney
[EMAIL PROTECTED] writes: > So, I have a module with an arbitrary file name and I want to load it, > and later access its function definitions. > How can I do this ? In my example, the last line will obviously not > work. If you want a solution that gives you an actual module object, here's what

Re: checking if a sqlite connection and/or cursor is still open?

2006-10-30 Thread Nick Vatamaniuc
I am not familiar with SQLite driver, but a typical Pythonic way to check if you can do something is to just try it, and see what happens. In more practical terms: try to just use the cursor or the connection and see if an exception will be raised. Nick V. John Salerno wrote: > John Salerno wr

PyDoc link to source code

2006-10-30 Thread Taylor, Martin
When you use PyDoc, either with -w to generate a static web page or with -p to run as a web server, the generated pages have a link in the upper right corner to the source code for the referenced module. I can never get this link to work.  I think part of the problem is that MS-IE doesn't kn

Re: dict problem

2006-10-30 Thread Ben Finney
Alistair King <[EMAIL PROTECTED]> writes: > heavy = raw_input("\n\n@@\n\nPlease enter the heaviest > atom for which you obtained percentage values for, but not Oxygen, eg, > 'C', 'N', 'S', 'Br'...: ") > > print DSvalues > > def updateDS1v(Fxas, x): > if Fxas != 0: > value = DSvalue

Serious wxPython Error while executing..

2006-10-30 Thread kath
Hello, sorry about the lengthy message. I finding difficult to execute this program. The wx.Notebook i created is coming on the splitted frame(self.p2). How do I that. I am started to learn wxPython, and when I run the code, the code doesnot close gracefully, it throughs me an error. "pythonw.ex

Re: enumerate improvement proposal

2006-10-30 Thread Steve Holden
James Stroud wrote: > Diez B. Roggisch wrote: > >>>Okay, I've googled "leaky abstractions" (as was probably your intended >>>affect with your silence), read the famous essay, and still >>>don't know what you mean and how it applies to what I have described. >>> >>>Do you plan to justify your state

Re: scared about refrences...

2006-10-30 Thread Nick Vatamaniuc
I think you are afraid of references because you are not trusting your own code. You are afraid it will do "magic" behind the scenes and mess everything up. One way around that is to simply write better code and test often. If everything was copied when passed around it would be pretty awful -- i

Re: enumerate improvement proposal

2006-10-30 Thread James Stroud
Diez B. Roggisch wrote: >> Okay, I've googled "leaky abstractions" (as was probably your intended >> affect with your silence), read the famous essay, and still >> don't know what you mean and how it applies to what I have described. >> >> Do you plan to justify your statement or emptily accuse peo

Re: scared about refrences...

2006-10-30 Thread J. Clifford Dyer
SpreadTooThin wrote: > Steven D'Aprano wrote: >> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: >> > How do I specify or create deep copies of objects that may contain > other objects that may contain other object that may contain other > objects See the `copy` module

Re: scared about refrences...

2006-10-30 Thread SpreadTooThin
Steven D'Aprano wrote: > On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: > > >> > How do I specify or create deep copies of objects that may contain > >> > other objects that may contain other object that may contain other > >> > objects > >> > >> See the `copy` module especially `cop

Re: scared about refrences...

2006-10-30 Thread Steven D'Aprano
On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: >> > How do I specify or create deep copies of objects that may contain >> > other objects that may contain other object that may contain other >> > objects >> >> See the `copy` module especially `copy.deepcopy()`. >> > > This appears t

Re: create global variables?

2006-10-30 Thread Jason
Alistair King wrote: > have tried: > > def monoVarcalc(atom): > a = atom + 'aa' > Xaa = a.strip('\'') > m = atom + 'ma' > Xma = m.strip('\'') > global Xma > global Xaa > Xaa = DS1v.get(atom) > Xma = pt.get(atom) > print Xma > print Xaa > > monoVarcalc('C') >

Re: Python windows interactive.

2006-10-30 Thread Larry Bates
notejam wrote: > I am trying to get started with a interactive version of Python for > windows and need some help. > I have played with the tutorial, and now want to write a program. > > In basic language, I could write something like > 10 print "hello" > 20 print "Jim" > > and if I run it I woul

Re: create global variables?

2006-10-30 Thread Steve Holden
Wojciech Muła wrote: > Alistair King wrote: > >>is there a simple way of creating global variables within a function? > > > def foo(name): > globals()[name] = "xxx" > globals()[name + 'aa'] = "yyy" > globals()[name + 'ab'] = "zzz" Please note that this is a terrible programmin

Re: Python windows interactive.

2006-10-30 Thread Paul McGuire
"notejam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to get started with a interactive version of Python for > windows and need some help. > I have played with the tutorial, and now want to write a program. > > In basic language, I could write something like > 10 prin

Re: Compile Python With SSL On Solaris 10

2006-10-30 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I am trying to compile py2.4.3/2.5 on a Solaris 10x86 machine, but > cannot get it to build an SSL enabled version. I have added the > relevant sfw directories into the path/crle, with no success. I've > even explicitly added ssl via the --with-libs directive, yet an

Re: CHM help file for Python 2.5

2006-10-30 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Can anyone point me to new location of this version of manual, > or tell me why this format is no longer supported ... ? It's on the download page itself: http://www.python.org/download/releases/2.5/ http://www.python.org/ftp/python/2.5/Python25.chm Regards, Martin -

Re: Python windows interactive.

2006-10-30 Thread abcd
> How do I do sometihing simple like that in python? print "hello" print "Jim" > How do I enter line numbers, or if none, what do I do. no line numbers needed > Can the interpreter load a text file with my program in it? read in a text file: data = open("something.txt").read() > How do I list

Re: importing class

2006-10-30 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Thanks for your help. Actually my idea was that command1 and command2 > would be defined within the program, not the module, as I would have > different choices in different programs. Should I pass them in as a > parameter too? > It would seem to be the only way to tell

Re: Python windows interactive.

2006-10-30 Thread robfalck
edit a plain text file, just type one line print "hello, world" Now save that one-line text file as "hello.py". From the command line, in the same directory, type: python hello.py And it should run your script. Python doesnt require line numbers. Happy coding. -- http://mail.python.org/

Re: scared about refrences...

2006-10-30 Thread SpreadTooThin
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, SpreadTooThin > wrote: > > > I'm really worried that python may is doing some things I wasn't > > expecting... but lets see... > > Expect that Python never copies something if don't ask explicitly for a > copy. > > > if I pass a list to a f

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Frederic Rentsch
一首诗 wrote: > Oh, I didn't make myself clear. > > What I mean is how to convert a piece of html to plain text bu keep as > much format as possible. > > Such as convert " " to blank space and convert to "\r\n" > > Gary Herron wrote: > >> 一首诗 wrote: >> >>> Is there any simple way to solve thi

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
On Oct 30, 3:47 pm, John Salerno <[EMAIL PROTECTED]> wrote: >I noticed that one object you refer to is > self.textPane, is that supposed to be self.textPanel? no, self.textPane is the actual wx.TextCtrl. I used a GUI Builder to the layout stuff...perhaps that's my problem :) is there a good site

Python windows interactive.

2006-10-30 Thread notejam
I am trying to get started with a interactive version of Python for windows and need some help. I have played with the tutorial, and now want to write a program. In basic language, I could write something like 10 print "hello" 20 print "Jim" and if I run it I would get hello Jim How do I do some

Odd build errors

2006-10-30 Thread Jeff Blaine
We have a GCC in /usr/rcf that was not built with --disable-shared. As such, there is a /usr/rcf/lib/libgcc_s.so. We also have a (preferred) GCC in /afs/rcf/lang/gcc/current that was built with --disable-shared. As such, there is no /afs/rcf/lang/gcc/current/lib/libgcc_s.so and binaries built wit

Re: Python 123 introduction

2006-10-30 Thread John Salerno
[EMAIL PROTECTED] wrote: > dakman> This is great! A excellent tutorial for somone who has prior > dakman> experience in programming and is starting out in python. My > dakman> friend keeps wanting me to teach him python, I think this would > dakman> be the perfect link for him. > >

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread John Salerno
abcd wrote: >> But one question that comes to mind is, do you not add sizerTextPanel to >> sizerMainPanel? I think all sub-sizers should be added to the main >> sizer, unless there's some weird reason I don't know of. > > well i set the sizer on the textPanel and then I add the textPanel to > size

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
> But one question that comes to mind is, do you not add sizerTextPanel to > sizerMainPanel? I think all sub-sizers should be added to the main > sizer, unless there's some weird reason I don't know of. well i set the sizer on the textPanel and then I add the textPanel to sizerMainPanel -- http:

Re: Python 123 introduction

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'm not trying to minimize Jeremy's efforts in any way, but how is his > tutorial a significant improvement over the original > (http://www.python.org/doc/current/tut/)? don't forget the community-enhanced edition over at: pytut.infogami.com -- http://mail.pyth

Re: Python 123 introduction

2006-10-30 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > I'm not trying to minimize Jeremy's efforts in any way, but how is his > tutorial a significant improvement over the original > (http://www.python.org/doc/current/tut/)? It's not intended as a replacement, but what I wanted to do was write a quick 2 hour course for peop

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread John Salerno
abcd wrote: > sizerMainPanel.Add(self.textPanel, 3, wx.ALL|wx.EXPAND, 0) Your best bet may be to post to [EMAIL PROTECTED] But one question that comes to mind is, do you not add sizerTextPanel to sizerMainPanel? I think all sub-sizers should be added to the main sizer, unless there's s

Re: scared about refrences...

2006-10-30 Thread SpreadTooThin
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, SpreadTooThin > wrote: > > > I'm really worried that python may is doing some things I wasn't > > expecting... but lets see... > > Expect that Python never copies something if don't ask explicitly for a > copy. > > > if I pass a list to a f

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
On Oct 30, 2:52 pm, John Salerno <[EMAIL PROTECTED]> wrote: Don't know for sure, but you can try calling the Refresh() method on the > text control and see if that fixes it. Didn't make a difference. Not sure what the problem is, I am wondering if it is a layout issue since that is my weak spot w

Re: scared about refrences...

2006-10-30 Thread Fredrik Lundh
SpreadTooThin wrote: > I'm really worried that python may is doing some things I wasn't > expecting... but lets see... > > if I pass a list to a function def fn(myList): > > and in that function I modify an element in the list, then does the > callers list get modied as well. > > def fn(list):

Re: wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread John Salerno
abcd wrote: > I have a TextCtrl which is set to be multi-line. I have a function > say, updateText(msg), which takes some string and appends it to the > text control... > > txtControl.AppendText(msg) > > however, if the text that I am appending would cause the scroll > bars to appear/or scro

Re: checking if a sqlite connection and/or cursor is still open?

2006-10-30 Thread John Salerno
John Salerno wrote: > Is there a way to check if a SQLite connection and cursor object are > still open? I took a look at the docs and the DB API but didn't see > anything like this. > > Thanks. Well, I might have somewhat solved this problem. Since SQLite allows you to use execute* methods di

Re: enumerate improvement proposal

2006-10-30 Thread Diez B. Roggisch
> Okay, I've googled "leaky abstractions" (as was probably your intended > affect with your silence), read the famous essay, and still > don't know what you mean and how it applies to what I have described. > > Do you plan to justify your statement or emptily accuse people of violating > esoteric

wxPython TextCtrl - weird scrolling behavior

2006-10-30 Thread abcd
I have a TextCtrl which is set to be multi-line. I have a function say, updateText(msg), which takes some string and appends it to the text control... txtControl.AppendText(msg) however, if the text that I am appending would cause the scroll bars to appear/or scroll since the text is long th

Re: scared about refrences...

2006-10-30 Thread John Henry
I am no Python guru - just an ordinary user. There is nothing "scary" about this. There are (many) situations where this is actually *desirable* but of course there are (many) situations where this is an unwelcomed side-effect. In situations where I don't want this to happen, I simply pass down

Re: scared about refrences...

2006-10-30 Thread Neil Cerutti
On 2006-10-30, SpreadTooThin <[EMAIL PROTECTED]> wrote: > def fn(list): >list[1] = 0 > > myList = [1, 2, 3] > print myList > fn(myList) > print myList > [1,2,3] [1,0,3] > > How can I avoid this? In this case this is a really simplified > example but the effects are the same... How do

Re: scared about refrences...

2006-10-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, SpreadTooThin wrote: > I'm really worried that python may is doing some things I wasn't > expecting... but lets see... Expect that Python never copies something if don't ask explicitly for a copy. > if I pass a list to a function def fn(myList): > > and in that function

scared about refrences...

2006-10-30 Thread SpreadTooThin
I'm really worried that python may is doing some things I wasn't expecting... but lets see... if I pass a list to a function def fn(myList): and in that function I modify an element in the list, then does the callers list get modied as well. def fn(list): list[1] = 0 myList = [1, 2, 3] print

Re: ANN: SPE 0.8.3.c Python IDE editor

2006-10-30 Thread Chris Seymour
Hi Stani, Not able to reach Berlios. The SourceForge page does not have the Windows installer. Any ideas when it will be available? Thanks. Chris Bernard wrote: > thanks Stani! > > SPE - Stani's Python Editor wrote: > > This is a maintenance release (mostly bug fixing) to prove that SPE is > >

Re: Calling GNU/make from a Python Script

2006-10-30 Thread skip
>> os.system("make -C %s" % build_dir) >> OP specified GNU make, so that works fine, but make sure you're not >> going to need to use it with another make before settling on that >> alternative. Frederik's works with more versions of make. Understood. That was the only reason I

Re: Python 123 introduction

2006-10-30 Thread skip
dakman> This is great! A excellent tutorial for somone who has prior dakman> experience in programming and is starting out in python. My dakman> friend keeps wanting me to teach him python, I think this would dakman> be the perfect link for him. I'm not trying to minimize Jeremy's

Re: Calling GNU/make from a Python Script

2006-10-30 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > Fredrik> build_dir = "path/to/makefile" > > Fredrik> cwd = os.getcwd() # get current directory > Fredrik> try: > Fredrik> os.chdir(build_dir) > Fredrik> os.system("make") > Fredrik> finally: > Fredrik> os.chdir(cwd) > > Or even: > >

Re: create global variables?

2006-10-30 Thread Fredrik Lundh
Wojciech Muła wrote: >> is there a simple way of creating global variables within a function? > > def foo(name): > globals()[name] = "xxx" > globals()[name + 'aa'] = "yyy" > globals()[name + 'ab'] = "zzz" that kind of coding is punishable by law in some jurisdictions. -- ht

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Fredrik Lundh
一首诗 wrote: > Is there any simple way to solve this problem?   corresponds to a non-breaking space, chr(160). if you're only dealing with this specific XML/HTML entity, you can do text = text.replace(" ", " ") or text = text.replace(" ", chr(160)) to handle arbitrary entities and c

Re: How to convert " " in a string to blank space?

2006-10-30 Thread [EMAIL PROTECTED]
On Oct 30, 6:44 pm, "一首诗" <[EMAIL PROTECTED]> wrote: > Oh, I didn't make myself clear. > > What I mean is how to convert a piece of html to plain text bu keep as > much format as possible. > > Such as convert " " to blank space and convert to "\r\n" > Then you can explore the parser, http://doc

Re: Python 123 introduction

2006-10-30 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > This is great! A excellent tutorial for somone who has prior experience > in programming and is starting out in python. My friend keeps wanting > me to teach him python, I think this would be the perfect link for him. I'm glad you think it is useful. It needs a bit of c

Re: Observation on "Core Python Programming"

2006-10-30 Thread wesley chun
(warning: LONG reply) thanks to those above for the kind remarks. tackling comments and questions, not quite in chronological order. :-) > Who would you say the book is aimed at? Advanced programmers? this book is targeted towards technical professionals already literate in another high-level

Re: create global variables?

2006-10-30 Thread J. Clifford Dyer
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > > ive tried simply adding the variables in: > > def function(atom, Xaa, Xab): > Xaa = onefunction(atom) > Xab = anotherfunction(atom) > > if i can give something like: > > function('C

Re: Python 123 introduction

2006-10-30 Thread [EMAIL PROTECTED]
This is great! A excellent tutorial for somone who has prior experience in programming and is starting out in python. My friend keeps wanting me to teach him python, I think this would be the perfect link for him. Thanks. Jeremy Sanders wrote: > Here is a brief simple introduction to Python I wro

Re: How to convert " " in a string to blank space?

2006-10-30 Thread 一首诗
Oh, I didn't make myself clear. What I mean is how to convert a piece of html to plain text bu keep as much format as possible. Such as convert " " to blank space and convert to "\r\n" Gary Herron wrote: > 一首诗 wrote: > > Is there any simple way to solve this problem? > > > > > Yes, strings have

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread [EMAIL PROTECTED]
I had to do something like this a while back for a modular IRC bot that I wrote. __import__() will do the trick, however to avoid getting a cache of the module I recomend doing something like... mod = reload( __import__("%s-%s-%s" % ( t[0], t[1], t[2] ) ) ) [EMAIL PROTECTED] wrote: > Hi all, > >

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Gary Herron
一首诗 wrote: > Is there any simple way to solve this problem? > > Yes, strings have a replace method: >>> s = "abc def" >>> s.replace(' ',' ') 'abc def' Also various modules that are meant to deal with web and xml and such have functions to do such operations. Gary Herron -- http://mail.py

Re: How to convert " " in a string to blank space?

2006-10-30 Thread [EMAIL PROTECTED]
Is this what you want? py> s = 'This string contains   two times   - end' py> print s.replace(' ', ' '*6) This string containstwo times- end see http://docs.python.org/lib/string-methods.html On Oct 30, 6:26 pm, "一首诗" <[EMAIL PROTECTED]> wrote: > Is there any simple way to solve

Re: How to convert " " in a string to blank space?

2006-10-30 Thread martdi
一首诗 wrote: > Is there any simple way to solve this problem? >>> myString = " " >>> myString = myString.replace(" ", "") -- http://mail.python.org/mailman/listinfo/python-list

Re: enumerate improvement proposal

2006-10-30 Thread Anders J. Munch
Ben Finney wrote: > > >>> def obstinate_economist_enumerate(items): > ... enum_iter = iter((i+1, x) for (i, x) in enumerate(items)) > ... return enum_iter iter is redundant here. def natural_enumerate_improvement(items, start=0): return ((i+start, x) for (i, x) in enumer

How to convert " " in a string to blank space?

2006-10-30 Thread 一首诗
Is there any simple way to solve this problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: create global variables?

2006-10-30 Thread Alistair King
Gary Herron wrote: > Alistair King wrote: > >> Hi, >> >> is there a simple way of creating global variables within a function? >> >> >> > Use the "global" statement within a function to bind a variable to a > global. > > See http://docs.python.org/ref/global.html for details. > > > >

Re: create global variables?

2006-10-30 Thread Wojciech Muła
Alistair King wrote: > is there a simple way of creating global variables within a function? def foo(name): globals()[name] = "xxx" globals()[name + 'aa'] = "yyy" globals()[name + 'ab'] = "zzz" -- http://mail.python.org/mailman/listinfo/python-list

Re: create global variables?

2006-10-30 Thread robert
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > #module global: def f(atom): global a a=1 globals()[atom+'var']=2 def f(): a=b=1 globals().update(locals()) _global=sys.modules[__name__] def f(atom): _global.a = 1

Re: create global variables?

2006-10-30 Thread Gary Herron
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > > Use the "global" statement within a function to bind a variable to a global. See http://docs.python.org/ref/global.html for details. >>> def x(): ... global g ... g = 12

Re: IE7 skulduggery?

2006-10-30 Thread Alistair King
BartlebyScrivener wrote: > Found fix for this at Mozilla: > > http://kb.mozillazine.org/Default_browser > > Apparently, even though it LOOKS and ACTS like Firefox is still your > default browser after an IE7 upgrade, it's not. > > To fix, you must run: > > firefox.exe -silent -nosplash -setDefaultB

  1   2   >