Re: XP rich text cut-n-paste

2006-03-05 Thread Neil Hodgson
Paddy: Scintilla does indeed have the feature, and googling for the term copy as RTF lead me to http://www.pnotepad.org/ which also has the feature. Its actually implemented in SciTE rather than Scintilla by the ugly technique of writing out an RTF file and then copying that to the

raw strings and \

2006-03-05 Thread plahey
I thought I understood raw strings, then I got bitten by this: x=r'c:\blah\' which is illegal! I thought that \ had no special meanning in a raw string so why can't it be the last character? making me do: x=r'c:\blah' '\\' is just silly... --

django and mod_python

2006-03-05 Thread bapolis
Hi, I read the mod_python documentation on the Django site but I'm getting this error: EnvironmentError: Could not import DJANGO_SETTINGS_MODULE 'accesshiphop.settings' (is it on sys.path?): No module named accesshiphop.settings Here's my httpd.conf: Location /public_html/myproject/

Re: raw strings and \

2006-03-05 Thread Duncan Booth
wrote: I thought I understood raw strings, then I got bitten by this: x=r'c:\blah\' which is illegal! I thought that \ had no special meanning in a raw string so why can't it be the last character? No, the backslash is still special in terms of parsing the string, it is simply that

Re: XP rich text cut-n-paste

2006-03-05 Thread Duncan Booth
Paddy wrote: Is their a colourized editor/shell that allows you to cut and paste the colourized text? Idle, SPE, Eclipse, and pythonwin all seem to nicely colourize both command line input as well as editor windows but when I cut and paste (in this case, into OpenOffice Writer), even the

is there such a built-in funciton, similar to filter

2006-03-05 Thread wcc
Hello, Beginner learning Python here. I know filter(lambda x: x 3, [1, 2, 5, -3, 4, 8]) will give me a list [5, 4, 8]. What if I only need to find the first item in the list that returns Ture when applying the filter function. In this case, I only want to get the 5, and its index 2. Is there

Re: django and mod_python

2006-03-05 Thread Robin Becker
[EMAIL PROTECTED] wrote: Hi, I read the mod_python documentation on the Django site but I'm getting this error: EnvironmentError: Could not import DJANGO_SETTINGS_MODULE 'accesshiphop.settings' (is it on sys.path?): No module named accesshiphop.settings Here's my httpd.conf:

Re: is there such a built-in funciton, similar to filter

2006-03-05 Thread Michael Hoffman
wcc wrote: Beginner learning Python here. I know filter(lambda x: x 3, [1, 2, 5, -3, 4, 8]) will give me a list [5, 4, 8]. What if I only need to find the first item in the list that returns Ture when applying the filter function. In this case, I only want to get the 5, and its index 2.

Re: Passing a method indirectly

2006-03-05 Thread swisscheese
Thanks - that worked! Thanks to the other replies also. -- http://mail.python.org/mailman/listinfo/python-list

lists: += vs. .append() oddness with scope of variables

2006-03-05 Thread Sandro Dentella
I'd like to understand why += operator raises an error while .append() does not. My wild guess is the parses treats them differently but I cannot understand why this depends on scope of the variables (global or class variables): a = [0] class foo(object): def __init__(self): print

Re: lists: += vs. .append() oddness with scope of variables

2006-03-05 Thread Felipe Almeida Lessa
Em Dom, 2006-03-05 às 11:49 +, Sandro Dentella escreveu: class foo(object): def __init__(self): print a: , a # += does not work if 'a' is global #a += [1] a.append(2) print a= , a Try with: a = [0] class foo(object): def

Re: lists: += vs. .append() oddness with scope of variables

2006-03-05 Thread Duncan Booth
Sandro Dentella wrote: I'd like to understand why += operator raises an error while .append() does not. My wild guess is the parses treats them differently but I cannot understand why this depends on scope of the variables (global or class variables): a = [0] class foo(object):

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Astan Chee
thanks for the webpage info, however theres a small error I found when trying to generate a prime number with more than 300 decimal digits. It comes up with File prime.py, line 84, in mod_square_pow return x*mod_square_pow(((a**2)%n),t,n,p*2) File prime.py, line 84, in mod_square_pow

