Re: Calculating md5 checksums.

2006-03-05 Thread Laszlo Zsolt Nagy
Rajesh Sathyamoorthy wrote: > I tried the script and had to get a hexdigest to get the value provided > > My test: > SimplyMEPIS-3.3.1-1.iso > checksum: 41a19060d3bb37bd596708ba77964491 > i got: 41a19060d3bb37bd596708ba77964491 > > Do people normally provide md5 checksum in a *hexadecimal string?

Re: Convert dictionary to HTTP POST

2006-03-05 Thread Laszlo Zsolt Nagy
>>The values of some inputs are encoded using html entities. >>How can I decode a string like "Bessy's cat" in "Bessy's cat"? >> >> > >this snippet might help: > >http://effbot.org/zone/re-sub.htm#strip-html > > Thank you, worked like a charm. :-) Laszlo -- http://mail.python.org/m

setting PYTHONPATH

2006-03-05 Thread anushya beauty
Hi,    Anybody, please help me to set PYTHONPATH to import my modules?. Where is sy.path set?In some python groups site, to import the user modules, they explained to  create one __init__.py file in my module directory (this file should include __all__ variable, which refer to the modules

Popup menus without an associated window

2006-03-05 Thread Rich Churcher
Is there a way using any of the Python UI toolkits to generate popup menus outside the context of an application? For example, middle-clicking on the desktop shows a list of shortcuts to choose from. Pointers to source examples would be appreciated. -- Cheers, Rich. -- http://mail.python.org/m

Re: re.search

2006-03-05 Thread Fredrik Lundh
Rares Vernica wrote: > Isn't the following code supposed to return ('1994')? > > >>> re.search('(\d{4})?', '4 1994').groups() > (None,) it's supposed to return the first thing that matches your pattern, which, in this case, is the empty string at the beginning of the target string. if you want

Re: re.search

2006-03-05 Thread James Stroud
Rares Vernica wrote: > Hi, > > Isn't the following code supposed to return ('1994')? > > >>> re.search('(\d{4})?', '4 1994').groups() > (None,) > > Thanks, > Ray The ? is allowing it to not match before it finds the 1994. Note: py> re.search('(\d{4})?', '1994 4').groups() ('1994',) James -

re.search

2006-03-05 Thread Rares Vernica
Hi, Isn't the following code supposed to return ('1994')? >>> re.search('(\d{4})?', '4 1994').groups() (None,) Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Tix Note Book

2006-03-05 Thread anil . pundoor
hi am using Tix notebook and i have two frames in that. am adding some widgets in to both of the frames. now i want to delete all of the widgets in one of the frame. i dont want to delete the frame, but its childres. so how can i get the sub widgets within that frame. Thanks in advance Anil --

Re: Python advocacy in scientific computation

2006-03-05 Thread Michael Tobis
1) indentation: I claim that this is a trivial matter. Indentation is enforced, but if you want to end all your blocks with #end, feel free. Or write a preprocessor to go from your preferred block style to python's 2) self.something tedious to look at. Again, you can somewhat work around this i

Re: raw strings and \

2006-03-05 Thread plahey
>Alas, somebody will now quote Emerson at you, I fear;-). Let them come :-) I almost always see this (mis)quoted as: "consistency is the hobgoblin of little minds" which is not really what Emerson said. The full quote is: "A foolish consistency is the hobgoblin of little minds" I would say t

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Okay, now I get the correct number of 561 pseudoprimes, 5, so I can assume that it is indeed working right. Whew. Thanks for the help on that one. Now, I only wish I could change the answer to my last homework assignment... Oh well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Ahh, I see, I missed doing the last step in my M-R test. Hmmm. Well, got that one fixed now, time for a new release I guess. Sigh. I do seem to be going through them rather quickly... -- http://mail.python.org/mailman/listinfo/python-list

Re: raw strings and \

2006-03-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: > 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 :-) ) > Healthy attitude! > When I needed embedded quotes in a raw string I went the triple quote > route: > > a = r'''check \' this''' > >

Re: Question re client/server and blocking

2006-03-05 Thread Bryan Olson
Frank Millman wrote: [...] > There is a server component and a client component. All the business > logic is performed on the server. Oh, what a give-away. If the logic is in the server, then the client component should probably be the user's chosen web browser. > The client communicates with

Re: Python advocacy in scientific computation

