Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Alf P. Steinbach
* Raymond Hettinger: On Nov 11, 10:21 pm, "Alf P. Steinbach" wrote: One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle graphics may be off-putting to some readers because it is associated with children's learning. What do you think? How about calling it Raptor

Re: python simply not scaleable enough for google?

2009-11-12 Thread Vincent Manis
On 2009-11-12, at 23:19, Steven D'Aprano wrote: > On Thu, 12 Nov 2009 22:20:11 -0800, Vincent Manis wrote: > > Vincent, could you please fix your mail client, or news client, so > that it follows the standard for mail and news (that is, it has a > hard-break after 68 or 72 characters? My apologi

Re: python simply not scaleable enough for google?

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 22:20:11 -0800, Vincent Manis wrote: > When I was approximately 5, everybody knew that higher level languages were > too slow for high-speed numeric computation (I actually didn't know that > then, I was too busy watching Bill and Ben the Flowerpot Men), and therefore > asse

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Vincent Manis
On 2009-11-12, at 19:13, Peter Nilsson wrote: > My recollection is that many children struggled with Turtle > graphics because they had very little concept of trigonometry. > [Why would they? Many wouldn't learn for another 2-10 years.] > Adults tend to have even less concept since they almost neve

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Raymond Hettinger
On Nov 11, 10:21 pm, "Alf P. Steinbach" wrote: > One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has > been that turtle graphics may be off-putting to some readers because it is > associated with children's learning. > > What do you think? How about calling it Raptor Graphics that w

Re: New syntax for blocks

2009-11-12 Thread Stephen Hansen
On Thu, Nov 12, 2009 at 8:10 PM, r wrote: > On Nov 12, 7:44 pm, Steven D'Aprano cybersource.com.au> wrote > > Oh, but those hundreds of thousands of man-hours lost to bugs caused by > > assignment-as-an-expression is nothing compared to the dozens of man- > > minutes saved by having one fewer li

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Vincent Manis
On 2009-11-12, at 11:36, AK Eric wrote: > On Nov 12, 11:31 am, Terry Reedy wrote: >> Alf P. Steinbach wrote: >>> One reaction to >> http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle >>> graphics may be off-putting to some readers because it is associated >>> with children's learni

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread Dan Bishop
On Nov 12, 1:52 pm, rantingrick wrote: > Hello, > > Currently i am using 2.6 on Windows and need to start writing code in > 3.0. I cannot leave 2.x yet because 3rd party modules are still not > converted. So i want to install 3.0 without disturbing my current > Python2.x. What i'm afraid of is tha

Re: 2.6 and sys.exit()

2009-11-12 Thread hetchkay
On Nov 13, 10:28 am, hetchkay wrote: > On Nov 13, 9:50 am, John Yeung wrote: > > > > > On Nov 12, 11:22 pm, r wrote: > > > > On Nov 12, 10:07 pm, hetchkay wrote: > > > > I have the following in exit.py: > > > > import sys > > > > sys.exit(0) > > > > > I now try 'python -i exit.py': > > > > > In

Re: python simply not scaleable enough for google?

2009-11-12 Thread Vincent Manis
When I was approximately 5, everybody knew that higher level languages were too slow for high-speed numeric computation (I actually didn't know that then, I was too busy watching Bill and Ben the Flowerpot Men), and therefore assembly languages were mandatory. Then IBM developed Fortran, and hig

Re: 2.6 and sys.exit()

2009-11-12 Thread hetchkay
On Nov 13, 9:50 am, John Yeung wrote: > On Nov 12, 11:22 pm, r wrote: > > > > > On Nov 12, 10:07 pm, hetchkay wrote: > > > I have the following in exit.py: > > > import sys > > > sys.exit(0) > > > > I now try 'python -i exit.py': > > > > In 2.5, the script exits as I would expect. > > > > In 2.6

Re: regex remove closest tag

2009-11-12 Thread S.Selvam
On Fri, Nov 13, 2009 at 12:47 AM, MRAB wrote: > S.Selvam wrote: > >> Hi all, >> >> >> 1) I need to remove the tags which is just before the keyword(i.e >> some_text2 ) excluding others. >> >> 2) input string may or may not contain tags. >> >> 3) Sample input: inputstr = """start > href="so

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Carl Banks
On Nov 12, 6:29 pm, greg wrote: > I would be taking a different approach -- develop a prototype > in Python, concentrating on clarity rather than speed, and > later reimplement the core of the emulator as an extension > module, using Pyrex or Cython or otherwise. But keep in mind he said he was d

Re: 2.6 and sys.exit()

2009-11-12 Thread Ned Deily
In article <008aa7ef-b945-4f70-b5e4-def66546e...@2g2000prl.googlegroups.com>, hetchkay wrote: > I have the following in exit.py: > import sys > sys.exit(0) > > I now try 'python -i exit.py': > > In 2.5, the script exits as I would expect. > > In 2.6, the following error is printed: > > Trace

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Carl Banks
On Nov 12, 6:37 am, Santiago Romero wrote: > > >  I'm trying to port (just for fun), my old Sinclair Spectrum emulator, > > > ASpectrum, from C to Python + pygame. > > > The answer to your question is, "Use numpy".  More details below. > >  Let's see :-) > > > >  How can I implement this in Python

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:32 pm, hetchkay wrote: > But I don't understand why the interpreter does not exit in 2.6 but > does exit in 2.5. Well, I do not need to understand that but I need to > know how to get the interpreter to exit in 2.6. Well, taken at face value, I would say the answer is to not use the

Re: 2.6 and sys.exit()

2009-11-12 Thread John Yeung
On Nov 12, 11:22 pm, r wrote: > On Nov 12, 10:07 pm, hetchkay wrote: > > I have the following in exit.py: > > import sys > > sys.exit(0) > > > I now try 'python -i exit.py': > > > In 2.5, the script exits as I would expect. > > > In 2.6, the following error is printed: > > > Traceback (most recen

Re: 2.6 and sys.exit()

2009-11-12 Thread hetchkay
Hello, Thanks for your help. I know what SystemExit is. In 2.5 as well SystemExit is raised when sys.exit() is called. For example: try: import sys sys.exit(0) except SystemExit: print "system exit raised" raise But I don't understand why the interpreter does not exit in 2.6 but does exi

how to install python-spidermonkey on windows

2009-11-12 Thread elca
Hello all, im making some script with python mechanize, one of problem is it really hard to find which support javascript supported web client scraping or crawler. actually i was found some such as python-spidermonkey and pykhtml and so on. but most of all only support on linux . i want to make my

Re: 2.6 and sys.exit()

2009-11-12 Thread r
PS: Python even answers questions: >>> import sys >>> help(sys.exit) Help on built-in function exit in module sys: exit(...) exit([status]) Exit the interpreter by raising SystemExit(status). If the status is omitted or None, it defaults to zero (i.e., success). If the status is

Re: 2.6 and sys.exit()

2009-11-12 Thread r
On Nov 12, 10:07 pm, hetchkay wrote: > Hello, > > I have the following in exit.py: > import sys > sys.exit(0) > > I now try 'python -i exit.py': > > In 2.5, the script exits as I would expect. > > In 2.6, the following error is printed: > > Traceback (most recent call last): >   File "exit.py", li

Re: New syntax for blocks

2009-11-12 Thread r
On Nov 12, 7:44 pm, Steven D'Aprano wrote > Oh, but those hundreds of thousands of man-hours lost to bugs caused by > assignment-as-an-expression is nothing compared to the dozens of man- > minutes saved by having one fewer line of code! OK, what *if* the variable would only be valid in *that* bl

2.6 and sys.exit()

2009-11-12 Thread hetchkay
Hello, I have the following in exit.py: import sys sys.exit(0) I now try 'python -i exit.py': In 2.5, the script exits as I would expect. In 2.6, the following error is printed: Traceback (most recent call last): File "exit.py", line 2, in sys.exit(0) SystemExit: 0 >>> I couldn't find

Re: ANN: esky 0.2.1

2009-11-12 Thread Ryan Kelly
> >Esky is an auto-update framework for frozen python apps, built on top of > >bbfreeze. It provides a simple API through which apps can find, fetch > >and install updates, and a bootstrapping mechanism that keeps the app > >safe in the face of failed or partial updates. > > Recently I was looki

Re: python parser overridden by pymol

2009-11-12 Thread Dave Angel
Robert Kern wrote: Jeremiah H. Savage wrote: To use pymol and numpy together, I now do the following: To ~/.bashrc add: PYMOL_PATH=/usr/lib/pymodules/python2.5/pymol export PYMOL_PATH Then I can do the following in python: import numpy numpy.save('123',numpy.arra

Python 2.6 and sys.exit()

2009-11-12 Thread H Krishnan
Hello, I have the following in exit.py: import sys sys.exit(0) I now try 'python -i exit.py': In 2.5, the script exits as I would expect. In 2.6, the following error is printed: Traceback (most recent call last): File "exit.py", line 2, in sys.exit(0) SystemExit: 0 >>> I couldn't find

Re: ANN: esky 0.2.1

2009-11-12 Thread Aahz
In article , Ryan Kelly wrote: > >Esky is an auto-update framework for frozen python apps, built on top of >bbfreeze. It provides a simple API through which apps can find, fetch >and install updates, and a bootstrapping mechanism that keeps the app >safe in the face of failed or partial updates.

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Peter Nilsson
"Alf P. Steinbach" wrote: > One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has > been that turtle graphics may be off-putting to some > readers because it is associated with children's learning. [I'll be honest and say that I merely glanced at the two pdf files.] Who is your targe

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Steven D'Aprano
On Fri, 13 Nov 2009 15:33:53 +1300, greg wrote: > Santiago Romero wrote: >>>How about >>>page, index = divmod(address, 16384) >> >> Surely, much better and faster :-) > > Not necessarily, because it involves a function call, and constructing > and deconstructing a result tuple. If you time t

Re: Python & Go

2009-11-12 Thread Paul Rubin
Duncan Booth writes: > > http://scienceblogs.com/goodmath/2009/11/googles_new_language_go.php > > > Thanks for that link. I think it pretty well agrees with my first > impressions of Go: It looks like a not-so-interesting C follow-on, but the article doesn't describe any of the parallelism stuf

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Steven D'Aprano
On Fri, 13 Nov 2009 15:29:03 +1300, greg wrote: > Generally, I think you're going to have quite a battle on your hands to > get a pure Python implementation to run as fast as a real Z80, if it's > even possible at all. And if you do succeed, the code will be pretty > awful (due to things such as n

Re: python simply not scaleable enough for google?

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 21:02:11 +0100, Alf P. Steinbach wrote: > Specifically, I reacted to the statement that < talk about "the" speed of an implementation>>, made in response to > someone upthread, in the context of Google finding CPython overall too > slow. > > It is quite slow. ;-) Quite slow t

Re: #define (from C) in Python

2009-11-12 Thread greg
TerryP wrote: If it's such a big hairy deal, just recompile a copy of the C Pre Processor to use something other then #, and hook it up to your python scripts in a pipe line from a shell wrapper. Or use a different preprocessor, such as m4, that doesn't clash with the # character. -- Greg -- h

Re: python parser overridden by pymol

2009-11-12 Thread Robert Kern
Jeremiah H. Savage wrote: To use pymol and numpy together, I now do the following: To ~/.bashrc add: PYMOL_PATH=/usr/lib/pymodules/python2.5/pymol export PYMOL_PATH Then I can do the following in python: import numpy numpy.save('123',numpy.array([1,2,3])) numpy.

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread greg
Santiago Romero wrote: How about page, index = divmod(address, 16384) Surely, much better and faster :-) Not necessarily, because it involves a function call, and constructing and deconstructing a result tuple. If you time them, you may well find that the explicit shift and mask operation

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread greg
Carl Banks wrote: You can define constants to access specific registers: R1L = 1 R1H = 2 R1 = 1 breg[R1H] = 2 print wreg[R1] But keep in mind that named "constants" at the module level are really global variables, and therefore incur a dictionary lookup every time they're used. For maximum s

Re: python with echo

2009-11-12 Thread MRAB
Steven D'Aprano wrote: On Thu, 12 Nov 2009 19:30:01 +, MRAB wrote: I don't understand that. Exit status codes on all systems I'm familiar with are limited to 0 through 255. What operating system are you using? Assuming your system allows two-byte exit statuses, you should check the documen

Re: QuerySets in Dictionaries

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 10:39:33 -0800, scoopseven wrote: > I need to create a dictionary of querysets. I have code that looks > like: > > query1 = Myobject.objects.filter(status=1) > query2 = Myobject.objects.filter(status=2) > query3 = Myobject.objects.filter(status=3) > > d={} > d['a'] = query

Re: open source linux -> windows database connectivity?

2009-11-12 Thread Tony Schmidt
>Note: The client part of this product is free. You only need to >get a license for the server part. Yeah, but don't I need the server part to make the connection? Would it be possible to use Jython and the Pervasive JDBC driver for this? On Nov 12, 2:56 pm, "M.-A. Lemburg" wrote: > Tony Schmid

Re: python with echo

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 19:30:01 +, MRAB wrote: >> I don't understand that. Exit status codes on all systems I'm familiar >> with are limited to 0 through 255. What operating system are you using? >> >> Assuming your system allows two-byte exit statuses, you should check >> the documentation for

Re: New syntax for blocks

2009-11-12 Thread Steven D'Aprano
On Thu, 12 Nov 2009 21:27:31 +0100, Bruno Desthuilliers wrote: > Congratulations, you just reinvented one of the most infamous source of > bugs in C, C++, Java, PHP, javascript and quite a few other languages. > Believe it or not, but not allowing this in Python was a very deliberate > design choi

Re: Linux, Python 2.5.2, serverless binding LDAP?

2009-11-12 Thread Kevin Cole
On Nov 12, 8:01 pm, alex23 wrote: > On Nov 13, 10:47 am, Kevin Cole wrote: > > > > > Hi, > > > I recently asked our IT department how to gain access to an > > addressbook.  After carefully explaining that I was on a Linux system > > using Python, I got the reply: > > > "You should use our LDAP. W

Re: python parser overridden by pymol

2009-11-12 Thread Jeremiah H. Savage
On Wed, Nov 11, 2009 at 7:48 PM, Dave Angel wrote: > > > Jeremiah wrote: >> >> Hello, >> >> I'm fairly new to python (version 2.5.4), and am writing a program >> which uses both pymol (version 1.2r1) and numpy (version 1.3.0) from >> debian. >> >> It appears that when I add pymol to $PYTHONPATH, t

Re: Linux, Python 2.5.2, serverless binding LDAP?

2009-11-12 Thread Kevin Cole
On Nov 12, 8:01 pm, alex23 wrote: > On Nov 13, 10:47 am, Kevin Cole wrote: > > > > > Hi, > > > I recently asked our IT department how to gain access to an > > addressbook.  After carefully explaining that I was on a Linux system > > using Python, I got the reply: > > > "You should use our LDAP. W

Re: Linux, Python 2.5.2, serverless binding LDAP?

2009-11-12 Thread alex23
On Nov 13, 10:47 am, Kevin Cole wrote: > Hi, > > I recently asked our IT department how to gain access to an > addressbook.  After carefully explaining that I was on a Linux system > using Python, I got the reply: > > "You should use our LDAP. With LDAP you can pull any data you want > from Active

Linux, Python 2.5.2, serverless binding LDAP?

2009-11-12 Thread Kevin Cole
Hi, I recently asked our IT department how to gain access to an addressbook. After carefully explaining that I was on a Linux system using Python, I got the reply: "You should use our LDAP. With LDAP you can pull any data you want from Active Directory. On our network, the serverless binding add

Re: New syntax for blocks

2009-11-12 Thread r
On Nov 12, 2:37 pm, Bruno Desthuilliers wrote: > > Oh i get it now! If i assign a valid value to a variable the variable > > is also valid...thats...thats... GENUIS! *sarcasm* > > It's not about "assigning a valid value to a variable", it's about the > name being created (or not) in the current n

Re: open source linux -> windows database connectivity?

2009-11-12 Thread M.-A. Lemburg
Tony Schmidt wrote: > I am trying to read a Pervasive database on a Windows machine from a > Python script on a Linux machine. > > I understand that this can be done with a proprietary ODBC-to-ODBC > bridge called mxODBC or Easysoft OOB. The product is called "mxODBC Connect" and allows connectin

Re: python with echo

2009-11-12 Thread Christian Heimes
Diez B. Roggisch wrote: > with open("/sys/class/net/wlan1/device/tx_power", "w") as f: > f.write("%i" % POWER) IIRC the sys and proc virtual file system requires new line at the end of a modifier. At least echo appends \n unless it's told otherwise. Christian -- http://mail.python.org/mail

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread rantingrick
On Nov 12, 2:51 pm, Terry Reedy wrote: > rantingrick wrote: > > Hello, > > > Currently i am using 2.6 on Windows and need to start writing code in > > 3.0. I cannot leave 2.x yet because 3rd party modules are still not > > converted. So i want to install 3.0 without disturbing my current > > Pytho

ANN: ActivePython 2.6.4.8 is now available

2009-11-12 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 2.6.4.8 is now available for download from: http://www.activestate.com/activepython/ This is a patch release that updates ActivePython to core Python 2.6.4. We recommend that you try 2.6 version first. See the release notes for full details: http:

open source linux -> windows database connectivity?

2009-11-12 Thread Tony Schmidt
I am trying to read a Pervasive database on a Windows machine from a Python script on a Linux machine. I understand that this can be done with a proprietary ODBC-to-ODBC bridge called mxODBC or Easysoft OOB. Is there anyway to do this with existing free/ open source tools? Thanks in advance for

Re: Python & Go

2009-11-12 Thread Grant Edwards
On 2009-11-12, Patrick Sabin wrote: > kj wrote: >> >> I'm just learning about Google's latest: the GO (Go?) language. >> (e.g. http://golang.org or http://www.youtube.com/watch?v=rKnDgT73v8s). >> There are some distinctly Pythonoid features to the syntax, such >> as "import this_or_that", the abs

Re: New syntax for blocks

2009-11-12 Thread Bruno Desthuilliers
r a écrit : > On Nov 11, 2:37 am, Steven D'Aprano > wrote: >> On Wed, 11 Nov 2009 00:08:58 -0800, r wrote: > >>> Yea it's called a NameError. Would it not also blow up in the current >>> state of syntax usage? >> No. >> >>> if var: >>> print 'var' >>> Traceback (most recent call last): >>>

Re: New syntax for blocks

2009-11-12 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > Hint to would-be language designers: if you start off by claiming that a > new feature will save an indent level, when in fact it *doesn't* save an > indent level, you can save yourself from embarrassment by pressing Close > on your post instead of Send. Mouaa

JSR223 Access Python class instances through Java

2009-11-12 Thread Jared Klumpp
I am trying to access (from Java) a python class that extends a Java interface. The following program runs fine in the jython console (I can instantiate Tada, call t.getName() and everything prints correctly.) However, if I invoke test1() from Java using JSR223, the returned object is inaccessible

Re: New syntax for blocks

2009-11-12 Thread Bruno Desthuilliers
r a écrit : -snip) > Just thinking out loud here...what if variable assignments could > return a value... hmmm? Not to them selfs of course but to a caller, > like an if statement... > > if a=openfile: > # do something with a Congratulations, you just reinvented one of the most infamous source

Re: python with echo

2009-11-12 Thread Hans Mulder
Steven D'Aprano wrote: On Wed, 11 Nov 2009 17:24:37 -0800, hong zhang wrote: List, I have a question of python using echo. POWER = 14 return_value = os.system('echo 14 > /sys/class/net/wlan1/device/tx_power') can assign 14 to tx_power But return_value = os.system('echo $POWER > /sys/class/n

Re: Python & Go

2009-11-12 Thread Patrick Sabin
kj wrote: I'm just learning about Google's latest: the GO (Go?) language. (e.g. http://golang.org or http://www.youtube.com/watch?v=rKnDgT73v8s). There are some distinctly Pythonoid features to the syntax, such as "import this_or_that", the absence of parentheses at the top of flow control const

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 12:44:00 -0800, Benjamin Kaplan wrote: Some one could even write an interpreter for C++ if they wanted to. Someone has (http://root.cern.ch/drupal/content/cint)! -- Rami Chowdhury "Never attribute to malice that which can be attributed to stupidity" -- Hanlon's Razor

Re: (OT) Recommend FTP Client

2009-11-12 Thread David M. Besonen
On 11/12/2009 11:26 AM, Dave Angel wrote: > Try http://fireftp.mozdev.org/ in the past i found this to be buggy. i'd recommend something different. what is your OS? -- david -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & Go

2009-11-12 Thread Patrick Sabin
Carl Banks wrote: Well, it's hard to argue with not being like C++, but the lack of inheritance is a doozie. Well it has the concept of embedding, which seems to be similar to inheritance. - Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: Computing the 1000th prime

2009-11-12 Thread Dave Angel
Ray Holt wrote: I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread Terry Reedy
rantingrick wrote: Hello, Currently i am using 2.6 on Windows and need to start writing code in 3.0. I cannot leave 2.x yet because 3rd party modules are still not converted. So i want to install 3.0 without disturbing my current Python2.x. What i'm afraid of is that some SYSVARIABLE will get ch

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 2:52 PM, rantingrick wrote: > Hello, > > Currently i am using 2.6 on Windows and need to start writing code in > 3.0. I cannot leave 2.x yet because 3rd party modules are still not > converted. So i want to install 3.0 without disturbing my current > Python2.x. What i'm afr

Re: python simply not scaleable enough for google?

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 2:24 PM, Alf P. Steinbach wrote: > > You'll also find it impossible to rigorously define "dynamic language" in a > general way so that that definition excludes C++. > > So, to anyone who understands what one is talking about, "interpreted", or > e.g. "slow language" (as wa

Re: Psyco on 64-bit machines

2009-11-12 Thread Chris Kaynor
On Thu, Nov 12, 2009 at 12:06 PM, Russ P. wrote: > I have a Python program that runs too slow for some inputs. I would > like to speed it up without rewriting any code. Psyco seemed like > exactly what I need, until I saw that it only works on a 32-bit > architecture. I work in an environment of

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 12:02:11 -0800, Alf P. Steinbach wrote: I think that was in the part you *snipped* here. Just fill in the mentioned qualifications and weasel words. OK, sure. I don't think they're weasel words, because I find them useful, but I think I see where you're coming from. S

Re: Computing the 1000th prime

2009-11-12 Thread Benjamin Kaplan
On Thursday, November 12, 2009, Benjamin Kaplan wrote: > On Thursday, November 12, 2009, Ray Holt wrote: >> >> >> >> >> >> I have an assigment >> to find the 1000th. prime using python. What's wrong with the following >> code: >> PrimeCount = >> 0 >> PrimeCandidate = 1 >> while PrimeCount < 2000:

Psyco on 64-bit machines

2009-11-12 Thread Russ P.
I have a Python program that runs too slow for some inputs. I would like to speed it up without rewriting any code. Psyco seemed like exactly what I need, until I saw that it only works on a 32-bit architecture. I work in an environment of Sun Ultras that are all 64- bit. However, the Psyco docs sa

Re: Computing the 1000th prime

2009-11-12 Thread Benjamin Kaplan
On Thursday, November 12, 2009, Ray Holt wrote: > > > > > > I have an assigment > to find the 1000th. prime using python. What's wrong with the following > code: > PrimeCount = > 0 > PrimeCandidate = 1 > while PrimeCount < 2000: > > IsPrime = True >     PrimeCandidate = PrimeCandidate + > 2 >    

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Rami Chowdhury: On Thu, 12 Nov 2009 11:24:18 -0800, Alf P. Steinbach wrote: * Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon

3.x and 2.x on same machine (is this info at Python.org??)

2009-11-12 Thread rantingrick
Hello, Currently i am using 2.6 on Windows and need to start writing code in 3.0. I cannot leave 2.x yet because 3rd party modules are still not converted. So i want to install 3.0 without disturbing my current Python2.x. What i'm afraid of is that some SYSVARIABLE will get changed to Python3.0 an

Re: (OT) Recommend FTP Client

2009-11-12 Thread Victor Subervi
Thanks. V On Thu, Nov 12, 2009 at 2:26 PM, Dave Angel wrote: > > > Victor Subervi wrote: > >> Hi; >> Someone on this list just recommended I find an ftp client that enables me >> to change line endings. He indicated that it would be easy, but googling I >> haven't been able to find one. I would

Re: Computing the 1000th prime

2009-11-12 Thread MRAB
Ray Holt wrote: I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 11:24:18 -0800, Alf P. Steinbach wrote: * Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. Thi

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread AK Eric
On Nov 12, 11:31 am, Terry Reedy wrote: > Alf P. Steinbach wrote: > > One reaction to >http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle > > graphics may be off-putting to some readers because it is associated > > with children's learning. > > > What do you think? > > I just star

Re: Does turtle graphics have the wrong associations?

2009-11-12 Thread Terry Reedy
Alf P. Steinbach wrote: One reaction to http://preview.tinyurl.com/ProgrammingBookP3> has been that turtle graphics may be off-putting to some readers because it is associated with children's learning. What do you think? I just started using the module for simple plots. I am not a child. You

Re: python with echo

2009-11-12 Thread MRAB
Steven D'Aprano wrote: On Wed, 11 Nov 2009 17:24:37 -0800, hong zhang wrote: List, I have a question of python using echo. POWER = 14 return_value = os.system('echo 14 > /sys/class/net/wlan1/device/tx_power') can assign 14 to tx_power But return_value = os.system('echo $POWER > /sys/class/n

Re: (OT) Recommend FTP Client

2009-11-12 Thread Dave Angel
Victor Subervi wrote: Hi; Someone on this list just recommended I find an ftp client that enables me to change line endings. He indicated that it would be easy, but googling I haven't been able to find one. I would prefer a free client, but whatever. Please send me a recommendation. TIA, Victor

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Rami Chowdhury: On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. This has to do with the *origin* of the citric acid, whether natural o

Re: regex remove closest tag

2009-11-12 Thread MRAB
S.Selvam wrote: Hi all, 1) I need to remove the tags which is just before the keyword(i.e some_text2 ) excluding others. 2) input string may or may not contain tags. 3) Sample input: inputstr = """start some_text1 href="">some_text2 keyword anything""" 4) I came up with the follo

Computing the 1000th prime

2009-11-12 Thread Ray Holt
I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate % x == 0: ##

Re: QuerySets in Dictionaries

2009-11-12 Thread Diez B. Roggisch
scoopseven schrieb: I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to

Re: QuerySets in Dictionaries

2009-11-12 Thread Simon Brunning
2009/11/12 scoopseven : > I need to create a dictionary of querysets.  I have code that looks > like: > > query1 = Myobject.objects.filter(status=1) > query2 = Myobject.objects.filter(status=2) > query3 = Myobject.objects.filter(status=3) > > d={} > d['a'] = query1 > d['b'] = query2 > d['c'] = quer

Re: #define (from C) in Python

2009-11-12 Thread TerryP
If it's such a big hairy deal, just recompile a copy of the C Pre Processor to use something other then #, and hook it up to your python scripts in a pipe line from a shell wrapper. Personally, I'd rather have Lisps lambda or perls sub then Cs preprocessor, and even in those cases, Python suffices

Re: python simply not scaleable enough for google?

2009-11-12 Thread Rami Chowdhury
On Thu, 12 Nov 2009 09:32:28 -0800, Alf P. Steinbach wrote: This also seems religious. It's like in Norway it became illegal to market lemon soda, since umpteen years ago it's soda with lemon flavoring. This has to do with the *origin* of the citric acid, whether natural or chemist's con

Re: (OT) Recommend FTP Client

2009-11-12 Thread Tim Chase
Someone on this list just recommended I find an ftp client that enables me to change line endings. He indicated that it would be easy, but googling I haven't been able to find one. I would prefer a free client, but whatever. Please send me a recommendation. How about the command line client that

QuerySets in Dictionaries

2009-11-12 Thread scoopseven
I need to create a dictionary of querysets. I have code that looks like: query1 = Myobject.objects.filter(status=1) query2 = Myobject.objects.filter(status=2) query3 = Myobject.objects.filter(status=3) d={} d['a'] = query1 d['b'] = query2 d['c'] = query3 Is there a way to do this that I'm missi

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
On Nov 12, 10:10 am, Ethan Furman wrote: > AK Eric wrote: > > so: > > > # moduleA.py > > import moduleB > > > # moduleB.py > > import sys > > stuff = sys._getframe(1).f_locals > > print stuff > > > Prints: > > > {'__builtins__': , > > '__file__': 'C:\\Documents and SettingsMy Documents\ > > \p

Re: How can a module know the module that imported it?

2009-11-12 Thread Ethan Furman
AK Eric wrote: so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': , '__file__': 'C:\\Documents and SettingsMy Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks like you could query s

Re: standard libraries don't behave like standard 'libraries'

2009-11-12 Thread Benjamin Kaplan
On Thu, Nov 12, 2009 at 12:05 PM, Sriram Srinivasan wrote: >> So all libraries written have to use the common subset, which - unless >> things are *removed*, which with python3 actually happened - is always >> the oldest interpreter. And if a feature goes away, they have to be >> rewritten with th

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
Oops, numpy arrays start with index=0 :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: How can a module know the module that imported it?

2009-11-12 Thread AK Eric
so: # moduleA.py import moduleB # moduleB.py import sys stuff = sys._getframe(1).f_locals print stuff Prints: {'__builtins__': , '__file__': 'C:\\Documents and SettingsMy Documents\ \python\\moduleA.py', '__name__': '__main__', '__doc__': None} Looks like you could query stuff['__file__']

Re: Writing an emulator in python - implementation questions (for performance)

2009-11-12 Thread Santiago Romero
> You can do clever memory slicing like this with numpy.  For instance: > > breg = numpy.zeros((16,),numpy.uint8) > wreg = numpy.ndarray((8,),numpy.uint16,breg) > > This causes breg and wreg to share the same 16 bytes of memory.  You > can define constants to access specific registers: What I'm d

Re: #define (from C) in Python

2009-11-12 Thread Stefan Behnel
Santiago Romero, 12.11.2009 18:23: > #define LD_r_n(reg) (reg) = Z80ReadMem(r_PC++) > > #define LD_rr_nn(reg) r_opl = Z80ReadMem(r_PC); r_PC++; \ > r_oph = Z80ReadMem(r_PC); r_PC++; \ > reg = r_op > > #define LOAD_r(dreg, saddreg) (dreg)=Z80Read

Re: python simply not scaleable enough for google?

2009-11-12 Thread J Kenneth King
mcherm writes: > On Nov 11, 7:38 pm, Vincent Manis wrote: >> 1. The statement `Python is slow' doesn't make any sense to me. >> Python is a programming language; it is implementations that have >> speed or lack thereof. >[...] >> 2. A skilled programmer could build an implementation that com

Re: python simply not scaleable enough for google?

2009-11-12 Thread Alf P. Steinbach
* Steven D'Aprano: On Thu, 12 Nov 2009 08:35:23 -0800, Joel Davis wrote: obviously the GIL is a major reason it's so slow. http://en.wikipedia.org/wiki/Global_Interpreter_Lock Uh oh... No such "obviously" about it. There have been attempts to remove the GIL, and they lead to CPython be

Re: #define (from C) in Python

2009-11-12 Thread Santiago Romero
On 12 nov, 18:16, Stefan Behnel wrote: > Santiago Romero, 12.11.2009 17:43: > > > Is there a Python version of C's language #define statements? > > > Example: > > > #define ReadMem( (x) )    memory[ (x) ] > > Yes: > >         ReadMem = memory.__getitem__ > > Stefan Well, In the above concrete e

Re: ask a question about the module

2009-11-12 Thread Daniel Fetchinson
> Could not import module "Gnuplot" - it is not installed on your > system. You need to install the Gnuplot.py package. > \easyviz\gnuplot_.py(41) : > Traceback (most recent call last): > File "E:\study\python\commodity modle 10.23.py", line 3, in > import multipleloop as mp > File "E:\stu

  1   2   >