disabling the line buffer somehow

2006-03-05 Thread Can Burak Cilingir
Hi, I'm trying to proxy all keys typed by the user to a process spawned via popen2. Unfortunately, I figured out that I can't control really interactive applications such as mc or aptitude. All user input seems to be line buffered. http://pexpect.sourceforge.net/ has some words about the

Re: how to overload sqrt in a module?

2006-03-05 Thread Kent Johnson
Michael McNeil Forbes wrote: Is there anything really bad about the following? It works exactly as I would like, but I don't want to get in trouble down the road: module_f import math as my_math def set_math(custom_math): globals()['my_math'] = custom_math This seems

Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Please forgive my call() Change this: argPrecedence('arg1', arg3='arg3', arg2='arg2', arg5='arg5') to this: argPrecedence('arg1', par3='arg3', par2='arg2', arg5='arg5') Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Re: Argument Precedence (possible bug?)

2006-03-05 Thread Fredrik Lundh
vbgunz wrote: I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Question re client/server and blocking

2006-03-05 Thread Frank Millman
Hi all I am developing a multi-user business/accounting application. It is coming along nicely :-), though rather slowly :-( I have hit an issue which will require a lot of changes to the code I have written so far, together with an increase in complexity and all the bad things that follow from

Re: how to overload sqrt in a module?

2006-03-05 Thread Steven D'Aprano
On Sat, 04 Mar 2006 23:07:12 -0800, Michael McNeil Forbes wrote: On Fri, 3 Mar 2006, Steven D'Aprano wrote: ... you can do this: import my_module my_module.set_environment(math) # or cmath, or numeric, or whatever Your my_module will be like this: # Warning: untested code. ENVIRON =

Re: is there such a built-in funciton, similar to filter

2006-03-05 Thread wcc
Thanks a lot Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument Precedence (possible bug?)

2006-03-05 Thread Peter Hansen
vbgunz wrote: I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? Maybe by putting that in the list of arguments? ... You don't even *have*

Re: Python advocacy in scientific computation

2006-03-05 Thread Brian Blais
Robert Kern wrote: That said, we have an excellent array object far superior to Matlab's. http://numeric.scipy.org/ I'd like to ask, being new to python, in which ways is this array object far superior to Matlab's? (I'm not being sarcastic, I really would like to know!) I've heard

Re: Argument Precedence (possible bug?)

2006-03-05 Thread Steven D'Aprano
On Sun, 05 Mar 2006 04:45:05 -0800, vbgunz wrote: Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ##

Re: Argument Precedence (possible bug?)

2006-03-05 Thread Steven D'Aprano
On Sun, 05 Mar 2006 04:45:05 -0800, vbgunz wrote: PS. I could be far off with this codes purpose; to try and create an example that will house all the different possible parameters (positional, keyword, * and **) in one single def statement. This is usually a bad idea, not because Python

Re: How to except the unexpected?

2006-03-05 Thread Rene Pijlman
Steven D'Aprano: The OP is doing it because catching all exceptions masks bugs. There are certain exceptions which should be allowed through, as they indicate a bug in the OP's code. Normally the tactic is to catch only the exceptions you are interested in, and let everything else through, but the

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
I am sorry I hung you up on a typo Peter Hansen. On line 5 *arg4 should have been *par4. I hope it makes complete sense now. Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Please allow me some time to look at your examples. I get hung up over the smallest details because in my mind, my approach should have just worked... I learned about these parameters reading O'reilly Learning Python 2nd Edition. On page 217 of the paperback or Chapter 13.5.6 in the ebook, topic:

Inline assignments

2006-03-05 Thread Fredrik Tolf
Hi list! I'm relatively new to Python, and one thing I can't seem to get over is the lack of in-expression assignments, as present in many other languages. I'd really like to know how Python regulars solve the problems posed by that. For example, I recently wanted to do this: if callable(f =