2006-03-05 Thread Steve Holden
sturlamolden wrote: > 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. > Troll. You think this is going away because *you* don't like it? Am

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread Kent Johnson
Paul Boddie wrote: > Yes, Python does this - it puts the directory of bar.py (B in this > case) in sys.path, but not the directory in which you're sitting when > you run the program from the shell (A in this case). This seems to be OS dependent. If I put 'print sys.path' at the start of site.py (

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread fortepianissimo
Paul Boddie wrote: > fortepianissimo wrote: > > Hm this doesn't work. Say I have the following directory structure: > > > > A > > |--- util > > ||--- foo.py > > | > > |--- B > > |--- bar.py > > > > > > And bar.py has this line > > > > from util import foo > > This would only work with A in

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Bryan Olson
Tuvas wrote: [...] > Actually, I did another test, and realized that it was indeed a bug in > the code. Yikes. Oh well, thanks for the help in identifying it! > > An example that would be alot easier is this: > Mod(16,561).is_strong_pseudo_prime() > > True Hmmm...my M-R tester disagrees...

Re: searching for the number of occurences of a string

2006-03-05 Thread marek . rocki
> hi; > say i have a text file with a string ( say '(XYZ)') and I want to find > the number of line where this string has occured. What is the best way > to do that? I would suggest: # Read file contents lines = file('filename.txt').readlines() # Extract first line number containing 'XYZ' string

Re: searching for the number of occurences of a string

2006-03-05 Thread James Stroud
M.N.A.Smadi wrote: > hi; > say i have a text file with a string ( say '(XYZ)') and I want to find > the number of line where this string has occured. What is the best way > to do that? > > what about if that string was say a 0 with leading and trailing white > spaces, would that be any differen

Re: searching for the number of occurences of a string

2006-03-05 Thread James Stroud
M.N.A.Smadi wrote: > hi; > say i have a text file with a string ( say '(XYZ)') and I want to find > the number of line where this string has occured. What is the best way > to do that? > > what about if that string was say a 0 with leading and trailing white > spaces, would that be any differen

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread fortepianissimo
Interesting - Python seems to act differently under Windows then. Here I'm using Python 2.4 on Mac OS X. With all of the files, directories and command exactly like yours, it's still not working. One thing I noticed is that you have this 'C:\\WUTemp\\A' when you print sys.path in B/bar.py, but min

searching for the number of occurences of a string

2006-03-05 Thread M.N.A.Smadi
hi; say i have a text file with a string ( say '(XYZ)') and I want to find the number of line where this string has occured. What is the best way to do that? what about if that string was say a 0 with leading and trailing white spaces, would that be any different? thanks moe smadi -- http://m

Re: Why I chose Python over Ruby

2006-03-05 Thread Roy Smith
Xavier Morel <[EMAIL PROTECTED]> wrote: > Francois wrote: > > 1) In Ruby there is a risk of "Variable/Method Ambiguity" when calling > > a method with no parameters without using () : > > > Yes, but that's in my opinion a programmer error, not necessarily a > language error. In Python, you can

Re: Python advocacy in scientific computation

2006-03-05 Thread Alex Martelli
Robert Kern <[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). > > Python st

Re: Opening files without closing them

2006-03-05 Thread Steven Bethard
Sandra-24 wrote: > I was reading over some python code recently, and I saw something like > this: > > contents = open(file).read() > > And of course you can also do: > > open(file, "w").write(obj) > > Why do they no close the files? Is this sloppy programming or is the > file automatically clos

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread Paul Boddie
fortepianissimo wrote: > Hm this doesn't work. Say I have the following directory structure: > > A > |--- util > ||--- foo.py > | > |--- B > |--- bar.py > > > And bar.py has this line > > from util import foo This would only work with A in sys.path/PYTHONPATH. However... > I then run > >

Re: Write a GUI for a python script?

2006-03-05 Thread Peter Decker
On 3/5/06, Bill Maxwell <[EMAIL PROTECTED]> wrote: > Thanks for the info. Knowing that, I was able to create a simple app in > the Dabo Designer that contains a Notebook. > > But, I'm having a heck of a time finding any documentation at all on > Dabo. I looked all thru the website(s), and have c

Re: Why I chose Python over Ruby

2006-03-05 Thread Terry Reedy
"Schüle Daniel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> block (Python forbids the rebinding of variables coming from an >> enclosing but non-global scope, to avoid facing this issue). > > I am not sure what you mean here > can you elaborate on this please > > >>> def a(): >

Re: Why I chose Python over Ruby

2006-03-05 Thread Xavier Morel
I'll just play the devil's advocate here Francois wrote: > 1) In Ruby there is a risk of "Variable/Method Ambiguity" when calling > a method with no parameters without using () : > Yes, but that's in my opinion a programmer error, not necessarily a language error. > 2) Ruby does not have true f

Re: Opening files without closing them

