Re: elegant python style for loops

2007-05-09 Thread Asun Friere
On May 10, 4:20 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > for a, b in zip(lista, listb): > ... You don't even need the for loop nowadays. Just pass the zipped list to a dictionary constructor thusly: newdict = dict(zip(listKeys,listValues)) Asun -- http://mail.python.org/mailman

Re: change of random state when pyc created??

2007-05-09 Thread Raymond Hettinger
On May 9, 6:42 am, "Alan Isaac" <[EMAIL PROTECTED]> wrote: > Is there > a warning anywhere in the docs? Should > there be? I do not think additional documentation here would be helpful. One could note that the default hash value is the object id. Somewhere else you could write that the placement

Re: Minor bug in tempfile module (possibly __doc__ error)

2007-05-09 Thread James T. Dennis
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, James T. Dennis wrote: >> Tonight I discovered something odd in the __doc__ for tempfile >> as shipped with Python 2.4.4 and 2.5: it says: >> >> This module also provides some data items to the user: >> >>

Re: Minor bug in tempfile module (possibly __doc__ error)

2007-05-09 Thread James T. Dennis
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 09 May 2007 06:50:38 -, "James T. Dennis" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: >> In fact I realized, after reading through tempfile.py in /usr/lib/... >> that the following also doesn't "work" like I'd exp

Re: Erlang style processes for Python

2007-05-09 Thread Jacob Lee
On Wed, 09 May 2007 18:16:32 -0700, Kay Schluehr wrote: > Every once in a while Erlang style [1] message passing concurrency [2] > is discussed for Python which does not only imply Stackless tasklets [3] > but also some process isolation semantics that lets the runtime easily > distribute tasklets

Re: elegant python style for loops

2007-05-09 Thread Peter Otten
[EMAIL PROTECTED] wrote: > To step through a list, the python style is avoid an explicit index. > But what if the same hidden index is to be used for more than one list > > for example:- > for key,value in listKeys,listValues : > newdict[key]=value > > won't work as it is a tuple of lists,

Re: elegant python style for loops

2007-05-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > To step through a list, the python style is avoid an explicit index. > But what if the same hidden index is to be used for more than one list > > for example:- > for key,value in listKeys,listValues : > newdict[key]=value > > won't work as it is a tuple of lists

Re: elegant python style for loops

2007-05-09 Thread Gary Herron
[EMAIL PROTECTED] wrote: > To step through a list, the python style is avoid an explicit index. > But what if the same hidden index is to be used for more than one list > > for example:- > for key,value in listKeys,listValues : > newdict[key]=value > > won't work as it is a tuple of lists, as

Re: preferred windows text editor?

2007-05-09 Thread Flavio Preto
I use VIM here too. Mainly because i always switch from Windows to Linux and using the same text editor is a way to avoid getting crazy. []'s Preto On 9 May 2007 15:21:41 -0700, BartlebyScrivener <[EMAIL PROTECTED]> wrote: On May 9, 1:26 pm, "Looney, James B" <[EMAIL PROTECTED]> wrote: > I'm

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I was simply pointing out all the ways in which you made it difficult for the > community to explain your problem. And without that community, I would still not have a clue. Thanks to all! > Please feel free to suggest

elegant python style for loops

2007-05-09 Thread ian . team . python
To step through a list, the python style is avoid an explicit index. But what if the same hidden index is to be used for more than one list for example:- for key,value in listKeys,listValues : newdict[key]=value won't work as it is a tuple of lists, as opposed to a list of tuples. Is there

Re: replacing string in xml file

