Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Elizabeth D Rather
On 8/20/10 7:42 PM, Standish P wrote: ... Admittedly, I am asking a question that would be thought provoking to those who claim to be "experts" but these experts are actually very stingy and mean business people, most certainly worse than Bill Gates, only it did not occur to them his ideas and at

Re: Iterative vs. Recursive coding

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 09:47:30 +0200, News123 wrote: > On 08/20/2010 02:26 AM, Steven D'Aprano wrote: >> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: >> >>> Recursion can be quite a trick to get your mind round at first >> >> Really? Do people actually find the *concept* of recursion

Re: Iterative vs. Recursive coding

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote: > Steven D'Aprano a écrit : >> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: >> >>> Recursion can be quite a trick to get your mind round at first >> >> Really? Do people actually find the *concept* of recursion to be >>

Re: Python "why" questions

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: > Most programmers probably never use vectors and matrices, so they don't > care about the inconsistency with standard mathematical notation. Perhaps you should ask the numpy programmers what they think about that. Vectors and matrices are just

Re: Python "why" questions

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 09:21:25 +0200, Kai Borgolte wrote: > Sorry about my previous posting with wrong references, this one should > be better. > > Steven D'Aprano wrote: > >>A simple example: Using zero-based indexing, suppose you want to indent >>the string "spam" so it starts at column 4. How m

Re: Iterative vs. Recursive coding

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 16:42:26 -0700, Baba wrote: > For future readers of this post who want to learn to programm (just like > myself) let me re-state the basics i have learned now: I would disagree in part with nearly all of these. > - a procedure is said to be recursive when it contains a statem

Re: String substitution VS proper mysql escaping

2010-08-21 Thread Lawrence D'Oliveiro
In message , Νίκος wrote: > I would expect that: > > ("nikos") is a single element tuple. Then how would you do a simple parenthesized expression? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Lawrence D'Oliveiro
In message , Rich Moss wrote: > Python developer needed for math/trading applications and research at > leading HFT firm. Wasn’t HFT an exacerbating factor in just about every major stockmarket downturn since, oh, 1987? -- http://mail.python.org/mailman/listinfo/python-list

Re: Open a command pipe for reading

2010-08-21 Thread Lawrence D'Oliveiro
In message , Rodrick Brown wrote: > Sent from my iPhone 4. Glad to hear you achieved it without losing the signal. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Iterative vs. Recursive coding

2010-08-21 Thread Baba
On Aug 21, 7:37 am, John Nagle wrote: > On 8/20/2010 1:17 PM, John Bokma wrote: > > > I think you mean tail recursion optimization / elimination. > > Python does tail recursion: > >     Not very well. > >      def cnt(n) : >          if n > 0 : >              cnt(n-1) > Hi John I'm intrigued by

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread David Kastrup
John Passaniti writes: > Amen! All this academic talk is useless. Who cares about things like > the big-O notation for program complexity. Can't people just *look* > at code and see how complex it is?! And take things like the years of > wasted effort computer scientists have put into taking

Re: Iterative vs. Recursive coding

2010-08-21 Thread Tim Chase
On 08/21/10 04:35, Baba wrote: On Aug 21, 7:37 am, John Nagle wrote: On 8/20/2010 1:17 PM, John Bokma wrote: I think you mean tail recursion optimization / elimination. Python does tail recursion: Not very well. def cnt(n) : if n> 0 : cnt(n-1) I'm intri

Re: Iterative vs. Recursive coding

2010-08-21 Thread Tim Chase
On 08/21/10 03:31, Steven D'Aprano wrote: On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote: I also was the only guy around that understood "hairy" (lol) concepts like callback functions, FSM, FSM? Flying Spaghetti Monster? I'm guessing "Finite State Machines". But in a way, "Fl

Re: make install DESTDIR

2010-08-21 Thread Thomas Jollans
On Saturday 21 August 2010, it occurred to aj to exclaim: > On Aug 20, 4:39 pm, Thomas Jollans wrote: > > On Saturday 21 August 2010, it occurred to aj to exclaim: > > > I am trying to install python with make install DESTDIR=/home/blah > > > > > > --prefix=/ > > > > ... > > > >