Re: generators shared among threads

2006-03-05 Thread Alan Kennedy
[EMAIL PROTECTED] def f() i = 0 while True: yield i i += 1 g=f() If I pass g around to various threads and I want them to always be yielded a unique value, will I have a race condition? Yes. Generators can be shared between threads, but they cannot be resumed

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
H. Well, I don't know what else I could do, except for to write a function that doesn't require recursion. Still, 300 digits isn't too bad... I have also realized that if you try is_prime(3) it will return false. I'll have to work on it... Thanks for the help! --

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Astan Chee
Also you last code which looked like: def cran_rand(min,max): if(minmax): x=max max=min min=x range=round(log(max-min)/log(256)) if range==0: range=1 num=max+1 while(nummax): num=min+s2num(urandom(range)) return num what does s2num

Re: Inline assignments

2006-03-05 Thread Peter Hansen
Fredrik Tolf wrote: I'm relatively new to Python, and one thing I can't seem to get over is the lack of in-expression assignments, as present in many other languages. I'd really like to know how Python regulars solve the problems posed by that. For example, I recently wanted to do this:

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Yep, you guessed correctly about the s2num function, I knew I should have put a bit more.. It just converts an ascii string to a number, however many numbers that are nessicary. I could indeed check for all primes below a certain number, however, it still seems to run quite fast, at least to a 400

Re: Inline assignments

2006-03-05 Thread Duncan Booth
Fredrik Tolf wrote: However, since I can't do that in Python, I ended up using an extra local variable instead, like this: f = getattr(self, cmd_ + name) f2 = getattr(self, cmdv_ + name) if callable(f): # Do something with f elif callable(f2): # Do something with f2 If 'do

Why I chose Python over Ruby

2006-03-05 Thread Francois
I discovered Python a few months ago and soon decided to invest time in learning it well. While surfing the net for Python, I also saw the hype over Ruby and tried to find out more about it, before I definitely embarked on studying and practicing Python. I recently found two sufficient answers for

Re: Papers on Dynamic Languages

2006-03-05 Thread Jay Parlar
On Mar 4, 2006, at 3:00 PM, Paul Boddie wrote: I'd have a look at the following Python-related papers: Michael Salib's Starkiller paper (and presentation): http://www.python.org/pycon/dc2004/papers/1/ Mark Dufour's ShedSkin paper: http://kascade.org/optimizing_python.pdf John Aycock's

Re: Inline assignments

2006-03-05 Thread Alex Martelli
Fredrik Tolf [EMAIL PROTECTED] wrote: ... I'm relatively new to Python, and one thing I can't seem to get over is the lack of in-expression assignments, as present in many other languages. I'd really like to know how Python regulars solve the problems posed by that. In general, we've

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Astan Chee
Also I think the snippet code [p for p in range(2,N) if 0 not in [pow(w,p-1,p)==1 for w in [2, 3, 5, 7, 11] if pw]] is probably nicer to generate a list of primes for up to N (instead of hard coded) Aside from that looks nice. Thanks Tuvas wrote: Yep, you guessed correctly about the s2num

dual CPU-mode in python

2006-03-05 Thread Astan Chee
Hi, I have a python script which i convert to an executeable (using py2exe) and on a dual-cpu machine seems to be taking only 50% (1cpu) only. I was wondering if there is a way to maximize CPU usage without forking the function? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why I chose Python over Ruby

2006-03-05 Thread Sybren Stüvel
Francois wrote: I discovered Python a few months ago and soon decided to invest time in learning it well. While surfing the net for Python, I also saw the hype over Ruby and tried to find out more about it, before I definitely embarked on studying and practicing Python. I recently found two

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Actually, it wasn't very nice, it returned composites instead of primes... There was alot of little bugs, I'm glad I checked it again. The new code once again is uploaded, the previews are on their way... I did set up a system to check for primality up to 1000, I think any more than that and it

Re: Why I chose Python over Ruby

