Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread Paddy
On Mar 10, 3:33 pm, Brian Blais <[EMAIL PROTECTED]> wrote: > Hello, > > I was wondering what the approximate minimum age to learn python is. > > > I wanted to hear responses from people who have experience teaching > programming in > elementary/middle (or even high) school. Do graphical languages

Re: number generator

2007-03-10 Thread greg
MonkeeSage wrote: > this ... requires that M be evenly divisible by N, No, it doesn't -- I never said the numbers had to be *equal*. > and only works well with smaller N values, Why? > and selections are limited to numbers in the > 1 to (M/N)+(M/N) range I don't understand what you mean by t

Re: Python in a desktop environment

2007-03-10 Thread [EMAIL PROTECTED]
David Cramer wrote: > If you had an application that you were about to begin development on > which you wanted to be cross platform (at least Mac and Windows), > would you suggest using c++ and Python? I'd strongly consider a pure python solution (I'd choose wxpython), but if I needed to code back

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 11:26 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > To compare to the "cheat" method, calculate the mean and standard > deviation of this sample, and compare to those from the other method. I belieive you (mainly because I'm too lazy to write the sieve, hehe). ;) Regards, Jordan --

Re: number generator

2007-03-10 Thread Steven D'Aprano
On Sat, 10 Mar 2007 17:19:38 -0800, MonkeeSage wrote: > On Mar 10, 6:47 pm, Paul Rubin wrote: >> The fencepost method still seems to be simplest: >> >> t = sorted(random.sample(xrange(1,50), 4)) >> print [(j-i) for i,j in zip([0]+t, t+[50])] > > Simpler, true, b

Re: number generator

2007-03-10 Thread Steven D'Aprano
On Sat, 10 Mar 2007 16:02:56 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> > By your method, what is the probability of the first number being >> > higher than 30? What is the probability of the fifth number being >> > higher than 30? If these probabilities are unequa

Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread MonkeeSage
" "first person shooter" programming language " OMG! Thank's freakin awsome, lol!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in a desktop environment

2007-03-10 Thread MonkeeSage
On Mar 10, 9:23 pm, "David Cramer" <[EMAIL PROTECTED]> wrote: > If you had an application that you were about to begin development on > which you wanted to be cross platform (at least Mac and Windows), > would you suggest using c++ and Python? Depending on what exactly you're trying to do, a pure

Re: number generator

2007-03-10 Thread shellux
On Mar 9, 10:44 pm, "cesco" <[EMAIL PROTECTED]> wrote: > I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simple pattern or function

Re: number generator

2007-03-10 Thread Anton Vredegoor
Terry Reedy wrote: > "Anton Vredegoor" <[EMAIL PROTECTED]> wrote in message > | Yes that was one of my first ideas too. But later on Steven pointed out > | that one can view the problem like this: > | > | 0001100010100 > | > | That would be [3,4,3,1,2] > | > | where the '1' elements are like

Re: number generator

2007-03-10 Thread Terry Reedy
"Anton Vredegoor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Terry Reedy wrote: | | > Partitioning positive count m into n positive counts that sum to m is a | > standard combinatorial problem at least 300 years old. The number of such | > partitions, P(m,n) has no known exa

Python in a desktop environment

2007-03-10 Thread David Cramer
If you had an application that you were about to begin development on which you wanted to be cross platform (at least Mac and Windows), would you suggest using c++ and Python? I'm asking because we were originally thinking about doing c# but after attending PyCon this year I'm reconsidering. We ar

Re: merits of Lisp vs Python

2007-03-10 Thread Graham Dumpleton
On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > John Nagle <[EMAIL PROTECTED]> writes: > > John J. Lee wrote: > > > John Nagle <[EMAIL PROTECTED]> writes: > > > [...] > > > >>Python, on the other hand, is uphill all the way. Constant trouble > > >>with version issues, especially

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Paul Rubin
> if hist.has_key(outcome): > hist[outcome] += 1 # if key already exists, increment > else: > hist[outcome] = 1 # else create a new key You could write that: hist[outcome] = 1 + hist.get(outcome, 0) Or with Python 2.5 you could use hist = defaultdict(int) ... hist[outcome

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread [EMAIL PROTECTED]
On Mar 10, 3:17?pm, "Frank" <[EMAIL PROTECTED]> wrote: > Hi, > > does anyone know how one can test if, e.g., a dictionary 'name' has a > key called 'name_key'? > > This would be possible: > > keys_of_names = names.keys() > L = len(keys_of_names) > > for i in range(L): > if keys_of_names[i] == name_

Re: number generator

2007-03-10 Thread Paulo da Silva
Paul Rubin escreveu: > Paulo da Silva <[EMAIL PROTECTED]> writes: >> May be this is what you want ... >> I didn't test it enough ... but seems fine. > > That's way too complicated. Think about Gerald Flanagan's description > of the telegraph poles, and how to implement simply. It is a two liner.

Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread James Stroud
Brian Blais wrote: > Hello, > > I was wondering what the approximate minimum age to learn python is. > Has anyone had experience teaching middle school students, or elementary > school students Python? What brought this up for me is thinking about > starting a Lego robots group in a local midd

Re: unsigned integer?

2007-03-10 Thread Bjoern Schliessmann
hg wrote: > Dan Bishop wrote: >> def unsigned(n): >> return n & 0x > > or abs(-1) ? Nah! Bitwise operators are cool. ;) Though ANDing won't make the int unsigned. Regards, Björn -- BOFH excuse #23: improperly oriented keyboard -- http://mail.python.org/mailman/listinfo/pytho