Re: Re: Iterative vs. Recursive coding

2010-08-21 Thread Dave Angel
Baba wrote: On Aug 21, 7:37 am, John Nagle wrote: On 8/20/2010 1:17 PM, John Bokma wrote: I think you mean tail recursion optimization / elimination. Python does tail recursion: Not very well. def cnt(n) : if n > 0 : cnt(n-1) Hi John I'm

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Alex McDonald
On 21 Aug, 06:42, Standish P wrote: > On Aug 20, 3:51 pm, Hugh Aguilar wrote: > > > > > On Aug 18, 6:23 pm, Standish P wrote: > > > > On Aug 17, 6:38 pm, John Passaniti wrote: > > > > > You asked if Forth "borrowed" lists from Lisp.  It did not.  In Lisp, > > > > lists are constructed with pair

Re: make install DESTDIR

2010-08-21 Thread Martin v. Loewis
> The whole point of DESTDIR is that it should be prepended to all > installed paths, but the binaries should not contain any references to > it.DESTDIR is commonly used by packagers, for example, to allow > installation without superuser privileges. So what is the point of your messages? Do you w

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread vsoler
On Aug 21, 8:10 am, Tim Golden wrote: > On 20/08/2010 11:54 PM, vsoler wrote: > > > I'am testing your library. I am mainly interested in knowing the > > access attributes of directories in the local(C:\) or shared unit(W:\) > > of my system. > > > Using your script with 'c:\\' I get an error messa

Re: Iterative vs. Recursive coding

2010-08-21 Thread Ian
On 21/08/2010 00:17, Ben Finney wrote: Steven D'Aprano writes: On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote: Recursion can be quite a trick to get your mind round at first Really? Do people actually find the *concept* of recursion to be tricky? Evidently so. It's folk wisdom

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread vsoler
On Aug 21, 8:10 am, Tim Golden wrote: > On 20/08/2010 11:54 PM, vsoler wrote: > > > I'am testing your library. I am mainly interested in knowing the > > access attributes of directories in the local(C:\) or shared unit(W:\) > > of my system. > > > Using your script with 'c:\\' I get an error messa

weakref.proxy behaviour in python 3.0

2010-08-21 Thread Nicholas Cole
Dear List, I've searched for information on this without success. Has weakref.proxy changed in Python 3? I couldn't see any note in the documentation, but the following code behaves differently on Python 2.6.1 and Python 3: import weakref class Test(object): pass realobject = Test() pobject =

vpython