2006-03-05 Thread Robert Kern
Erik Max Francis wrote: > Robert Kern wrote: > >>>I usually use: >>> >>>try: >>> f = open(file) >>> contents = f.read() >>>finally: >>> f.close() >>> >>>But now I am wondering if that is the same thing. Which method would >>>you rather use? Why? >> >>Just keep doing what you are doing, please.

Re: Opening files without closing them

2006-03-05 Thread Erik Max Francis
Robert Kern wrote: >> I usually use: >> >> try: >> f = open(file) >> contents = f.read() >> finally: >> f.close() >> >> But now I am wondering if that is the same thing. Which method would >> you rather use? Why? > > Just keep doing what you are doing, please. Note quite. The assignment

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread Kent Johnson
fortepianissimo wrote: > Hm this doesn't work. Say I have the following directory structure: > A > |--- util > ||--- foo.py > | > |--- B > |--- bar.py > > And bar.py has this line > > from util import foo > > I then run > > python B/bar.py > > in directory A. Still got er

Re: Adding method at runtime - problem with self

2006-03-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > First of all, please don't flame me immediately. Granted - we'll do it later then !-) > I did browse archives > and didn't see any solution to my problem. > > Assume I want to add a method to an object at runtime. Yes, to an > object, not a class - because changing

Re: Python advocacy in scientific computation

2006-03-05 Thread Evan Monroig
> First there are a few things I don't like: Hi, I will respond to things that others haven't responded yet > 2. How good is matplotlib/pylab? I tried to install it but only get > error messages so I haven't tested it. But plotting capabilities is > really major issue. I don't know because I hav

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Michael Spencer
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 n

Re: Cryptographically random numbers

2006-03-05 Thread Tuvas
Good idea about the max and min values. Yes, urandom is os.urandom. s2num('blah') will convert the phrase blah to ascii, and treat them as if they were a big function. Anyone else whose still interested, I found another small bug, but it was in the modular (Again). It won't do much, but... I did

Re: Python advocacy in scientific computation