2007-05-09 Thread Gabriel Genellina
En Thu, 10 May 2007 01:55:25 -0300, <[EMAIL PROTECTED]> escribió: >> I am opening 2 more files in addition to the file >> where the new xml goes.One file is written using the sys.stdout >> command as most of the output has to go there printing takes place in >> many places (so

Re: change of random state when pyc created??

2007-05-09 Thread Steven D'Aprano
On Wed, 09 May 2007 23:10:19 -0500, Robert Kern wrote: > Steven D'Aprano wrote: >> On Wed, 09 May 2007 21:18:25 -0500, Robert Kern wrote: >> >>> Actually, the root cause of Peter's specific example is the fact that the >>> default implementation of __hash__() and __eq__() rely on identity >>> co

Re: preferred windows text editor?

2007-05-09 Thread JussiJ
On May 10, 4:06 am, "T. Crane" <[EMAIL PROTECTED]> wrote: > Right now I'm using Notepad++. What are other people using? Zeus: http://www.zeusedit.com -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Steven D'Aprano
On Thu, 10 May 2007 01:06:33 -0400, Carsten Haese wrote: > On Thu, 10 May 2007 12:46:05 +1000, Steven D'Aprano wrote >> It is natural to expect two runs of any program to give the same >> result if there are (1) no random numbers involved; (2) the same >> input data; (3) and no permanent storage

Re: PYDOC replacement. (Was:Sorting attributes by catagory)

2007-05-09 Thread Ron Adam
Nick Vatamaniuc wrote: > Ron, > > Consider using epydoc if you can. Epydoc will sort the methods and it > will also let you use custom CSS style sheets for the final HTML > output. Check out the documentation of my PyDBTable module. > http://www.psipy.com/PyDBTable > > -Nick Vatamaniuc Hi Nick

Re: change of random state when pyc created??

2007-05-09 Thread Carsten Haese
On Thu, 10 May 2007 12:46:05 +1000, Steven D'Aprano wrote > It is natural to expect two runs of any program to give the same > result if there are (1) no random numbers involved; (2) the same > input data; (3) and no permanent storage from run to run. Which of those three categories does time.ti

Re: replacing string in xml file

2007-05-09 Thread saif . shakeel
On May 9, 4:39 pm, [EMAIL PROTECTED] wrote: > On May 8, 4:46 pm, [EMAIL PROTECTED] wrote: > > > > > > > On May 8, 4:30 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > > [EMAIL PROTECTED] schrieb: > > > > > Hi, > > > > I need to replace a string in xml file with something else.Ex > > > > > -

Re: change of random state when pyc created??

2007-05-09 Thread Carsten Haese
On Thu, 10 May 2007 02:50:49 GMT, Alan Isaac wrote > "Carsten Haese" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Knowing that maps don't have reproducible ordering is one thing. > > Realizing that that's the cause of the problem that's arbitrarily and > > wrongly attributed to

Re: change of random state when pyc created??

2007-05-09 Thread Robert Kern
Steven D'Aprano wrote: > On Wed, 09 May 2007 21:18:25 -0500, Robert Kern wrote: > >> Actually, the root cause of Peter's specific example is the fact that the >> default implementation of __hash__() and __eq__() rely on identity >> comparisons. >> Two separate invocations of the same script give

EOL character

2007-05-09 Thread HMS Surprise
I have two files apparently identical until I open them with winMerge which reports that they use different EOL characters. They are both jython scripts built using the maxq tool. When the one would not work I stripped it down to bare minimums and then duplicated it. The duplicate works, the origin

Re: interesting exercise

2007-05-09 Thread castironpi
On May 9, 7:49 pm, Charles Sanders <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]> > > wrote: > [snip] > >> or even this monstrosity ... > > >> def permute2( s, n ): > >>return [ ''.join([ s[int(i/len(s)**j)%len(s)] > >> for

Re: WSGI spec clarification regarding exceptions

2007-05-09 Thread Graham Dumpleton
On May 10, 12:07 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On May 10, 8:26 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > > > I'm trying to figure out if there's any defined behaviour in PEP 333 > > for instances where an application returns an iterable as usual > > without error, but that ite

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
"Carsten Haese" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Knowing that maps don't have reproducible ordering is one thing. > Realizing that that's the cause of the problem that's arbitrarily and > wrongly attributed to the 'random' module, in a piece of code that's not > posted

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Actually, the root cause of Peter's specific example is the fact that the > default implementation of __hash__() and __eq__() rely on identity comparisons. > Two separate invocations of the same script give different objec

Re: change of random state when pyc created??

2007-05-09 Thread Steven D'Aprano
On Wed, 09 May 2007 21:18:25 -0500, Robert Kern wrote: > Actually, the root cause of Peter's specific example is the fact that the > default implementation of __hash__() and __eq__() rely on identity > comparisons. > Two separate invocations of the same script give different objects by identity >

Re: change of random state when pyc created??

2007-05-09 Thread Steven D'Aprano
On Wed, 09 May 2007 16:01:02 -0500, Robert Kern wrote: > Alan G Isaac wrote: >> Robert Kern wrote: >>> http://docs.python.org/lib/typesmapping.html >>> """ >>> Keys and values are listed in an arbitrary order which is non-random, varies >>> across Python implementations, and depends on the diction

Re: change of random state when pyc created??

2007-05-09 Thread Carsten Haese
On Thu, 2007-05-10 at 01:25 +, Alan Isaac wrote: > Did this thread not demonstrate that even sophisticated users > do not see into this "implication" immediately? Knowing that maps don't have reproducible ordering is one thing. Realizing that that's the cause of the problem that's arbitrarily

Re: Checking if string inside quotes?

2007-05-09 Thread castironpi
On May 9, 8:48 pm, [EMAIL PROTECTED] wrote: > On May 9, 2:31 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > > > > > Thanks, but it is a little more complicated than that, > > the string could be deep in quotes. > > >The problem is in string substitution. > > Suppose I have a dictionary w

Re: change of random state when pyc created??

2007-05-09 Thread Robert Kern
Alan Isaac wrote: >>> Robert Kern wrote: http://docs.python.org/lib/typesmapping.html """ Keys and values are listed in an arbitrary order which is non-random, > varies across Python implementations, and depends on the dictionary's history > of insertions and deletions. >>>

Re: Parameter checking on an interfase

2007-05-09 Thread w . m . gardella . sambeth
On 9 mayo, 17:42, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > > > Hi all, > > I am more or less new to Python, and currently am making my > > first "serious" program. The application is a Clinical History manager > > (for my wife) which stores its data

Re: WSGI spec clarification regarding exceptions

2007-05-09 Thread Graham Dumpleton
On May 10, 8:26 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > I'm trying to figure out if there's any defined behaviour in PEP 333 > for instances where an application returns an iterable as usual > without error, but that iterable's next() method eventually raises an > exception. Since any data ther

Re: path stuff

2007-05-09 Thread Gabriel Genellina
En Wed, 09 May 2007 15:11:06 -0300, fscked <[EMAIL PROTECTED]> escribió: > I am walking some directories looking for a certain filename pattern. > This part works fine, but what if I want to exclude results from a > certain directory being printed? Using os.walk you can skip undesired directori

Re: Checking if string inside quotes?

2007-05-09 Thread half . italian
On May 9, 2:31 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > Thanks, but it is a little more complicated than that, > the string could be deep in quotes. > >The problem is in string substitution. > Suppose I have a dictionary with MY_IP : "172.18.51.33" > > I need to replace all insta

file uploader

2007-05-09 Thread Sick Monkey
Hey guys. I wanted to write a little desktop application that would upload files to an external server, to a specific directory. The desktop application is running on Mac OS X and I built a .psp script that is running on a Red Hat server. NOTE: This application is written for Python 2.5 (both p

Re: Single precision floating point calcs?

2007-05-09 Thread Grant Edwards
On 2007-05-09, Robert Kern <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> I'm pretty sure the answer is "no", but before I give up on the >> idea, I thought I'd ask... >> >> Is there any way to do single-precision floating point >> calculations in Python? >> >> I know the various array m

Re: change of random state when pyc created??

2007-05-09 Thread Alan Isaac
>> Robert Kern wrote: >>> http://docs.python.org/lib/typesmapping.html >>> """ >>> Keys and values are listed in an arbitrary order which is non-random, varies >>> across Python implementations, and depends on the dictionary's history of >>> insertions and deletions. >>> """ > Alan G Isaac wrote:

Re: Single precision floating point calcs?

2007-05-09 Thread Grant Edwards
On 2007-05-09, Terry Reedy <[EMAIL PROTECTED]> wrote: >| I'm pretty sure the answer is "no", but before I give up on the >| idea, I thought I'd ask... >| >| Is there any way to do single-precision floating point >| calculations in Python? > > Make your own Python build from altered source. And ru

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: ... > > .append - easy to measure, too: > > > > brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x.append(n)' > > 100 loops, best of 3: 1.31 usec per loop > > > > brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x+=[n]' > > 100 loops, be

Erlang style processes for Python

2007-05-09 Thread Kay Schluehr
Every once in a while Erlang style [1] message passing concurrency [2] is discussed for Python which does not only imply Stackless tasklets [3] but also some process isolation semantics that lets the runtime easily distribute tasklets ( or logical 'processes' ) across physical processes. Syntactica

Re: interesting exercise

2007-05-09 Thread Charles Sanders
[EMAIL PROTECTED] wrote: > On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]> > wrote: [snip] >> or even this monstrosity ... >> >> def permute2( s, n ): >>return [ ''.join([ s[int(i/len(s)**j)%len(s)] >> for j in range(n-1,-1,-1)]) >>for i in range(len(s)**n) ] >> >> print "pe

Re: File I/O

2007-05-09 Thread Klaas
On May 9, 2:43 pm, HMS Surprise <[EMAIL PROTECTED]> wrote: > > [lst.append(list(line.split())) for line in file] > > Thanks, this is the direction I wanted to go, BUT I must use v2.2 so > the line above gives me the error: > > AttributeError: __getitem__ > > But the write format will be helpful. (

The odius and RACISTS WASPS of FBI can ONLY STING FOOLISH PATSIES, When will these INCOMPETENTOS catch the YANK ANTHRAX MAILER ? Re: *** Secret Technical Papers, dont tell the FBI ***

2007-05-09 Thread lemnitzer
The ODIOUS WASPs of FBI (FEDERAL BUREAU OF INCOMPETENCE) can ONLY S-T- I-N-G. WASPS ONLY STING WASPS ONLY STING The fact is that the ANTHRAX mailer was a WASP BASTARD being covered up by the YANK Bastards at FBI. Mueller is DAMN Incompetent and Coward. Bush's Crimes against the Nation tower far h

Re: Sorting attributes by catagory

2007-05-09 Thread Nick Vatamaniuc
On May 9, 11:32 am, Ron Adam <[EMAIL PROTECTED]> wrote: > This is for a new version of pydoc if I can get the class attributes sorted > out. The module level attributes aren't too difficult to categorize. > > (I might be just too tired to see the obvious.) > > The original pydoc did this a somewha

Re: Questions about bsddb

2007-05-09 Thread Nick Vatamaniuc
On May 9, 4:01 pm, [EMAIL PROTECTED] wrote: > Thanks for the info Nick. I plan on accessing the data in pretty much > random order, and once the database is built, it will be read only. > At this point Im not too concerned about access times, just getting > something to work. I've been messing arou

Change serial timeout per read

2007-05-09 Thread rowan
I'm writing a driver in Python for an old fashioned piece of serial equipment. Currently I'm using the USPP serial module. From what I can see all the serial modules seem to set the timeout when you open a serial port. This is not what I want to do. I need to change the timeout each time I do a "r

Re: e-mailing multiple values

2007-05-09 Thread axjacob
Since e-mail requires a string. Here is what I could do. list.append(item1) list.append(item2) finalstr = ''.join(list) return finalstr -- Original message -- From: "Gabriel Genellina" <[EMAIL PROTECTED]> > En Tue, 08 May 2007 20:19:22 -0300, Ian Clark <[EMAIL PR

Re: CPU usage.

2007-05-09 Thread Gabriel Genellina
En Wed, 09 May 2007 02:58:45 -0300, Navid Parvini <[EMAIL PROTECTED]> escribió: > I want to get the CPU usage in my code. > Is there any module in Python to get it? > Also I want to get in on Windows and Linux. On Windows you can use WMI; Tim Golden made an excellent library that let's yo

*** Secret Technical Papers, dont tell the FBI ***

2007-05-09 Thread thermate
Can anyone upload these seminal papers on the internet? Send them to City police chiefs, City officials, Mayors, Congressmen, District Judges, Federal Judges, Supreme court judges, FBI Incompetentos, CIA Bastards, Opus Dei, The Pope, Hollywood, President Vladimir Putin, Hugo Chavez, Dr. Fidel Castr

Re: Behavior of mutable class variables

2007-05-09 Thread castironpi
On May 9, 5:49 pm, [EMAIL PROTECTED] wrote: > Thanks for the insights. I solved the problem as follows: I created a > new class method called cleanUp, which resets NStocks to an empty list > and N1 to 0. Works like a charm - it's the first time I've used a > class method, and I immediately see its

Re: Towards faster Python implementations - theory

2007-05-09 Thread Klaas
On May 9, 10:02 am, John Nagle <[EMAIL PROTECTED]> wrote: > One option might be a class "simpleobject", from which other classes > can inherit. ("object" would become a subclass of "simpleobject"). > "simpleobject" classes would have the following restrictions: > > - New fields and f

Re: Behavior of mutable class variables

2007-05-09 Thread tkpmep
Thanks for the insights. I solved the problem as follows: I created a new class method called cleanUp, which resets NStocks to an empty list and N1 to 0. Works like a charm - it's the first time I've used a class method, and I immediately see its utility. Thanks again class Stock(object): NSto

Re: Suggestions for how to approach this problem?

2007-05-09 Thread James Stroud
John Salerno wrote: > John Salerno wrote: > >> So I need to remove the line breaks too, but of course not *all* of >> them because each reference still needs a line break between it. > > > After doing a bit of search and replace for tabs with my text editor, I > think I've narrowed down the pro

Re: interesting exercise

2007-05-09 Thread Michael Tobis
On May 9, 2:41 pm, [EMAIL PROTECTED] wrote: > On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]> > wrote: > > or even this monstrosity ... > > > def permute2( s, n ): > >return [ ''.join([ s[int(i/len(s)**j)%len(s)] > > for j in range(n-1,-1,-1)]) > >for i in range(len(s)**n)

Re: Towards faster Python implementations - theory

2007-05-09 Thread Paul Boddie
John Nagle wrote: > > Modifying "at a distance" is exactly what I'm getting at. That's the > killer from an optimizing compiler standpoint. The compiler, or a > maintenance programmer, looks at a block of code, and there doesn't seem > to be anything unusual going on. But, if in some other

WSGI spec clarification regarding exceptions

2007-05-09 Thread Adam Atlas
I'm trying to figure out if there's any defined behaviour in PEP 333 for instances where an application returns an iterable as usual without error, but that iterable's next() method eventually raises an exception. Since any data theretofore returned by the iterable must be assumed to have already b

Re: preferred windows text editor?

2007-05-09 Thread BartlebyScrivener
On May 9, 1:26 pm, "Looney, James B" <[EMAIL PROTECTED]> wrote: > I'm using Vim (http://www.vim.org/). I too vote for VIM. I use it on both Windows XP and Debian Etch. I can't find anything it doesn't do. rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking if string inside quotes?

2007-05-09 Thread castironpi
On May 9, 4:31 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > Thanks, but it is a little more complicated than that, > the string could be deep in quotes. > >The problem is in string substitution. > Suppose I have a dictionary with MY_IP : "172.18.51.33" > > I need to replace all insta

Re: Comparing dates problem

2007-05-09 Thread John Machin
On May 10, 7:34 am, [EMAIL PROTECTED] wrote: > Hi, > > I am writing a reminder program for our Zimbra email client. One of > the requirements I was given was to automatically increment or > decrement the display to show something like the following: > > 5 minutes until appointment > > or > > 10 min

Re: Behavior of mutable class variables

2007-05-09 Thread tkpmep
On May 9, 5:25 pm, [EMAIL PROTECTED] wrote: > To test some theories, I created a new class variable, an int named Diez, Thanks. It is for precisely this reason that I added another class variable - the immutable int N1. But this too keeps getting incremented on subsequent calls to simulation( ). I

Re: preferred windows text editor?

2007-05-09 Thread tool69
Notepad++ with NppExec plugin and you can launch your scripts inside Np++. some others, very Powerfull : http://e-texteditor.com/ http://intype.info/home/index.php -- http://mail.python.org/mailman/listinfo/python-list

Re: String parsing

2007-05-09 Thread Paul Boddie
Dennis Lee Bieber wrote: > > I was trying to stay with a solution the should have been available > in the version of Python equivalent to the Jython being used by the > original poster. HTMLParser, according to the documents, was 2.2 level. I guess I should read the whole thread before posting. ;

Re: Behavior of mutable class variables

2007-05-09 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Here's what I expect to happen each time simulation( ) is called: the | class variable NStocks for the class Stock is initialized to an empty | list, Why would you expect that ;-) A class statement is usually executed exactly once, as

Re: File I/O

2007-05-09 Thread HMS Surprise
> [lst.append(list(line.split())) for line in file] Thanks, this is the direction I wanted to go, BUT I must use v2.2 so the line above gives me the error: AttributeError: __getitem__ But the write format will be helpful. Thanks again, jh -- http://mail.python.org/mailman/listinfo/python-l

Re: File I/O

2007-05-09 Thread half . italian
On May 9, 2:13 pm, HMS Surprise <[EMAIL PROTECTED]> wrote: > If one has a list of lists such as > > lst = [['a','1'],['b','2']] > > is there a standard python idiom for writing and reading the pairs to/ > from a file? > > Thanks, > > jh These work. Assuming you can choose the format. Or you coul

Comparing dates problem

2007-05-09 Thread kyosohma
Hi, I am writing a reminder program for our Zimbra email client. One of the requirements I was given was to automatically increment or decrement the display to show something like the following: 5 minutes until appointment or 10 minutes past your appointment Either way, as each minute goes by

Re: File I/O

2007-05-09 Thread Sönmez Kartal
Hi, As far as I know, Python doesn't have a specific thing to handle this. You could write a tiny function that would interpre element type of list's elements. It checks type, if it is a list then get that pair manually... If list is going like that 'a' - '1', 'b' - '2', you should use dictiona

RE: Checking if string inside quotes?

2007-05-09 Thread Michael Yanowitz
Thanks, but it is a little more complicated than that, the string could be deep in quotes. The problem is in string substitution. Suppose I have a dictionary with MY_IP : "172.18.51.33" I need to replace all instances of MY_IP with "172.18.51.33" in the file. It is easy in cases such as

Re: Behavior of mutable class variables

2007-05-09 Thread tkpmep
To test some theories, I created a new class variable, an int named N1, which is not mutable. So my Stock class now looks as follows: class Stock(object): NStocks = [] #Class variables N1 = 0 def __init__(self, id, returnHistory): self.id = id self

Re: change of random state when pyc created??

2007-05-09 Thread Carsten Haese
On Wed, 2007-05-09 at 15:35 -0500, Alan G Isaac wrote: > Robert Kern wrote: > > http://docs.python.org/lib/typesmapping.html > > """ > > Keys and values are listed in an arbitrary order which is non-random, varies > > across Python implementations, and depends on the dictionary's history of > > ins

Re: Behavior of mutable class variables

2007-05-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I have written a program that runs portfolio simulations with > different parameters and prints the output, but am mystified by the > behavior of a mutable class variable. A simplified version of the > program follows - would you kindly help me understand why it behaves

File I/O

2007-05-09 Thread HMS Surprise
If one has a list of lists such as lst = [['a','1'],['b','2']] is there a standard python idiom for writing and reading the pairs to/ from a file? Thanks, jh -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking if string inside quotes?

2007-05-09 Thread half . italian
On May 9, 1:39 pm, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > Hello: > >If I have a long string (such as a Python file). > I search for a sub-string in that string and find it. > Is there a way to determine if that found sub-string is > inside single-quotes or double-quotes or not inside a

Re: Unzip then Zip help

2007-05-09 Thread Rob Wolfe
[EMAIL PROTECTED] writes: > I am a true n00b... and I just using Python to complete some very > small uneventful task, but need help with one last thing. > > Basically, this I what I am trying to do. > > make a temp directory (this part I can do) > > Need help with: > ***unzip a JAR file with the

Re: change of random state when pyc created??

2007-05-09 Thread Robert Kern
Alan G Isaac wrote: > Robert Kern wrote: >> http://docs.python.org/lib/typesmapping.html >> """ >> Keys and values are listed in an arbitrary order which is non-random, varies >> across Python implementations, and depends on the dictionary's history of >> insertions and deletions. >> """ > > Even

Behavior of mutable class variables

2007-05-09 Thread tkpmep
I have written a program that runs portfolio simulations with different parameters and prints the output, but am mystified by the behavior of a mutable class variable. A simplified version of the program follows - would you kindly help me understand why it behaves the way it does. The function mai

Re: Unzip then Zip help

2007-05-09 Thread kyosohma
On May 9, 2:36 pm, [EMAIL PROTECTED] wrote: > I am a true n00b... and I just using Python to complete some very > small uneventful task, but need help with one last thing. > > Basically, this I what I am trying to do. > > make a temp directory (this part I can do) > > Need help with: > ***unzip a J

Re: change of random state when pyc created??

2007-05-09 Thread Chris Mellon
On 5/9/07, Alan G Isaac <[EMAIL PROTECTED]> wrote: > Robert Kern wrote: > > http://docs.python.org/lib/typesmapping.html > > """ > > Keys and values are listed in an arbitrary order which is non-random, varies > > across Python implementations, and depends on the dictionary's history of > > inserti

Re: change of random state when pyc created??

2007-05-09 Thread Alan G Isaac
Robert Kern wrote: > http://docs.python.org/lib/typesmapping.html > """ > Keys and values are listed in an arbitrary order which is non-random, varies > across Python implementations, and depends on the dictionary's history of > insertions and deletions. > """ Even this does not tell me that if I

Checking if string inside quotes?

2007-05-09 Thread Michael Yanowitz
Hello: If I have a long string (such as a Python file). I search for a sub-string in that string and find it. Is there a way to determine if that found sub-string is inside single-quotes or double-quotes or not inside any quotes? If so how? Thanks in advance: Michael Yanowitz -- http://mail.

Re: Questions about bsddb

2007-05-09 Thread sinoodle
Thanks for the info Nick. I plan on accessing the data in pretty much random order, and once the database is built, it will be read only. At this point Im not too concerned about access times, just getting something to work. I've been messing around with both bt and hash with limited success, which

Re: Parameter checking on an interfase

2007-05-09 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi all, > I am more or less new to Python, and currently am making my > first "serious" program. The application is a Clinical History manager > (for my wife) which stores its data on a sqlite database. After > googling on this newsgroup, I have read several th

Re: tkinter get widget option value

2007-05-09 Thread rahulnag22
On May 8, 6:51 pm, James Stroud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi, > > If I have abuttonwidget > > > w =Button(root, text = "Button", state = 'disabled') > > > How can I get the value of option 'state' from the widget 'w'. > > I want something like -- > > > print w.state

Re: preferred windows text editor?

2007-05-09 Thread Sönmez Kartal
GNU Emacs with python-mode -- Sönmez Kartal -- http://mail.python.org/mailman/listinfo/python-list

Re: Single precision floating point calcs?

2007-05-09 Thread Robert Kern
Grant Edwards wrote: > I'm pretty sure the answer is "no", but before I give up on the > idea, I thought I'd ask... > > Is there any way to do single-precision floating point > calculations in Python? > > I know the various array modules generally support arrays of > single-precision floats.

Re: preferred windows text editor?

2007-05-09 Thread John Salerno
T. Crane wrote: > Right now I'm using Notepad++. What are other people using? > > trevis > > I love UltraEdit. It's not free, but very nice. -- http://mail.python.org/mailman/listinfo/python-list

Re: change of random state when pyc created??

2007-05-09 Thread Robert Kern
Alan G Isaac wrote: > Diez B. Roggisch wrote: >> Not really, but that depends on what you know about the concept of sets and >> maps as collections of course. >> >> The contract for sets and dicts doesn't imply any order whatsoever. Which is >> essentially the reason why >> >> set(xrange(10))[0] >>

Re: interesting exercise

2007-05-09 Thread castironpi
On May 9, 1:13 am, Charles Sanders <[EMAIL PROTECTED]> wrote: > Michael Tobis wrote: > > Here is the bloated mess I came up with. I did see that it had to be > > recursive, and was proud of myself for getting it pretty much on the > > first try, but the thing still reeks of my sorry old fortran-add

Re: preferred windows text editor?

2007-05-09 Thread nufuhsus
On May 9, 3:30 pm, Trent Mick <[EMAIL PROTECTED]> wrote: > There is an ActivePython 2.5.1 > now:http://www.activestate.com/products/activepython/ > > You should give Komodo Edit a try > too:http://www.activestate.com/products/komodo_edit/ Thanks for the heads up Trent. -- http://mail.python.

Re: Specification for win32com.client package

2007-05-09 Thread kyosohma
On May 9, 10:26 am, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On May 9, 8:25 am, Tim Golden <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> The wiki idea sounds like a good one. I was thinking about doing some > >>> kind of Python site about the modules and

Unzip then Zip help

2007-05-09 Thread sdoty044
I am a true n00b... and I just using Python to complete some very small uneventful task, but need help with one last thing. Basically, this I what I am trying to do. make a temp directory (this part I can do) Need help with: ***unzip a JAR file with the complete list of subdirectories w/ files**

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread kyosohma
On May 9, 11:08 am, 7stud <[EMAIL PROTECTED]> wrote: > On May 8, 11:05 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > > > > alf <[EMAIL PROTECTED]> wrote: > > > two ways of achieving the same effect > > > > l+=[n] > > > > or > > > > l.append(n) > > > > so which is more pythonic/faster? > > > .app

Re: preferred windows text editor?

2007-05-09 Thread Trent Mick
[EMAIL PROTECTED] wrote: > I like IDLE but it seems to stop working after the first few times and > I would then re-install it and it would work a few times more. > ActivePython was cool but I could not find a version of it that used > Python 2.5 (as far as I can see, it only uses 2.4) ActivePytho

Re: preferred windows text editor?

2007-05-09 Thread nufuhsus
On May 9, 2:06 pm, "T. Crane" <[EMAIL PROTECTED]> wrote: > Right now I'm using Notepad++. What are other people using? > > trevis I am very noob to this Python game and currently (I was using ActivePython and then IDLE) I have been using a combination of Notepad2 and the interpreter (Python 2.5)

Re: preferred windows text editor?

2007-05-09 Thread nufuhsus
On May 9, 2:06 pm, "T. Crane" <[EMAIL PROTECTED]> wrote: > Right now I'm using Notepad++. What are other people using? I am very noob to this Python game (though it has been around since 1995 me thinks) and currently (I was using ActivePython and then IDLE) I have been using a combination of N

Re: preferred windows text editor?

2007-05-09 Thread EuGeNe Van den Bulke
T. Crane wrote: > Right now I'm using Notepad++. What are other people using? > > trevis > > VIM here as well ... here we go again :P EuGeNe -- http://www.3kwa.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheritance problem

2007-05-09 Thread Jason
On May 9, 12:09 pm, [EMAIL PROTECTED] wrote: > I'm trying to solve a problem using inheritance and polymorphism in > python 2.4.2 > > I think it's easier to explain the problem using simple example: > > class shortList: > > def __init__(self): > > self.setList() > > def setList(self

Re: preferred windows text editor?

2007-05-09 Thread nufuhsus
On May 9, 2:06 pm, "T. Crane" <[EMAIL PROTECTED]> wrote: > Right now I'm using Notepad++. What are other people using? I am very noob to this Python game (though it has been around since 1995 me thinks) and currently (I was using ActivePython and then IDLE) I have been using a combination of Note

Re: ctypes: Problems using Windows-DLL from VB example code

2007-05-09 Thread Noralf Tr�nnes
Thank you very much! That did the trick. Noralf. -- http://mail.python.org/mailman/listinfo/python-list

Re: Single precision floating point calcs?

2007-05-09 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'm pretty sure the answer is "no", but before I give up on the | idea, I thought I'd ask... | Is there any way to do single-precision floating point | calculations in Python? Make your own Python build from altered s

  1   2   >