2010-08-21 Thread kimjeng
im trying to build visual python on slackware 64bit 13.1 and i can not get beyond the configure stage, ... checking whether the g++ linker (/usr/x86_64-slackware-linux/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how

Re: Iterative vs. Recursive coding

2010-08-21 Thread Ian
On 21/08/2010 01:24, Martin Gregorie wrote: On Fri, 20 Aug 2010 16:22:44 -0700, Baba wrote: > For the purposes of learning programming i think it's a must to > understand Recursion so thanks all for your help! > That depends on the language and/or hardware. COBOL wouldn't understand recursi

open two files at once

2010-08-21 Thread robek
hi, what is the simplest way to open two files (one for reading and 2nd for writing) ? i usually do: with open('1') as f1: with open('2','w') as f2: for i in f1: do something with i f2.write(i) is there a simpler/better way to do this ? -- http://mail.python.org/mailman/listinfo/py

Re: open two files at once

2010-08-21 Thread Peter Otten
robek wrote: > what is the simplest way to open two files (one for reading and 2nd for > writing) ? > i usually do: > with open('1') as f1: >with open('2','w') as f2: > for i in f1: do something with i >f2.write(i) > > is there a simpler/better way to do this ? Yours is the best

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread Tim Golden
On 21/08/2010 1:01 PM, vsoler wrote: Personally, I am impressed of the power of python, your winsys library, and overall, how easy it is to customize the scripting of one's day to day needs. Glad you find it useful... I have started testing your first script from winsys import fs, security

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread Tim Golden
On 21/08/2010 1:01 PM, vsoler wrote: I am using a system in the Spanish language. As you can see in the last line, 'Acceso denegado' or 'Access denied' even though the flag "ignore_access_errors" is set to True. Sorry, meant to reply to this point as well. The ignore_access_errors flag only app

comp.lang.python

2010-08-21 Thread roshini begum
www.127760.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Mark Dickinson
On Aug 21, 1:13 pm, Nicholas Cole wrote: > I've searched for information on this without success.  Has > weakref.proxy changed in Python 3?  I couldn't see any note in the > documentation, but the following code behaves differently on Python > 2.6.1 and Python 3: > > import weakref > class Test(ob

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Nicholas Cole
On Sat, Aug 21, 2010 at 3:31 PM, Mark Dickinson wrote: [SNIP] > So my guess is that the change was unintentional. > > It's probably worth a bug report.  Even if the behaviour isn't going > to change in either 2.x or 3.x (and it probably isn't), it might be > possible to clarify the docs. Dear M

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Hugh Aguilar
On Aug 21, 5:29 am, Alex McDonald wrote: > On 21 Aug, 06:42, Standish P wrote: > > Admittedly, I am asking a question that would be thought > > provoking to those who claim to be "experts" but these experts are > > actually very stingy and mean business people, most certainly worse > > than Bill

Re: Iterative vs. Recursive coding

2010-08-21 Thread Michael Torrie
On 08/21/2010 03:03 AM, Steven D'Aprano wrote: >> - there must be a condition where the recursion has to stop otherwise >> the routine will continue to call itself infinitely. >> This is called the Base Case > > I agree with this, although I've never heard the name "Base Case" before. "Base Cas

I HACK $3500 FROM PAYPAL...

2010-08-21 Thread DAKSHA
I HACK $3500 FROM PAYPAL At http://quickpaypalmoney.tk i have hidden the PAYPAL FORM link in an image. in that website on Right Side below search box, click on image and enter your name and PAYPAL ID. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Raymond Hettinger
On Aug 21, 2:30 am, Lawrence D'Oliveiro wrote: > Wasn’t HFT an exacerbating factor in just about every major stockmarket > downturn since, oh, 1987? IMO, it was a mitigating factor. HFT firms provide liquidity and help price discovery. Investor sentiment is what drives rallys and crashes. Raymo

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Emile van Sebille
On 8/21/2010 10:32 AM Raymond Hettinger said... On Aug 21, 2:30 am, Lawrence D'Oliveiro wrote: Wasn’t HFT an exacerbating factor in just about every major stockmarket downturn since, oh, 1987? IMO, it was a mitigating factor. HFT firms provide liquidity and help price discovery. Investor sent

logging module -> Miss messages if don't flush constantly? How set to flush constantly?

2010-08-21 Thread Chris Seberino
It looks like I can miss some logging messages if I don't flush after every oneis that true? This is an issue when program crashes so that logger didn't get a chance to print everything. Is there some way to set logging to constantly flush? -- http://mail.python.org/mailman/listinfo/python-l

Re: logging module -> Miss messages if don't flush constantly? How set to flush constantly?

2010-08-21 Thread Peter Otten
Chris Seberino wrote: > It looks like I can miss some logging messages if I don't flush after > every oneis that true? As far as I can tell from the 2.6 source the StreamHandler does flush after each record. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Alex McDonald
On 21 Aug, 17:58, Hugh Aguilar wrote: > On Aug 21, 5:29 am, Alex McDonald wrote: > > > On 21 Aug, 06:42, Standish P wrote: > > > Admittedly, I am asking a question that would be thought > > > provoking to those who claim to be "experts" but these experts are > > > actually very stingy and mean b

Detect string has non-ASCII chars without checking each char?

2010-08-21 Thread python
Python 2.6: Is there a built-in way to check if a Unicode string has non-ASCII chars without having to check each char in the string? Here's my use case: I have a section of code that makes frequent calls to hasattr. The attribute name being tested is derived from incoming data which at times can

Re: weakref.proxy behaviour in python 3.0

2010-08-21 Thread Mark Dickinson
On Aug 21, 5:06 pm, Nicholas Cole wrote: > On Sat, Aug 21, 2010 at 3:31 PM, Mark Dickinson wrote: > > [SNIP] > > > So my guess is that the change was unintentional. > > > It's probably worth a bug report.  Even if the behaviour isn't going > > to change in either 2.x or 3.x (and it probably isn't

Re: Iterative vs. Recursive coding

2010-08-21 Thread John Nagle
On 8/21/2010 10:08 AM, Michael Torrie wrote: On 08/21/2010 03:03 AM, Steven D'Aprano wrote: - there must be a condition where the recursion has to stop otherwise the routine will continue to call itself infinitely. This is called the Base Case I agree with this, although I've never heard th

Re: Detect string has non-ASCII chars without checking each char?

2010-08-21 Thread Vlastimil Brom
2010/8/21 : > Python 2.6: Is there a built-in way to check if a Unicode string has > non-ASCII chars without having to check each char in the string? > > Here's my use case: I have a section of code that makes frequent calls to > hasattr. The attribute name being tested is derived from incoming da

psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread Julia Jacobson
Hello everybody out there using python, For the insertion of pictures into my PostgreSQL database [with table foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written the following script: #!/usr/bin/python import psycopg2 try: conn = psycopg2.connect("dbname='postgres' use

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread D'Arcy J.M. Cain
On Sat, 21 Aug 2010 22:58:00 +0200 Julia Jacobson wrote: > For the insertion of pictures into my PostgreSQL database [with table > foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written > the following script: > > #!/usr/bin/python > import psycopg2 > try: > conn = psycopg

Re: psycopg2 for insertion of binary data to PostgreSQL database

2010-08-21 Thread Peter Otten
Julia Jacobson wrote: > Hello everybody out there using python, > > For the insertion of pictures into my PostgreSQL database [with table > foo created by SQL command "CREATE TABLE foo (bmp BYTEA)], I've written > the following script: > > #!/usr/bin/python > import psycopg2 > try: > conn =

Re: Pop return from stack?

2010-08-21 Thread bvdp
On Aug 20, 6:41 pm, Gregory Ewing wrote: > bvdp wrote: > > The whole problem I was having is that I was trying to tie a small > > application (an helper to the main application) to use a bit of the > > existing code as a pseudo-library. > > This is precisely the reason that it's a bad idea to > di

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Lawrence D'Oliveiro
In message , Raymond Hettinger wrote: > On Aug 21, 2:30 am, Lawrence D'Oliveiro > wrote: > >> Wasn’t HFT an exacerbating factor in just about every major stockmarket >> downturn since, oh, 1987? > > IMO, it was a mitigating factor. > HFT firms provide liquidity and help price discovery. > Inves

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread John Bokma
David Kastrup writes: > John Passaniti writes: > >> Amen! All this academic talk is useless. Who cares about things like >> the big-O notation for program complexity. Can't people just *look* >> at code and see how complex it is?! And take things like the years of >> wasted effort computer s

Re: Iterative vs. Recursive coding

2010-08-21 Thread John Bokma
John Nagle writes: > On 8/20/2010 1:17 PM, John Bokma wrote: >> John Nagle writes: >> >>> Python does not do tail recursion, so using recursion >>> where iteration could do the job is generally a bad idea. Scheme, on >>> the other hand, always does tail recursion where possible. >> >> I th

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Scott MacDonald
Possibly relevant: http://www.nanex.net/FlashCrash/FlashCrashAnalysis_NBBO.html On Sat, Aug 21, 2010 at 4:22 PM, Lawrence D'Oliveiro wrote: > In message > , > Raymond > Hettinger wrote: > > > On Aug 21, 2:30 am, Lawrence D'Oliveiro > > > wrote: > > > >> Wasn’t HFT an exacerbating factor in jus

Re: Simple Python Sandbox

2010-08-21 Thread Gregory Ewing
Stephen Hansen wrote: Me, I'm going to go farther on my own installation and kill import entirely, and do a sort of require() which returns a special proxied version of an imported module Note that you can install an __import__ function in the builtins to provide this kind of functionality whi

Re: array manipulation-

2010-08-21 Thread Gregory Ewing
Aram Ter-Sarkissov wrote: I have an array (say, mat=rand(3,5)) from which I 'pull out' a row (say, s1=mat[1,]). The problem is, the shape of this row s1 is not [1,5], as I would expect, but rather [5,], which means that I can't, for example, concateante mat and s1 rowwise. Use a 2D slice: >>>

Re: Python Developer - HFT Trading firm - Chicago, IL

2010-08-21 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: Someone who doesn’t understand how positive feedback can lead to instabilities in a dynamical system. Let's hope the person they hire makes it his first task to introduce a big dollop of negative feedback into the system! -- Greg -- http://mail.python.org/mailman/li

Re: 79 chars or more?

2010-08-21 Thread Gregory Ewing
Roy Smith wrote: There was a fling a while ago with typesetting code in proportional spaced type. I think some of the "Effective C++" series from Addison-Wesley did that. Yuck. I don't think proportional spacing is necessarily a problem, as long as a font is used that makes all characters c

Re: 79 chars or more?

2010-08-21 Thread MRAB
Gregory Ewing wrote: Roy Smith wrote: There was a fling a while ago with typesetting code in proportional spaced type. I think some of the "Effective C++" series from Addison-Wesley did that. Yuck. I don't think proportional spacing is necessarily a problem, as long as a font is used that

Re: Simple Python Sandbox

2010-08-21 Thread Stephen Hansen
On 8/21/10 5:56 PM, Gregory Ewing wrote: > Stephen Hansen wrote: > >> Me, I'm going to go farther on my own installation and kill import >> entirely, and do a sort of require() which returns a special proxied >> version of an imported module > > Note that you can install an __import__ function in

Re: Iterative vs. Recursive coding

2010-08-21 Thread Steven D'Aprano
On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote: > this means that Python should eliminate / optimize tail > recursion. There have been various suggestions to add tail recursion optimization to the language. Two problems: * It throws away information from tracebacks if the recursive funct

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread Nobody
On Fri, 20 Aug 2010 19:41:44 +0200, Thomas Jollans wrote: >> "Create Folders" and "Delete Subfolders and Files" correspond to having >> write permission on a directory. > > How does append differ from write? If you have appending permissions, but not > writing ones, is it impossible to seek? Or

Re: vpython

2010-08-21 Thread Anssi Saari
kimjeng writes: > the thing is i have installed gtkglextmm both from source and via a > slackbuilds package script and i still get the same error, > help would be a appreciated You'll just have to check what it is configure actually tests for and figure out from that why your system doesn't pass

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Brad
On Aug 21, 3:36 am, David Kastrup wrote: > > I think there must be some programmer gene.  It is not enough to be able > to recognize O(n^k) or worse (though it helps having a more exact rather > than a fuzzy notion of them _if_ you have that gene).   Some of the best minds in comp.lang.forth have

Re: Detect string has non-ASCII chars without checking each char?

2010-08-21 Thread John Nagle
On 8/21/2010 1:21 PM, Vlastimil Brom wrote: 2010/8/21: Python 2.6: Is there a built-in way to check if a Unicode string has non-ASCII chars without having to check each char in the string? Here's my use case: I have a section of code that makes frequent calls to hasattr. The attribute name bein

Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?

2010-08-21 Thread Steven D'Aprano
Oh, I am so going to regret getting sucked into this tarpit... oh well. On Sat, 21 Aug 2010 09:58:18 -0700, Hugh Aguilar wrote: > The > following is a pretty good example, in which Alex mixes big pseudo- > intellectual words such as "scintilla" with gutter language such as > "turd" in an un