2006-03-05 Thread sturlamolden
Dennis Lee Bieber wrote: > > 1. Can python do "pass by reference"? Are datastructures represented by > > references as in Java (I don't know yet). > > > Everything in Python is a reference to an object. I think the > question you want is more on the lines of: Can I change an object that > ha

Re: Package organization: where to put 'common' modules?

2006-03-05 Thread fortepianissimo
Hm this doesn't work. Say I have the following directory structure: A |--- util ||--- foo.py | |--- B |--- bar.py And bar.py has this line from util import foo I then run python B/bar.py in directory A. Still got error ImportError: No module named util A check of sys.path in bar

Re: Opening files without closing them

2006-03-05 Thread Bruno Desthuilliers
Sandra-24 a écrit : > I was reading over some python code recently, and I saw something like > this: > > contents = open(file).read() > > And of course you can also do: > > open(file, "w").write(obj) > > Why do they no close the files? Is this sloppy programming or is the > file automatically c

Re: Write a GUI for a python script?

2006-03-05 Thread Bill Maxwell
On Sat, 4 Mar 2006 13:08:35 -0500, "Peter Decker" <[EMAIL PROTECTED]> wrote: >On 3/4/06, Bill Maxwell <[EMAIL PROTECTED]> wrote: > >> Dabo does look really nice, but seems like it has a ways to go yet. >> >> I downloaded it a couple of weeks ago, and the very first thing I wanted >> to do doesn't

Re: The old round off problem?

2006-03-05 Thread David Treadwell
On Mar 5, 2006, at 1:01 AM, sam wrote:David Treadwell wrote: exp(x) is implemented by:1.  reducing x into the range |r| <=  0.5 * ln(2), such that x = k *ln(2) + r2.  approximating exp(r) with a fifth-order polynomial,3.  re-scaling by multiplying by 2^k: exp(x) = 2^k * exp(r)sinh(x) is mathematica

Re: Opening files without closing them

2006-03-05 Thread Marcin Mielżyński
Marcin Mielżyński wrote: > Sandra-24 wrote: >> I was reading over some python code recently, and I saw something like >> this: >> >> contents = open(file).read() >> >> And of course you can also do: >> >> open(file, "w").write(obj) >> >> Why do they no close the files? Is this sloppy programming or

Re: Adding method at runtime - problem with self

2006-03-05 Thread Jay Parlar
On Mar 5, 2006, at 2:30 PM, Marek wrote: > Assume I want to add a method to an object at runtime. Yes, to an > object, not a class - because changing a class would have global > effects and I want to alter a particular object only. The following > approach fails: > > class kla: > x = 1 > > de

Re: Opening files without closing them

2006-03-05 Thread Robert Kern
Sandra-24 wrote: > I was reading over some python code recently, and I saw something like > this: > > contents = open(file).read() > > And of course you can also do: > > open(file, "w").write(obj) > > Why do they no close the files? Is this sloppy programming or is the > file automatically clos

Re: Opening files without closing them

2006-03-05 Thread Marcin Mielżyński
Sandra-24 wrote: > I was reading over some python code recently, and I saw something like > this: > > contents = open(file).read() > > And of course you can also do: > > open(file, "w").write(obj) > > Why do they no close the files? Is this sloppy programming or is the > file automatically clos

Opening files without closing them

2006-03-05 Thread Sandra-24
I was reading over some python code recently, and I saw something like this: contents = open(file).read() And of course you can also do: open(file, "w").write(obj) Why do they no close the files? Is this sloppy programming or is the file automatically closed when the reference is destroyed (aft

Re: Why I chose Python over Ruby

2006-03-05 Thread Marcin Mielżyński
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: Separating elements from a list according to preceding element

2006-03-05 Thread Bruno Desthuilliers
Gerard Flanagan a écrit : > Alex Martelli wrote: > >>Gerard Flanagan <[EMAIL PROTECTED]> wrote: >>... >> >>>a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ] >>> >>>import itertools >>> >>>b = list(itertools.islice(a,0,8,2)) >>>c = list(itertools.islice(a,1,8,2)) >> >>Much as I love i

Re: Adding method at runtime - problem with self

2006-03-05 Thread Schüle Daniel
[EMAIL PROTECTED] wrote: > First of all, please don't flame me immediately. I did browse archives > and didn't see any solution to my problem. > > Assume I want to add a method to an object at runtime. Yes, to an > object, not a class - because changing a class would have global > effects and I wa

Adding method at runtime - problem with self

2006-03-05 Thread marek . rocki
First of all, please don't flame me immediately. I did browse archives and didn't see any solution to my problem. Assume I want to add a method to an object at runtime. Yes, to an object, not a class - because changing a class would have global effects and I want to alter a particular object only.

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Paul McGuire
"Rob Cowie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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

Re: Why I chose Python over Ruby

2006-03-05 Thread Schüle Daniel
Hi Alex [...] > The trick about distinguishing a name's exact nature based on whether > the compiler sees an assignment to that name in some part of code is > found in both languages, albeit in different ways. In Ruby, as you've > pointed out, it's the heuristic used to disambiguate local variabl

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
Alex Martelli wrote: > Gerard Flanagan <[EMAIL PROTECTED]> wrote: > ... > > a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ] > > > > import itertools > > > > b = list(itertools.islice(a,0,8,2)) > > c = list(itertools.islice(a,1,8,2)) > > Much as I love itertools, this specific task wo

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Gerard Flanagan
James Stroud wrote: > 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 >

Re: Cryptographically random numbers

2006-03-05 Thread Emile van Sebille
> def cran_rand(min,max): You're shadowing built-ins here. Not a problem, but something I'd generally avoid. >if(min>max): >x=max >max=min >min=x If the args were a,b you could say: maxarg,minarg = min(a,b),max(a,b) >range=round(log(max-min)/log(256)) more

Re: Argument Precedence (possible bug?)

2006-03-05 Thread Terry Reedy
"vbgunz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all, > > I am just learning Python and have come across something I feel might > be a bug. I feel it is more likely that there in a bug in the communication process from the manual to you, on an admittedly somewhat con

Re: django and mod_python

2006-03-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > 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.con

Re: Separating elements from a list according to preceding element

2006-03-05 Thread Alex Martelli
Gerard Flanagan <[EMAIL PROTECTED]> wrote: ... > a = [ '+', 'tag1', '+', 'tag2', '-', 'tag3', '+', 'tag4' ] > > import itertools > > b = list(itertools.islice(a,0,8,2)) > c = list(itertools.islice(a,1,8,2)) Much as I love itertools, this specific task would be best expressed ad b = a[::2] c

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

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 operato

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 b

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

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 n

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 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 i

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 wa

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 n

Re: django and mod_python

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

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

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 assumed.

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

Re: what am I missing (syntax error)

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

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(**opt

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

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 *:-) http://www.t

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 im

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 th

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 th

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: 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 hav

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 p

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

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:\bl

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

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 contains

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

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.,

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 ou

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 a

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 Matla

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 styl

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 t

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: 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: 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 tw

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.,

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 dirt

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, 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. -- http://mail.python.org/mailman

  1   2   >