Re: unsigned integer?

2007-03-10 Thread Bjoern Schliessmann
Paul Rubin wrote: > The OP specified that the expected result was 3. But that's not what he'd get with his C conversion ;) Regards, Björn -- BOFH excuse #348: We're on Token Ring, and it looks like the token got loose. -- http://mail.python.org/mailman/listinfo/python-list

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > Is the "egg" packaging gimmick considered mainstream Python, or just some > wierd idea from the "Peak" people? It seems to complicate installation > without adding much value. I don't know, but stock Python 2.5 seems to stick mysterious '.eg

Re: Help

2007-03-10 Thread Bjoern Schliessmann
Clement wrote: > how to use Python/C API http://www.catb.org/~esr/faqs/smart-questions.html#intro HTH Björn -- BOFH excuse #235: The new frame relay network hasn't bedded down the software loop transmitter yet. -- http://mail.python.org/mailman/listinfo/python-l

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Bjoern Schliessmann
Frank wrote: > does anyone know how one can test if, e.g., a dictionary 'name' > has a key called 'name_key'? Yes. It's already posted; next time have a look at the concise library reference: http://docs.python.org/lib/typesmapping.html > This would be possible: > > keys_of_names = names.keys

Re: distributed queue?

2007-03-10 Thread Paul Rubin
Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > (Why does everyone think that "concurrency" equals "usage of > multiple threads"?) Well, it doesn't necessarily, but that's easiest a lot of the time. > Try Twisted for your networking needs. I should try to understand Twisted better one of thes

Re: merits of Lisp vs Python

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > John Nagle <[EMAIL PROTECTED]> writes: > > [...] > > > >>Python, on the other hand, is uphill all the way. Constant trouble > >>with version issues, especially with C components called from Python. > >>MySQLdb, M2Crypto, SSL - th

Re: distributed queue?

2007-03-10 Thread Bjoern Schliessmann
Paul Rubin wrote: > Does anyone have an implementation of a distributed queue? I.e. I > have a long running computation f(x) and I'd like to be able to > evaluate it (for different values of x) on a bunch of different > computers simultaneously, the usual "worker thread" pattern except > distrib

Re: Help controlling CDROM from python