2006-03-05 Thread Alex Martelli
Francois [EMAIL PROTECTED] wrote: Since I did a lot of work in Scheme, rigor and consistency are most important to me, and Python certainly meets this requirement. It does pretty well, with some tempering of pragmatism -- but, to play devil's advocate, Ruby isn't far in this respect. In either

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Although, I have to brag quickly, adding in this simple prime check speed up the algorithm to the point that it's actually faster to find a prime number with my program than to verify a number prime with GP/PARI, so, I feel good. -- http://mail.python.org/mailman/listinfo/python-list

Re: Inline assignments

2006-03-05 Thread Steven D'Aprano
On Sun, 05 Mar 2006 15:09:28 +0100, Fredrik Tolf wrote: Hi list! I'm relatively new to Python, and one thing I can't seem to get over is the lack of in-expression assignments, as present in many other languages. I'd really like to know how Python regulars solve the problems posed by that.

Re: How to except the unexpected?

2006-03-05 Thread Scott David Daniels
Rene Pijlman wrote: Steven D'Aprano: The OP is doing it because catching all exceptions masks bugs. There are certain exceptions which should be allowed through, as they indicate a bug in the OP's code. Normally the tactic is to catch only the exceptions you are interested in, and let

Re: raw strings and \

2006-03-05 Thread plahey
Hi Duncan, thanks for the reply. I figured that this was a technical problem associated with the parser. This one is going on my Python gotchas list. It is really silly from an end user perspective to have \ not special in raw strings _except_ if it is the last character. --

Re: lists: += vs. .append() oddness with scope of variables

2006-03-05 Thread Scott David Daniels
Duncan Booth wrote: Sandro Dentella wrote: I'd like to understand why += operator raises an error while .append() does not. My wild guess is the parses treats them differently but I cannot understand why this depends on scope of the variables (global or class variables): Any

testing for existence of compilers/executables

2006-03-05 Thread John
I am working with my build system using scons. I would like to test the existence of 'doxygen' or any other compiler/executable in the path (like gcc/icc/...) What is the most efficient way to find this out using python? using scons? Is there a way to list all C/C++/fortran compilers available on

Re: Papers on Dynamic Languages

2006-03-05 Thread gene tani
Jay Parlar wrote: All that looks fantastic, and I'd forgotten there was a paper on Shedskin. Thanks a bunch, Jay P. lots of spirited discussion at artima http://www.artima.com/forums/flat.jsp?forum=106thread=7590 http://c2.com/cgi/wiki?DuckTyping http://lambda-the-ultimate.org/node/1319

Re: dual CPU-mode in python

2006-03-05 Thread Steve Holden
Astan Chee wrote: Hi, I have a python script which i convert to an executeable (using py2exe) and on a dual-cpu machine seems to be taking only 50% (1cpu) only. I was wondering if there is a way to maximize CPU usage without forking the function? Thanks Python has a global interpreter

Re: raw strings and \

2006-03-05 Thread Alex Martelli
[EMAIL PROTECTED] wrote: Hi Duncan, thanks for the reply. I figured that this was a technical problem associated with the parser. This one is going on my Python gotchas list. It is really silly from an end user perspective to have \ not special in raw strings _except_ if it is the

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Bryan Olson
Tuvas wrote: Okay, I don't know if your farmiliar with the miller-rabin primality test, Paul is familiar with it. When he referred to your Miller-Rabin test, he meant all the rounds. but it's what's called a probabalistic test. Meaning that trying it out once can give fake results. In the

Re: raw strings and \

2006-03-05 Thread Blackbird
[EMAIL PROTECTED] wrote: Hi Duncan, thanks for the reply. I figured that this was a technical problem associated with the parser. This one is going on my Python gotchas list. It is really silly from an end user perspective to have \ not special in raw strings _except_ if it is the last

Re: raw strings and \

2006-03-05 Thread Steven D'Aprano
On Sun, 05 Mar 2006 08:27:31 -0800, plahey wrote: Hi Duncan, thanks for the reply. I figured that this was a technical problem associated with the parser. This one is going on my Python gotchas list. It is really silly from an end user perspective to have \ not special in raw strings

Re: How to except the unexpected?

2006-03-05 Thread plahey
Yes, and that's the Right Thing(tm) to do. Source code don't lie. Source code don't get out of sync. So source code *is* the best documentation (or at least the most accurate). I could not disagree more strongly with this. Not just no, but hell no! Yes, and that's the Right Thing(tm) to do.

Re: dual CPU-mode in python

2006-03-05 Thread Fredrik Lundh
Astan Chee wrote: I have a python script which i convert to an executeable (using py2exe) and on a dual-cpu machine seems to be taking only 50% (1cpu) only. I was wondering if there is a way to maximize CPU usage without forking the function? it depends on what your script is doing. the GIL

Re: raw strings and \

2006-03-05 Thread plahey
Hi, thanks for the reply. I was not aware of this in raw strings (and frankly, don't like it... but who cares about that :-) ) When I needed embedded quotes in a raw string I went the triple quote route: a = r'''check \' this''' which makes more sense to me. --

Re: raw strings and \

2006-03-05 Thread plahey
Hi Alex, thanks for the reply. I can see that there is a choice that needed to be made. Before I was aware of the \ issue I just used (yes it has come up, but the example is at work) triple quotes to work around the embedded quote issue: x=r'''It's like this c:\blah\ ok?''' print x It's like

Re: raw strings and \

2006-03-05 Thread plahey
Hi Steven, thanks for the reply. I was/am aware that raw strings are mainly used for regular expressions (and franky that was I usually use them for). I was not aware that they still have special powers in raw strings (thanks for the link!). This one bit me when I was doing some quick and dirty

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
Alex Martelli wrote: I also share your preference for a single namespace for callable and non-callable values, as in Python (and Scheme, Lisp, C++, ...), rather than disjoint namespaces as in Ruby (and Smalltalk), but I do not see it as a question of rigor and consistency at all -- e.g., I do

Re: Why I chose Python over Ruby

2006-03-05 Thread [EMAIL PROTECTED]
Francois wrote: I discovered Python a few months ago and soon decided to invest time in learning it well. While surfing the net for Python, I also saw the hype over Ruby and tried to find out more about it, before I definitely embarked on studying and practicing Python. I recently found two

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
[EMAIL PROTECTED] wrote: What happened to 3)? 4) should have read 3). I found the typo after I posted. I guess I lack rigor myself ! -- http://mail.python.org/mailman/listinfo/python-list

Re: dual CPU-mode in python

2006-03-05 Thread Rene Pijlman
Astan Chee: I was wondering if there is a way to maximize CPU usage Fork a Java app :-) -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Robert Kern wrote: 1. Write grant proposals. 2. Advise and teach students. Sorry I forgot the part about writing grant applications. As for teaching students, I have thankfully not been bothered with that too much. Yes, and this is why you will keep saying, My simulation is running too

Python version of XMLUnit?

2006-03-05 Thread Kent Johnson
I have found XMLUnit to be very helpful for testing Java and Jython code that generates XML. At its heart XMLUnit is an XML-aware diff - it parses expected and actual XML and pinpoints any differences. It is smart enough to ignore things like attribute order, different quoting and escaping

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
David Treadwell wrote: My ability to think of data structures was stunted BECAUSE of Fortran and BASIC. It's very difficult for me to give up my bottom-up programming style, even though I write better, clearer and more useful code when I write top-down. That is also the case with Matlab,

Re: is there such a built-in funciton, similar to filter

2006-03-05 Thread Terry Reedy
Michael Hoffman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] wcc wrote: Beginner learning Python here. I know filter(lambda x: x 3, [1, 2, 5, -3, 4, 8]) will give me a list [5, 4, 8]. What if I only need to find the first item in the list that returns Ture when applying the

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Bryan Olson wrote: Tuvas wrote: Okay, I don't know if your farmiliar with the miller-rabin primality test, Paul is familiar with it. When he referred to your Miller-Rabin test, he meant all the rounds. but it's what's called a probabalistic test. Meaning that trying it out once can