2007-03-10 Thread MonkeeSage
On Mar 10, 4:11 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: > win32file.CreateFile(r'\\.\\' + drive, GENERIC_READ, > FILE_SHARE_READ, > None, OPEN_EXISTING, 0, 0) Oops! That should have been: h = win32file.CreateFile(r'\\.\\' + drive, GENERIC_READ,

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > John Nagle <[EMAIL PROTECTED]> writes: > > > >>[EMAIL PROTECTED] wrote: > > Traditionally, in the open source world, one does something about it, > > or shuts up after having made one's point, say, ten or twenty times > > In ret

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 6:47 pm, Paul Rubin wrote: > The fencepost method still seems to be simplest: > > t = sorted(random.sample(xrange(1,50), 4)) > print [(j-i) for i,j in zip([0]+t, t+[50])] Simpler, true, but I don't think it gives any better distribution... import rand

Re: convert time string in UTC to time in local time

2007-03-10 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > I'm guessing there is an easy way to do this but I keep going around > in circles in the documentation. > > I have a time stamp that looks like this (corresponding to UTC time): > > start_time = '2007-03-13T15:00:00Z' > > I want to convert it to my local time. > > start_t

Re: number generator

2007-03-10 Thread Paul Rubin
"MonkeeSage" <[EMAIL PROTECTED]> writes: > Taking your comment and running with it...this is pretty much > cheating, and requires that M be evenly divisible by N, and only works > well with smaller N values, and selections are limited to numbers in > the 1 to (M/N)+(M/N) range...but hey; other than

Re: PIL: reading bytes from Image

2007-03-10 Thread Max Erickson
"cyberco" <[EMAIL PROTECTED]> wrote: > I'm using web.py to send an image to the client. This works > (shortened): > > print open(path, "rb").read() > > but this doesn't: > > img = Image.open(path) > img.thumbnail((10,10)) > print img.getdata() > > or > > print img.load() > > > How do I get

Re: number generator

2007-03-10 Thread MonkeeSage
On Mar 10, 3:16 am, greg <[EMAIL PROTECTED]> wrote: > Another possibility is to generate a list of N non-random > numbers that sum to M, and then adjust them up or down > by random amounts. By performing up/down adjustments in > pairs, you can maintain the sum invariant at each step. > So then it's

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John Nagle
John J. Lee wrote: > John Nagle <[EMAIL PROTECTED]> writes: > > >>[EMAIL PROTECTED] wrote: > Traditionally, in the open source world, one does something about it, > or shuts up after having made one's point, say, ten or twenty times In retail, there's an assumption that for every customer w

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John Nagle
John J. Lee wrote: > John Nagle <[EMAIL PROTECTED]> writes: > > >>[EMAIL PROTECTED] wrote: >> > The distutils setup.py script checks for ncurses bits >> >>No, it just plows on after compiler errors. > Red Hat has traditionally been painful with Python. ... > Also there's the traditional o

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: [...] > This kind of nonsense is why hosting companies don't want to support Python. There seems a more obvious reason... > Perl and PHP may be dumb, but they just work. Java has a company behind it. > Python just isn't ready. Which is embarassing, ten

Re: merits of Lisp vs Python

2007-03-10 Thread John Nagle
John J. Lee wrote: > John Nagle <[EMAIL PROTECTED]> writes: > [...] > >>Python, on the other hand, is uphill all the way. Constant trouble >>with version issues, especially with C components called from Python. >>MySQLdb, M2Crypto, SSL - they all have platform/version >>incompatibility proble

Re: distributed queue?

2007-03-10 Thread skip
Paul> Does anyone have an implementation of a distributed queue? I.e. I Paul> have a long running computation f(x) and I'd like to be able to Paul> evaluate it (for different values of x) on a bunch of different Paul> computers simultaneously, the usual "worker thread" pattern exc

Re: unsigned integer?

2007-03-10 Thread Paul Rubin
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > > If you use %u you get a very large positive value, not +3. > Exactly, and that's the right value. (unsigned int)(-3) isn't +3. The OP specified that the expected result was 3. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: [...] > Perl, PHP, C, C++, and Java don't have this particular > problem. Python stands alone, out in the cold. [...] I guess different people's experiences differ. I remember trying to install Java on a FreeBSD server a few years back. I recall no sin

Re: number generator

2007-03-10 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > > By your method, what is the probability of the first number being > > higher than 30? What is the probability of the fifth number being > > higher than 30? If these probabilities are unequal, can we really say > > the sequences are random? > > Of c

Re: number generator

2007-03-10 Thread Anton Vredegoor
Anton Vredegoor wrote: > L = [1] * (bins-1) + [0] * (bins-1) replace these lines in the code by: L = [1] * (bins-1) + [0] * (bricks-bins) A. -- http://mail.python.org/mailman/listinfo/python-list

Re: unsigned integer?

2007-03-10 Thread Gabriel Genellina
En Sat, 10 Mar 2007 20:26:13 -0300, Paul Rubin <"http://phr.cx"@NOSPAM.invalid> escribió: > "Gabriel Genellina" <[EMAIL PROTECTED]> writes: >> Try again with "%u". Passing i or ui makes no difference, both push >> the same value on the stack. C relies on the format string to >> interpret the a

Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > The distutils setup.py script checks for ncurses bits > > No, it just plows on after compiler errors. > > > As another person pointed out, you're conflating Python proper with a > > specific Linux distribution's packaging

Re: number generator

2007-03-10 Thread Steven D'Aprano
On Sat, 10 Mar 2007 08:29:09 -0800, Paul Rubin wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: >> Doesn't mean that it isn't random. After all, the first four numbers are >> random, therefore their sum is random. 50 - (something random) is also >> random. > > What does it mean for the first

Re: unsigned integer?

2007-03-10 Thread Paul Rubin
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > Try again with "%u". Passing i or ui makes no difference, both push > the same value on the stack. C relies on the format string to > interpret the arguments. If you use %u you get a very large positive value, not +3. -- http://mail.python.org/m

Re: number generator

2007-03-10 Thread Anton Vredegoor
Terry Reedy wrote: > Partitioning positive count m into n positive counts that sum to m is a > standard combinatorial problem at least 300 years old. The number of such > partitions, P(m,n) has no known exact formula but can be computed > inductively rather easily. The partitions for m and n

PIL: reading bytes from Image

2007-03-10 Thread cyberco
I'm using web.py to send an image to the client. This works (shortened): print open(path, "rb").read() but this doesn't: img = Image.open(path) img.thumbnail((10,10)) print img.getdata() or print img.load() How do I get the bytes of the Image object? 'getdata()' seemed the way, but unfortuna

Re: merits of Lisp vs Python

2007-03-10 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: [...] > Python, on the other hand, is uphill all the way. Constant trouble > with version issues, especially with C components called from Python. > MySQLdb, M2Crypto, SSL - they all have platform/version > incompatibility problems. I just spent three da

Re: merits of Lisp vs Python

2007-03-10 Thread John J. Lee
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > En Fri, 09 Mar 2007 16:10:51 -0300, Tim Bradshaw <[EMAIL PROTECTED]> > escribi�: [...] > > ill-conceived idea (not because of Python, note!). The electronic > > gadget people need in the developing world is a mobile phone not a > > computer. >

Re: unsigned integer?

2007-03-10 Thread Gabriel Genellina
En Sat, 10 Mar 2007 16:26:08 -0300, Paul Rubin <"http://phr.cx"@NOSPAM.invalid> escribió: > "Jack" <[EMAIL PROTECTED]> writes: >> Also, if I have an int, I can convert it to unsigned int in C: >>int i = -3; >>int ui = (unsigned int)i; > > I just tried it: > > main() { > int i =

Re: distributed queue?

2007-03-10 Thread Robert Kern
Paul Rubin wrote: > Does anyone have an implementation of a distributed queue? I.e. I > have a long running computation f(x) and I'd like to be able to > evaluate it (for different values of x) on a bunch of different > computers simultaneously, the usual "worker thread" pattern except > distribut

distributed queue?

2007-03-10 Thread Paul Rubin
Does anyone have an implementation of a distributed queue? I.e. I have a long running computation f(x) and I'd like to be able to evaluate it (for different values of x) on a bunch of different computers simultaneously, the usual "worker thread" pattern except distributed across a network. I gues

Re: Help controlling CDROM from python

2007-03-10 Thread MonkeeSage
On Mar 10, 8:27 am, Ognjen Bezanov <[EMAIL PROTECTED]> wrote: > My issue is that I need to be able to eject the CDROM tray even if there > is no disk inside. Here's a Q&D version (haven't tested the windows part, it's from an old mailing list post, but it looks correct): import os, sys if 'win'

Re: __init__ in subclass of tuple

2007-03-10 Thread Alan Isaac
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The signature is like you said, but it's not a tuple method, it's an > object method instead: > py> tuple.__init__ > > The only important thing is that it says: of 'object' objects, not: of > 'tuple' objects. Compare with: > py> tuple.__len__ >

Re: pylint: don't warn about tabs

2007-03-10 Thread Alan Isaac
> Alan: >> my actual question remains unanswered... Bjoern: > --indent-string or changing a config file doesn't work for you? Works great. (I read Robert's message subsequent to that complaint.) And pylint is wonderful. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Curious behaviour of Tkinter object

2007-03-10 Thread zefciu
I am writing a program with python and Tkinter. I have encountered a mysterious problem with the whole application hanging itself (cannot be stopped with ctrl-c, must be killed from another console). I have done several tests with interactive mode, and here what I noticed: - the problem is with a

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Jeff McNeil
Sure, you can use "if key in dict" to test for membership: Python 2.3.5 (#1, Jan 13 2006, 20:13:11) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> exampledict = {"a" : 1, "b" : 2} >>> "a" in exampledict True >>> "

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Rune Strand
Yes, you have name.has_key(name_key) and perhaps better, the in operator: if name_key in name: do something -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a key in a dictionary exists?

2007-03-10 Thread Irmen de Jong
Frank wrote: > Hi, > > does anyone know how one can test if, e.g., a dictionary 'name' has a > key called 'name_key'? name_key in name e.g. >>> name={"john": 42} >>> "john" in name True >>> "julie" in name False --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Formatted Input

2007-03-10 Thread Frank
On Mar 10, 11:28 am, "Deep" <[EMAIL PROTECTED]> wrote: > Hi all, > I am a newbie to python > I have an input of form > space > ie. > 4 3 > how can i assign this to my variables?? Hi, you could use: aux = f.readline() # read a line from your input file new_aux = string.split(aux, ' ') # you ca

Re: IronPython with Apache

2007-03-10 Thread John J. Lee
"edfialk" <[EMAIL PROTECTED]> writes: [...] > So, I'm told I need IronPython, which I get, and I replace the #!c: > \Python25\python.exe with the IronPython executable (#!c: > \IronPython-1.0.1\ipy.exe), but I get a 500 Internal Server error and: > > "[Wed Mar 07 17:02:21 2007] [error] [client 127

How to test if a key in a dictionary exists?

2007-03-10 Thread Frank
Hi, does anyone know how one can test if, e.g., a dictionary 'name' has a key called 'name_key'? This would be possible: keys_of_names = names.keys() L = len(keys_of_names) for i in range(L): if keys_of_names[i] == name_key: print 'found' But certainly not efficient. I would expect there is s

Need help in using mod_python

2007-03-10 Thread [EMAIL PROTECTED]
Hi, I am trying to setup Apache with Trac which uses mod_python. I get the following error: assert have_pysqlite > 0 And I have verify this via command line as well, that seem no problem. # python Python 2.3.4 (#1, Feb 2 2005, 11:44:49) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2 T

Re: pylint: don't warn about tabs

2007-03-10 Thread Alan Isaac
> Alan: >> I really think you should reread the PEP, which is making >> the opposite of your point. Skip: > Quite the opposite, in fact. Laura Creighton wrote that > PEP precisely with the expectation (and hope) that Guido > would reject it, which he did: Note the title and status. Sorry Skip,

Re: number generator

2007-03-10 Thread Terry Reedy
"Anton Vredegoor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Raymond Hettinger wrote: | | > To make the solutions equi-probable, a simple approach is to | > recursively enumerate all possibilities and then choose one of them | > with random.choice(). | | Maybe it is possible to

Re: Database module & multithreading

2007-03-10 Thread fumanchu
On Mar 10, 6:14 am, "jupiter" <[EMAIL PROTECTED]> wrote: > Just one quick question... Which database module > should I use when I want to use multi threading > as my application requires lots of data from > internet I also want this database module > to be fast, simple n efficient, in any case

Re: [Edu-sig] minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread kirby urner
On 3/10/07, Andreas Raab <[EMAIL PROTECTED]> wrote: > kirby urner wrote: > > I just talked to the computer teacher yesterday and he > > was reporting some rumor that future versions of Alice will > > center around the same Sims as in Sims, which my daughter > > plays with *a lot* (we also bought Ci

Re: making an "executable" for a python code (newbie)

2007-03-10 Thread Sick Monkey
You will probably want to read this documentation: http://pyinstaller.hpcf.upr.edu/docs/Manual_v1.1.html Look carefully at the following sections on the documentation: "Building the runtime environment" and "Spec File" and "Spec File -> EXE"

Re: [Edu-sig] minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread Andreas Raab
kirby urner wrote: > I just talked to the computer teacher yesterday and he > was reporting some rumor that future versions of Alice will > center around the same Sims as in Sims, which my daughter > plays with *a lot* (we also bought Civ City Rome yesterday, > coincidentally, and she built Rome in

Re: CGI handler: Retrieving POST and GET at the same time

2007-03-10 Thread Samuel
On Mar 10, 8:45 pm, "Pierre Quentel" <[EMAIL PROTECTED]> wrote: > To get the key-value dictionary : > > cgi.parse_qs(os.environ["QUERY_STRING"]) Thanks a lot, it works! -Samuel -- http://mail.python.org/mailman/listinfo/python-list

Re: Database module & multithreading

2007-03-10 Thread John Nagle
Jon Ribbens wrote: > In article <[EMAIL PROTECTED]>, John Nagle wrote: > >> As for "some modules not being maintained", it really is sad >>that MySQLdb is kind of behind. If you're running Windows and need >>MySQL, you're either stuck with Python 2.4 > > > Looks like that's changed: > > ht

Re: Phase change material ...

2007-03-10 Thread Dan Bloomquist
[EMAIL PROTECTED] wrote: > On Mar 8, 5:57 pm, "martinl" <[EMAIL PROTECTED]> wrote: > >>Hi All, >>I'm looking for a substance that does a phase change at between 60 and >>100 C. >> >>I need something with a high heat capacity so that when it cools >>through the phase change, it stays at the freezi

Re: Help on Dict

2007-03-10 Thread Clement
On Feb 26, 11:58 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 26 Feb 2007 07:15:43 +0200, Hendrik van Rooyen wrote: > > "James Stroud" <[EMAIL PROTECTED]> wrote: > > >> Clement wrote: > >> > Can any body tell how Dict is implemented in python... plz tell what > >> > datastructure that

Re: CGI handler: Retrieving POST and GET at the same time

2007-03-10 Thread Pierre Quentel
On 10 mar, 19:52, "Samuel" <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following form: > > > > > > and would like to retrieve both fields, "one" and "two". However, the > following does not work: > > form_data = cgi.FieldStorage() > for key in form_data: > print key + ":", form_data[key]

Re: number generator

2007-03-10 Thread Paul Rubin
Paulo da Silva <[EMAIL PROTECTED]> writes: > May be this is what you want ... > I didn't test it enough ... but seems fine. That's way too complicated. Think about Gerald Flanagan's description of the telegraph poles, and how to implement simply. It is a two liner. -- http://mail.python.org/mai

Re: Formatted Input

2007-03-10 Thread Dan Bishop
On Mar 10, 1:29 pm, "Deep" <[EMAIL PROTECTED]> wrote: > Hi all, > I am a newbie to python > I have an input of form > space > ie. > 4 3 > how can i assign these numbers to my variables?? n1, n2 = map(int, raw_input().split()) -- http://mail.python.org/mailman/listinfo/python-list

Formatted Input

2007-03-10 Thread Deep
Hi all, I am a newbie to python I have an input of form space ie. 4 3 how can i assign these numbers to my variables?? -- http://mail.python.org/mailman/listinfo/python-list

Formatted Input

2007-03-10 Thread Deep
Hi all, I am a newbie to python I have an input of form space ie. 4 3 how can i assign this to my variables?? -- http://mail.python.org/mailman/listinfo/python-list

Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread Michel Claveau
Hi! Personally, I was yet in the belly of my mom, whom I already thought in Python… -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: unsigned integer?

2007-03-10 Thread Paul Rubin
"Jack" <[EMAIL PROTECTED]> writes: > Also, if I have an int, I can convert it to unsigned int in C: >int i = -3; >int ui = (unsigned int)i; I just tried it: main() { int i = -3; unsigned int ui = i; printf("%d\n", ui); } prints -3. What do you want the conversi

Re: Phase change material ...

2007-03-10 Thread thermate
On Mar 8, 5:57 pm, "martinl" <[EMAIL PROTECTED]> wrote: > Hi All, > I'm looking for a substance that does a phase change at between 60 and > 100 C. > > I need something with a high heat capacity so that when it cools > through the phase change, it stays at the freezing temperature for as > long as

Re: unsigned integer?

2007-03-10 Thread Jack
Thanks for all the replies. Because I want to convert an int, Dan's function actually does it well. "Jack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This is a naive question: > > "%u" % -3 > > I expect it to print 3. But it still print -3. > > Also, if I have an int, I can con

Re: minimum age to learn python (a.k.a graphical vs text languages)

2007-03-10 Thread [EMAIL PROTECTED]
Brian Blais wrote: > Hello, > > I was wondering what the approximate minimum age to learn python is. Has > anyone had > experience teaching middle school students, or elementary school students > Python? > What brought this up for me is thinking about starting a Lego robots group in > a local >

CGI handler: Retrieving POST and GET at the same time

2007-03-10 Thread Samuel
Hi, I have the following form: and would like to retrieve both fields, "one" and "two". However, the following does not work: form_data = cgi.FieldStorage() for key in form_data: print key + ":", form_data[key].value It prints out: two: 2 How can I retrieve the GET variables in that co

Re: unsigned integer?

2007-03-10 Thread Duncan Booth
"Dan Bishop" <[EMAIL PROTECTED]> wrote: > On Mar 10, 11:50 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: >> "Jack" <[EMAIL PROTECTED]> wrote: >> > This is a naive question: >> >> > "%u" % -3 >> >> > I expect it to print 3. But it still print -3. >> >> Internally it uses the C runtime to format the

Re: A Pythonic Way to Measure and Improve Your Programming Skills?

2007-03-10 Thread André
On Mar 10, 1:54 pm, Brad Allen <[EMAIL PROTECTED]> wrote: > At 9:10 AM -0800 3/10/07, Michael Bernstein wrote: > > >On Sat, 2007-03-10 at 10:01 -0600, Brad Allen wrote: > > >> When I discussed this problem with Michael Bernstein at PyCon he suggested > >> the idea of creating a "chroot jail" for

Re: unsigned integer?

2007-03-10 Thread Dan Bishop
On Mar 10, 11:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Jack" <[EMAIL PROTECTED]> wrote: > > This is a naive question: > > > "%u" % -3 > > > I expect it to print 3. But it still print -3. > > Internally it uses the C runtime to format the number, but if the number > you ask it to print unsi

OLPC vs. mobile phones (was Re: merits of Lisp vs Python)

2007-03-10 Thread Paul Boddie
Gabriel Genellina wrote: > En Fri, 09 Mar 2007 16:10:51 -0300, Tim Bradshaw <[EMAIL PROTECTED]> escribió: > > > The electronic gadget people need in the developing world is a mobile phone > > not a > > computer. > > What for? > That requires a phone company, installed antennas everywhere, and > av

Re: pylint: don't warn about tabs

2007-03-10 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > http://www.python.org/dev/peps/pep-0666/ In pep-0666, Laura Creighton wrote: >People who mix tabs and spaces, naturally, will find that their >programs do not run. Alas, we haven't found a way to give them an >electric shock as from a cattle prod remote

Re: unsigned integer?

2007-03-10 Thread hg
Dan Bishop wrote: > On Mar 10, 11:32 am, "Jack" <[EMAIL PROTECTED]> wrote: >> This is a naive question: >> >> "%u" % -3 >> >> I expect it to print 3. But it still print -3. >> >> Also, if I have an int, I can convert it to unsigned int in C: >>int i = -3; >>int ui = (unsigned int)i; >> >>

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > As for "some modules not being maintained", it really is sad > that MySQLdb is kind of behind. If you're running Windows and need > MySQL, you're either stuck with Python 2.4 Looks like that's changed: http://sourceforge.net/project/showfi

Re: unsigned integer?

2007-03-10 Thread Duncan Booth
"Jack" <[EMAIL PROTECTED]> wrote: > This is a naive question: > > "%u" % -3 > > I expect it to print 3. But it still print -3. Internally it uses the C runtime to format the number, but if the number you ask it to print unsigned is negative it uses %d instead of %u. I have no idea if it is ac

Re: [python-advocacy] A Pythonic Way to Measure and Improve Your Programming Skills?

2007-03-10 Thread Brad Allen
At 9:10 AM -0800 3/10/07, Michael Bernstein wrote: >On Sat, 2007-03-10 at 10:01 -0600, Brad Allen wrote: > >> When I discussed this problem with Michael Bernstein at PyCon he suggested >> the idea of creating a "chroot jail" for each web session which could run >> the Python interpreter in a sec

Re: pylint: don't warn about tabs

2007-03-10 Thread John Nagle
Gabriel Genellina wrote: > En Thu, 08 Mar 2007 14:33:38 -0300, Bjoern Schliessmann > <[EMAIL PROTECTED]> escribió: > >> Alan Isaac wrote: >> >>> As a tab user, I want the tabs warning turned off. >> >> >> Advice: Don't. IIRC it's planned in future Python versions that TABs >> aren't supported fo

Re: unsigned integer?

2007-03-10 Thread Dan Bishop
On Mar 10, 11:32 am, "Jack" <[EMAIL PROTECTED]> wrote: > This is a naive question: > > "%u" % -3 > > I expect it to print 3. But it still print -3. > > Also, if I have an int, I can convert it to unsigned int in C: >int i = -3; >int ui = (unsigned int)i; > > Is there a way to do this in Pyt

Re: Database module & multithreading

2007-03-10 Thread John Nagle
Michael Bentley wrote: >> >> Thanx for this pointer buddy! I have done my homework. Some Database >> modules are not actively maintained some modules does not work with >> Python 2.5. At this moment I am using Sqlite3 which is pretty fast but >> it dosent allow me to use multi threading so which d

Re: number generator

2007-03-10 Thread Paulo da Silva
cesco escreveu: > I have to generate a list of N random numbers (integer) whose sum is > equal to M. If, for example, I have to generate 5 random numbers whose > sum is 50 a possible solution could be [3, 11, 7, 22, 7]. Is there a > simple pattern or function in Python to accomplish that? > > Than

unsigned integer?

2007-03-10 Thread Jack
This is a naive question: "%u" % -3 I expect it to print 3. But it still print -3. Also, if I have an int, I can convert it to unsigned int in C: int i = -3; int ui = (unsigned int)i; Is there a way to do this in Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: [python-advocacy] A Pythonic Way to Measure and Improve Your Programming Skills?

2007-03-10 Thread John Nagle
Michael Bernstein wrote: > On Sat, 2007-03-10 at 10:01 -0600, Brad Allen wrote: > > >>When I discussed this problem with Michael Bernstein at PyCon he suggested >>the idea of creating a "chroot jail" for each web session which could run >>the Python interpreter in a secure sandbox. That might be

Re: Is this right? Multiple imports of same module.

2007-03-10 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > Lou Pecora <[EMAIL PROTECTED]> writes: > > > ['import mymodule' in three separate modules] > > > > Then mymodule is imported only once, but each module has access to > > it through the module name (mod1 and mod2) and the ali

  1   2   >