Re: Why I chose Python over Ruby

2006-03-05 Thread Francois
Alex Martelli wrote: I also share your preference for a single namespace for callable and non-callable values, as in Python (and Scheme, Lisp, C++, ...), rather than disjoint namespaces as in Ruby (and Smalltalk), but I do not see it as a question of rigor and consistency at all -- e.g., I do

Re: Python advocacy in scientific computation

2006-03-05 Thread Michael Tobis
$ rm `find . -name *.pyc` Ouch. Is that a true story? While we're remeniscing about bad typos and DEC, I should tell the story about the guy who clobberred his work because his English wasn't very strong. Under RT-11, all file management was handled by a program called PIP. For example to

what am I missing (syntax error)

2006-03-05 Thread orangeDinosaur
Here's a section of code: for x in occupants: if x not in uniqueUsers and not in staff: uniqueUsers.append(x) elif x in staff and not in uniqueStaff: uniqueStaff.append(x) When I try to import the module with the function definition that

Re: lists: += vs. .append() oddness with scope of variables

2006-03-05 Thread Terry Reedy
Sandro Dentella [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'd like to understand why += operator raises an error while .append() does not. Your mistake is thinking of '+=' as an operator. In Python terms it is not, any more than '=' is. In Python, neither 'a=b' nor 'a+=b'

Re: raw strings and \

2006-03-05 Thread Alex Martelli
[EMAIL PROTECTED] wrote: thanks for the reply. I can see that there is a choice that needed to be made. Before I was aware of the \ issue I just used (yes it has come up, but the example is at work) triple quotes to work around the embedded quote issue: x=r'''It's like this c:\blah\

Re: Why I chose Python over Ruby

2006-03-05 Thread Alex Martelli
Francois [EMAIL PROTECTED] wrote: ... I guess my choice of words rigor and consistency was not very good. In this context rigor meant enforcing rules (for example having to use parentheses to call a method) to prevent ambiguity rather than depending on heuristics. Also consistency meant

Re: Why I chose Python over Ruby

2006-03-05 Thread Alex Martelli
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ... 1) In Ruby there is a risk of Variable/Method Ambiguity when calling ... 2) Ruby does not have true first-class functions living in the same ... 4) Conclusion ... What happened to 3)? I thought the OP was counting up by powers of 2

Re: Python advocacy in scientific computation

2006-03-05 Thread Robert Kern
Michael Tobis wrote: $ rm `find . -name *.pyc` Ouch. Is that a true story? Yup. Fortunately, it was a small, purely personal project, so it was no huge loss. It was enough for me to start using CVS on my small, purely personal projects, though! -- Robert Kern [EMAIL PROTECTED] I have come

Re: what am I missing (syntax error)

2006-03-05 Thread James Thiele
Try: for x in occupants: if x not in uniqueUsers and x not in staff: uniqueUsers.append(x) elif x in staff and x not in uniqueStaff: uniqueStaff.append(x) -- http://mail.python.org/mailman/listinfo/python-list

Re: what am I missing (syntax error)

2006-03-05 Thread Alex Martelli
orangeDinosaur [EMAIL PROTECTED] wrote: Here's a section of code: for x in occupants: if x not in uniqueUsers and not in staff: uniqueUsers.append(x) elif x in staff and not in uniqueStaff: uniqueStaff.append(x) When I try to import the module with the function definition that

Re: what am I missing (syntax error)

2006-03-05 Thread Gerard Flanagan
orangeDinosaur wrote: Here's a section of code: for x in occupants: if x not in uniqueUsers and not in staff: uniqueUsers.append(x) elif x in staff and not in uniqueStaff: uniqueStaff.append(x) When I try to import the module with the

Re: what am I missing (syntax error)

2006-03-05 Thread Jorge Godoy
orangeDinosaur [EMAIL PROTECTED] writes: Here's a section of code: for x in occupants: if x not in uniqueUsers and not in staff: uniqueUsers.append(x) elif x in staff and not in uniqueStaff: uniqueStaff.append(x) When I try to import the

beginner question on dinamin buiding of arg list

2006-03-05 Thread Sandro Dentella
I need to build-up an arg list to pass to a function. Suppose I have a dictionary: opts = { 'user' : 'jack', 'addr' : 'Green Str.'} and I want to build a cmd line like this: select( user='jack', addr='Green Str.' ) I'm clueless... TIA sandro *:-) -- Sandro Dentella *:-)

Re: Python advocacy in scientific computation

2006-03-05 Thread Alex Martelli
sturlamolden [EMAIL PROTECTED] wrote: just a toy. And as Matlab's run-time does reference counting insted of proper garbage collection, any datastructure more complex than arrays are sure to leak memory (I believe Python also suffered from this as some point). Yes, that was fixed in the move

Re: beginner question on dinamin buiding of arg list

2006-03-05 Thread Alex Martelli
Sandro Dentella [EMAIL PROTECTED] wrote: I need to build-up an arg list to pass to a function. Suppose I have a dictionary: opts = { 'user' : 'jack', 'addr' : 'Green Str.'} and I want to build a cmd line like this: select( user='jack', addr='Green Str.' ) select(**opts) should

Re: what am I missing (syntax error)

2006-03-05 Thread orangeDinosaur
OK, thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python advocacy in scientific computation

2006-03-05 Thread Robert Kern
Brian Blais wrote: Robert Kern wrote: That said, we have an excellent array object far superior to Matlab's. http://numeric.scipy.org/ I'd like to ask, being new to python, in which ways is this array object far superior to Matlab's? (I'm not being sarcastic, I really would like to

Separating elements from a list according to preceding element

2006-03-05 Thread Rob Cowie
I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a '-', if it is preceded by nothing, '+' is to be

Re: Python advocacy in scientific computation

2006-03-05 Thread Robert Kern
sturlamolden wrote: Robert Kern wrote: Yes, and this is why you will keep saying, My simulation is running too slowly, and My simulation is running out of memory. All the vectorization you do won't make a quadratic algorithm run in O(n log(n)) time. Knowing the right algorithm and the right

Re: django and mod_python

2006-03-05 Thread tgone
your suggestions worked. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Rob Cowie wrote: I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a '-', if it is preceded by

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Ben Cartwright
Rob Cowie wrote: I wish to derive two lists - each containing either tags to be included, or tags to be excluded. My idea was to take an element, examine what element precedes it and accordingly, insert it into the relevant list. However, I have not been successful. Is there a better way

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Gerard Flanagan wrote: Rob Cowie wrote: I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Robert Kern wrote: And you need to ask why Python is a better Matlab than Matlab? First there are a few things I don't like: 1. Intendation as a part of the syntax, really annoying. 2. The self.something syntax is really tedious (look to ruby)! 4. Multithreading and parallel execution is

Re: Separating elements from a list according to preceding element

2006-03-05 Thread James Stroud
Rob Cowie wrote: I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a '-', if it is preceded by

Re: Separating elements from a list according to preceding element

2006-03-05 Thread James Stroud
Gerard Flanagan wrote: Rob Cowie wrote: I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a '-', if it

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Bruno Desthuilliers
Rob Cowie a écrit : I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a '-', if it is preceded by

Re: Separating elements from a list according to preceding element

2006-03-05 Thread James Stroud
Bruno Desthuilliers wrote: Rob Cowie a écrit : I'm having a bit of trouble with this so any help would be gratefully recieved... After splitting up a url I have a string of the form 'tag1+tag2+tag3-tag4', or '-tag1-tag2' etc. The first tag will only be preceeded by an operator if it is a

Re: Python advocacy in scientific computation

2006-03-05 Thread Duncan Booth
sturlamolden wrote: First there are a few things I don't like: 1. Intendation as a part of the syntax, really annoying. Each to his own. I find having the compiler enforce indentation rules is a real benefit. There's nothing quite so annoying as having 'coding standards' you are supposed

  1   2   >