Re: [ANN]VTD-XML 2.9

2010-08-20 Thread John Krukoff
On Thu, 2010-08-19 at 17:40 -0700, dontcare wrote: VTD-XML 2.9, the next generation XML Processing API for SOA and Cloud computing, has been released. Please visit https://sourceforge.net/projects/vtd-xml/files/ to download the latest version. * Strict Conformance # VTD-XML now fully

IDLSave 0.9.7 released

2010-08-20 Thread Thomas Robitaille
I am happy to announce the availability of IDLSave 0.9.7. IDLSave is a pure Python module to import variables from IDL ‘save’ files into Python, and does not require IDL to work. I am also happy to announce that IDLSave is now also available via scipy.io. More information and download/installation

Re: String substitution VS proper mysql escaping

2010-08-20 Thread Nik Gr
Στις 20/8/2010 8:22 πμ, ο/η Cameron Simpson έγραψε: [...snip...] | Why does the page variable which is actually a string needs to be a | tuple or a list and not just as a string which is what it actually | is? With regard to the % operator, it considers the string on the left to be a format

Re: expression in an if statement

2010-08-20 Thread John Nagle
On 8/18/2010 3:12 PM, Thomas Jollans wrote: On Wednesday 18 August 2010, it occurred to John Nagle to exclaim: On 8/18/2010 11:24 AM, ernest wrote: Hi, In this code: if set(a).union(b) == set(a): pass Does Python compute set(a) twice? CPython does. Shed Skin might optimize. Don't

Re: Python why questions

2010-08-20 Thread Kai Borgolte
Russ P. wrote: A simple example: Using zero-based indexing, suppose you want to indent the string spam so it starts at column 4. How many spaces to you prepend? No, you won't want to indent a string so it starts at column 4. You simply want to indent the string by four spaces. Like in PEP 8:

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

2010-08-20 Thread Standish P
On Aug 19, 8:25 am, c...@tiac.net (Richard Harter) wrote: On Wed, 18 Aug 2010 01:39:09 -0700 (PDT), Nick Keighley nick_keighley_nos...@hotmail.com wrote: On 17 Aug, 18:34, Standish P stnd...@gmail.com wrote: How are these heaps being implemented ? Is there some illustrative code or a book

Re: Python why questions

2010-08-20 Thread Kai Borgolte
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 many spaces to you prepend? No, you won't want to indent a string so

Re: Assert statements in python 3.1

2010-08-20 Thread Mark Dickinson
On Aug 20, 6:13 am, genxtech jrmy.l...@gmail.com wrote: This is more of a curiosity question then anything else...  I was just wondering why in version 3 of python assertions weren't converted to use parenthesis, since print was. I am just asking because it seems the following line of code

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread Tim Golden
I currently do not have subversion access in my PC. I could try to install a free copy of it. But it you could ptovide an installer, it certainly would do things easier. Please let me know if it is possible. Vicente, can you just confirm that you received the installer I sent offlist? I'll try

Re: Iterative vs. Recursive coding

2010-08-20 Thread News123
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 to be tricky? Is this a sincere surprise or are you just

A question to experienced Pythoneers

2010-08-20 Thread Rony
Here's the story : I've been hired by a company as a consultant to reorganise there development department. The actual situation is : The manager of the development has been fired, main reason (what they told me) is that they have big big troubles in keeping deadlines ! For there last product, for

Re: Iterative vs. Recursive coding

2010-08-20 Thread Navkirat Singh
On 20-Aug-2010, at 1:17 PM, 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 to be tricky? Is

Re: Iterative vs. Recursive coding

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 12:47 AM, News123 news1...@free.fr 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

Re: Python why questions

2010-08-20 Thread Martin Braun
On Thu, Aug 19, 2010 at 07:13:50PM +, Steven D'Aprano wrote: Mathematics is an ancient art that values tradition and convention. It doesn't matter how hard it was to come up with a proof, or how difficult to verify it. Mathematicians value logical correctness and some undefinable sense

Re: A question to experienced Pythoneers

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 1:16 AM, Rony k...@kara-moon.com wrote: Here's the story : I've been hired by a company as a consultant to reorganise there development department. The actual situation is : The manager of the development has been fired, main reason (what they told me) is that they

Re: A question to experienced Pythoneers

2010-08-20 Thread Rony
On Aug 20, 11:25 am, geremy condra debat...@gmail.com wrote: 1) Don't take this the wrong way, but get in the habit of using proper grammar and spelling. Especially as a consultant. It will make the job of convincing people to take you seriously that much easier. I don't take it the wrong way

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread Dave Angel
m_ahlenius wrote: Hi, I am relatively new to doing serious work in python. I am using it to access a large number of log files. Some of the logs get corrupted and I need to detect that when processing them. This code seems to work for quite a few of the logs (all same structure) It also

Re: A question to experienced Pythoneers

2010-08-20 Thread Lawrence D'Oliveiro
In message 8d1b76b7-1ba3-49c5-97cf-dc3837050...@y11g2000yqm.googlegroups.com, Rony wrote: The manager of the development has been fired, main reason (what they told me) is that they have big big troubles in keeping deadlines ! For there last product, for which they estimated 3 man years of

Re: OpenCV_Problem

2010-08-20 Thread Rami Chowdhury
On Thu, Aug 19, 2010 at 13:47, arihant nahata forever.arih...@gmail.com wrote: I m new to python and openCV. i installed openCV and python and copied the necessary folder. and even appended the sys.path. but then too the same error. from opencv import cv File

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread m_ahlenius
On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python.  I am using it to access a large number of log files.  Some of the logs get corrupted and I need to detect that when processing them.  This code seems to work

Re: A question to experienced Pythoneers

2010-08-20 Thread Rami Chowdhury
On Fri, Aug 20, 2010 at 15:25, geremy condra debat...@gmail.com wrote: On Fri, Aug 20, 2010 at 1:16 AM, Rony k...@kara-moon.com wrote: Here's the story : I've been hired by a company as a consultant to reorganise there development department. [snip] One of my plans is to introduce Python as

Re: 79 chars or more?

2010-08-20 Thread Roy Smith
In article 4c6dfb31$0$1$c3e8...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Of course source code is written in a monospaced typeface, which is a little wider and consequently fewer characters per page. There was a fling a while ago with typesetting

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

2010-08-20 Thread Malcolm McLean
On Aug 19, 2:14 pm, spinoza spinoza1...@yahoo.com wrote: All the rest [how to implement heaps] is detail for the little techies to normally, get wrong. That's a fundamental feature of structured programming. If we maintain the interface malloc(), realloc(), and free(), then we could have a

Re: 79 chars or more?

2010-08-20 Thread Neil Cerutti
On 2010-08-20, Roy Smith r...@panix.com wrote: In article 4c6dfb31$0$1$c3e8...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Of course source code is written in a monospaced typeface, which is a little wider and consequently fewer characters per page.

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread m_ahlenius
On Aug 20, 6:57 am, m_ahlenius ahleni...@gmail.com wrote: On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python.  I am using it to access a large number of log files.  Some of the logs get corrupted and I

Get authentication error while using 'smtplib'

2010-08-20 Thread Mahmood Naderan
I have this script to send an email via SMTP: import smtplib smtpserver = 'smtp.server.com' AUTHREQUIRED = 1# if you need to use SMTP AUTH set to 1 smtpuser = username# for SMTP AUTH, set SMTP username here smtppass = password# for SMTP AUTH, set SMTP password here RECIPIENTS

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-20 13:11, Lawrence D'Oliveiro wrote: In message 8d1b76b7-1ba3-49c5-97cf-dc3837050...@y11g2000yqm.googlegroups.com, Rony wrote: The manager of the development has been fired, main reason (what they told me) is that they have big big troubles in keeping deadlines ! For

Re: 79 chars or more?

2010-08-20 Thread Bruno Desthuilliers
Stefan Schwarzer a écrit : Hi Neil, On 2010-08-17 14:42, Neil Cerutti wrote: (snip) Looking through my code, the split-up lines almost always include string literals or elimination of meaningless temporary variables, e.g.: self.expiration_date = translate_date(find(response,

Re: 79 chars or more?

2010-08-20 Thread Neil Cerutti
On 2010-08-20, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: make this : self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y' ) I just HATE

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread Dave Angel
m_ahlenius wrote: On Aug 20, 6:57 am, m_ahlenius ahleni...@gmail.com wrote: On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python. I am using it to access a large number of log files. Some

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Rony, On 2010-08-20 10:16, Rony wrote: Here's the story : I've been hired by a company as a consultant to reorganise there development department. The actual situation is : The manager of the development has been fired, main reason (what they told me) is that they have big big troubles

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 9:36 am, Tim Golden m...@timgolden.me.uk wrote: I currently do not have subversion access in my PC. I could try to install a free copy of it. But it you could ptovide an installer, it certainly would do things easier. Please let me know if it is possible. Vicente, can you just

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread Peter Otten
m_ahlenius wrote: On Aug 20, 6:57 am, m_ahlenius ahleni...@gmail.com wrote: On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python. I am using it to access a large number of log files. Some of the logs

Re: A question to experienced Pythoneers

2010-08-20 Thread Rony
It looks like I forgot to specify that the product is a totaly new product build from scratch, not an upgrade from an existing product. Interesting answers ! Rony -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 9:36 am, Tim Golden m...@timgolden.me.uk wrote: I currently do not have subversion access in my PC. I could try to install a free copy of it. But it you could ptovide an installer, it certainly would do things easier. Please let me know if it is possible. Vicente, can you just

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 4:26 pm, vsoler vicente.so...@gmail.com wrote: On Aug 20, 9:36 am, Tim Golden m...@timgolden.me.uk wrote: I currently do not have subversion access in my PC. I could try to install a free copy of it. But it you could ptovide an installer, it certainly would do things easier.

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-20 Thread ata.jaf
On Aug 19, 11:48 am, Steven D'Aprano steve-REMOVE- t...@cybersource.com.au wrote: On Thu, 19 Aug 2010 01:29:51 -0700, ata.jaf wrote: On Aug 17, 11:55 pm, Thomas Jollans tho...@jollybox.de wrote: On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim: I am developing a little program

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread Tim Golden
On 20/08/2010 15:49, vsoler wrote: On Aug 20, 4:26 pm, vsolervicente.so...@gmail.com wrote: On Aug 20, 9:36 am, Tim Goldenm...@timgolden.me.uk wrote: I currently do not have subversion access in my PC. I could try to install a free copy of it. But it you could ptovide an installer, it

Re: A question to experienced Pythoneers

2010-08-20 Thread Bruno Desthuilliers
Rony a écrit : It looks like I forgot to specify that the product is a totaly new product build from scratch, not an upgrade from an existing product. Still the advice to first find out what went wrong with the previous project is a very sensible one. Technical problems do exist, but from

Re: Iterative vs. Recursive coding

2010-08-20 Thread Bruno Desthuilliers
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 tricky? I onced worked in a shop (Win32 desktop / accouting applications

Re: Iterative vs. Recursive coding

2010-08-20 Thread Michel Claveau - MVP
Salut ! C'est cela, la solitude du programmeur génial... @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib quote problem

2010-08-20 Thread Aahz
In article 4c5eef7f$0$1609$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: This looks like code that will do the wrong thing in Python 2.6 for characters in the range 128-255. Those are illegal in type str, but this code is constructing such values with chr. WDYM illegal? --

Re: Iterative vs. Recursive coding

2010-08-20 Thread Bruno Desthuilliers
Michel Claveau - MVP a écrit : Salut ! C'est cela, la solitude du programmeur génial... @-salutations Moi aussi je t'aime, Michel !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: requirements in writing an email/rss/usenet client?

2010-08-20 Thread Aahz
In article eb32afd4-a231-4582-89c8-e927c2ff6...@t5g2000prd.googlegroups.com, George Oliver georgeolive...@gmail.com wrote: I'd like to know what to consider when writing an email/rss/usenet client. Apologies for such a broad question, but I've never attempted a project of this scope and I'm

Re: A question to experienced Pythoneers

2010-08-20 Thread Aahz
In article 8d1b76b7-1ba3-49c5-97cf-dc3837050...@y11g2000yqm.googlegroups.com, Rony k...@kara-moon.com wrote: The manager of the development has been fired, main reason (what they told me) is that they have big big troubles in keeping deadlines ! For there last product, for which they estimated 3

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 5:10 pm, Tim Golden m...@timgolden.me.uk wrote: On 20/08/2010 15:49, vsoler wrote: On Aug 20, 4:26 pm, vsolervicente.so...@gmail.com  wrote: On Aug 20, 9:36 am, Tim Goldenm...@timgolden.me.uk  wrote: I currently do not have subversion access in my PC. I could try to install

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-20 Thread Rami Chowdhury
On Fri, Aug 20, 2010 at 21:02, ata.jaf a.j.romani...@gmail.com wrote: On Aug 19, 11:48 am, Steven D'Aprano steve-REMOVE- t...@cybersource.com.au wrote: On Thu, 19 Aug 2010 01:29:51 -0700, ata.jaf wrote: On Aug 17, 11:55 pm, Thomas Jollans tho...@jollybox.de wrote: On Tuesday 17 August 2010,

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 5:10 pm, Tim Golden m...@timgolden.me.uk wrote: On 20/08/2010 15:49, vsoler wrote: On Aug 20, 4:26 pm, vsolervicente.so...@gmail.com  wrote: On Aug 20, 9:36 am, Tim Goldenm...@timgolden.me.uk  wrote: I currently do not have subversion access in my PC. I could try to install

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread m_ahlenius
On Aug 20, 9:10 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: On Aug 20, 6:57 am, m_ahlenius ahleni...@gmail.com wrote: On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python.  I am using it to access

Re: Iterative vs. Recursive coding

2010-08-20 Thread John Nagle
On 8/20/2010 12:47 AM, 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 to be tricky? Is this a

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread m_ahlenius
On Aug 20, 9:25 am, Peter Otten __pete...@web.de wrote: m_ahlenius wrote: On Aug 20, 6:57 am, m_ahlenius ahleni...@gmail.com wrote: On Aug 20, 5:34 am, Dave Angel da...@ieee.org wrote: m_ahlenius wrote: Hi, I am relatively new to doing serious work in python.  I am using it

Re: Iterative vs. Recursive coding

2010-08-20 Thread Neil Cerutti
On 2010-08-20, John Nagle na...@animats.com wrote: 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. A tail-recursive function is usually easy to convert to a

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread Tim Golden
On 20/08/2010 5:10 PM, vsoler wrote: On Aug 20, 5:10 pm, Tim Goldenm...@timgolden.me.uk wrote: To decode the permission bit-strings to vaguely meaningful names: code import os, sys from winsys import fs dacl = fs.file (sys.executable).security ().dacl for permission in dacl: print

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread Thomas Jollans
On Friday 20 August 2010, it occurred to Nobody to exclaim: Unix lacks the Append Data permission for files, and the Create Files, 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

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread Peter Otten
m_ahlenius wrote: I am using Python 2.6.5. Unfortunately I don't have other versions installed so its hard to test with a different version. As for the log compression, its a bit hard to test. Right now I may process 100+ of these logs per night, and will get maybe 5 which are reported

Re: Python why questions

2010-08-20 Thread Russ P.
On Aug 20, 1:23 am, Martin Braun martin.br...@kit.edu wrote: I find this thread extremely interesting, but what surprised me that everyone seems to agree that mathematics is 1-based, but we Pythoneers should stick to zero-based. I disagree. To make sure I'm not going crazy, I took the top

scope of variable

2010-08-20 Thread M B
Hi, I try to learn python. I don't understand this: (running in idle) dept=0 def mud(): print dept mud() 0 def mud(): dept+=1 print dept mud() Traceback (most recent call last): File pyshell#7, line 1, in module mud() File pyshell#6, line

Re: Python why questions

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 11:01 AM, Russ P. russ.paie...@gmail.com wrote: On Aug 20, 1:23 am, Martin Braun martin.br...@kit.edu wrote: I find this thread extremely interesting, but what surprised me that everyone seems to agree that mathematics is 1-based, but we Pythoneers should stick to

Re: scope of variable

2010-08-20 Thread Chris Rebert
On Fri, Aug 20, 2010 at 11:09 AM, M B zna...@telia.com wrote: Hi, I try to learn python. I don't understand this: snip dept=0 snip def mud():        dept+=1        print dept mud() Traceback (most recent call last):  File pyshell#7, line 1, in module    mud()  File pyshell#6, line 2,

Re: scope of variable

2010-08-20 Thread Rony
On Aug 20, 8:25 pm, Chris Rebert c...@rebertia.com wrote: On Fri, Aug 20, 2010 at 11:09 AM, M B zna...@telia.com wrote: Hi, I try to learn python. I don't understand this: snip dept=0 snip def mud():        dept+=1        print dept mud() Traceback (most recent call last):  

Re: A question to experienced Pythoneers

2010-08-20 Thread Martin Gregorie
On Fri, 20 Aug 2010 17:16:14 +0200, Bruno Desthuilliers wrote: Rony a écrit : It looks like I forgot to specify that the product is a totaly new product build from scratch, not an upgrade from an existing product. Still the advice to first find out what went wrong with the previous

Re: urllib quote problem

2010-08-20 Thread John Nagle
On 8/20/2010 8:41 AM, Aahz wrote: In article4c5eef7f$0$1609$742ec...@news.sonic.net, John Naglena...@animats.com wrote: This looks like code that will do the wrong thing in Python 2.6 for characters in the range 128-255. Those are illegal in type str, but this code is constructing such

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-20 Thread John Nagle
On 8/20/2010 9:07 AM, Rami Chowdhury wrote: On Fri, Aug 20, 2010 at 21:02, ata.jafa.j.romani...@gmail.com wrote: On Aug 19, 11:48 am, Steven D'Apranosteve-REMOVE- t...@cybersource.com.au wrote: On Thu, 19 Aug 2010 01:29:51 -0700, ata.jaf wrote: On Aug 17, 11:55 pm, Thomas

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-20 Thread Thomas Jollans
On Thursday 19 August 2010, it occurred to ata.jaf to exclaim: On Aug 17, 11:55 pm, Thomas Jollans tho...@jollybox.de wrote: On Tuesday 17 August 2010, it occurred to ata.jaf to exclaim: I am developing a little program in Mac with wxPython. But I have problems with the characters that

Re: urllib quote problem

2010-08-20 Thread Robert Kern
On 8/20/10 1:50 PM, John Nagle wrote: On 8/20/2010 8:41 AM, Aahz wrote: In article4c5eef7f$0$1609$742ec...@news.sonic.net, John Naglena...@animats.com wrote: This looks like code that will do the wrong thing in Python 2.6 for characters in the range 128-255. Those are illegal in type str, but

Re: [ANN]VTD-XML 2.9

2010-08-20 Thread John Krukoff
On Thu, 2010-08-19 at 17:40 -0700, dontcare wrote: VTD-XML 2.9, the next generation XML Processing API for SOA and Cloud computing, has been released. Please visit https://sourceforge.net/projects/vtd-xml/files/ to download the latest version. * Strict Conformance # VTD-XML now fully

Re: urllib quote problem

2010-08-20 Thread MRAB
John Nagle wrote: On 8/20/2010 8:41 AM, Aahz wrote: In article4c5eef7f$0$1609$742ec...@news.sonic.net, John Naglena...@animats.com wrote: This looks like code that will do the wrong thing in Python 2.6 for characters in the range 128-255. Those are illegal in type str, but this code is

Re: scope of variable

2010-08-20 Thread Burton Samograd
M B zna...@telia.com writes: Hi, dept=0 def mud(): print dept mud() 0 def mud(): dept+=1 print dept You should add a global statement or else python thinks a variable used is a local: def mud(): global dept dept+=1 print dept -- Burton

How to Customize the New 2.7 ArgumentParser Library Class (module argparse)?

2010-08-20 Thread Tom Browder
I have converted from OptionParser to ArgumentParser (new in version 2.7) to great advantage, and I think it's a great improvement! But now I want to customize the help formatting just a bit. The documentation is sketchy here, but I started by subclassing ArgumentParser and attempted to redefine

Re: Python why questions

2010-08-20 Thread Russ P.
On Aug 20, 11:19 am, geremy condra debat...@gmail.com wrote: Not sure what you read, but for me (mostly number theory, numerical analysis, and abstract algebra) zero-based indexing is quite common. My background is in aerospace control engineering. I am certainly not familiar with the

Re: How to convert bytearray into integer?

2010-08-20 Thread Thomas Jollans
On Tuesday 17 August 2010, it occurred to Jacky to exclaim: On Aug 17, 3:38 am, Thomas Jollans tho...@jollybox.de wrote: On Monday 16 August 2010, it occurred to Jacky to exclaim: it's hard to image why socket object provides the interface: socket.recv_from(buf[, num_bytes[, flags]]) but

Re: scope of variable

2010-08-20 Thread M B
fre 2010-08-20 klockan 13:19 -0600 skrev Burton Samograd: M B zna...@telia.com writes: Hi, dept=0 def mud(): print dept mud() 0 def mud(): dept+=1 print dept You should add a global statement or else python thinks a variable used is a local: def

Re: Python why questions

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 12:31 PM, Russ P. russ.paie...@gmail.com wrote: On Aug 20, 11:19 am, geremy condra debat...@gmail.com wrote: Not sure what you read, but for me (mostly number theory, numerical analysis, and abstract algebra) zero-based indexing is quite common. My background is in

Re: Iterative vs. Recursive coding

2010-08-20 Thread John Bokma
John Nagle na...@animats.com 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 think you mean tail recursion optimization / elimination. Python

Re: How to Customize the New 2.7 ArgumentParser Library Class (module argparse)?

2010-08-20 Thread Peter Otten
Tom Browder wrote: I have converted from OptionParser to ArgumentParser (new in version 2.7) to great advantage, and I think it's a great improvement! But now I want to customize the help formatting just a bit. The documentation is sketchy here, but I started by subclassing ArgumentParser

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

2010-08-20 Thread Hugh Aguilar
On Aug 18, 6:23 pm, Standish P stnd...@gmail.com wrote: On Aug 17, 6:38 pm, John Passaniti john.passan...@gmail.com wrote: You asked if Forth borrowed lists from Lisp.  It did not.  In Lisp, lists are constructed with pair of pointers called a cons cell. That is the most primitive

Re: Reading the access attributes of directories in Windows

2010-08-20 Thread vsoler
On Aug 20, 7:42 pm, Tim Golden m...@timgolden.me.uk wrote: On 20/08/2010 5:10 PM, vsoler wrote: On Aug 20, 5:10 pm, Tim Goldenm...@timgolden.me.uk  wrote: To decode the permission bit-strings to vaguely meaningful names: code import os, sys from winsys import fs dacl = fs.file

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

2010-08-20 Thread Hugh Aguilar
On Aug 18, 6:13 pm, Standish P stnd...@gmail.com wrote: Mostly it had a snowball's chance because it was never picked up by the CS gurus who, AFAIK, never really took a serious look at it. Its quite possible that the criticism is unfair, but dont you think that in part some responsibility

Re: Iterative vs. Recursive coding

2010-08-20 Thread Ben Finney
Steven D'Aprano st...@remove-this-cybersource.com.au 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

make install DESTDIR

2010-08-20 Thread aj
I am trying to install python with make install DESTDIR=/home/blah ./python -E ./setup.py install \ --prefix=/ \ --install-scripts=//bin \ --install-platlib=//lib/python2.6/lib-dynload \ --root=//home/blah running install running

Re: Iterative vs. Recursive coding

2010-08-20 Thread Baba
Hi Martin Thanks for your post. This basic but fundamental computation is a great example when trying to understand the concept of recursion for the first time. Also thanks to John for the stackoverflow link where i found a very good summarised definition completing some of the posts left here.

Re: make install DESTDIR

2010-08-20 Thread Thomas Jollans
On Saturday 21 August 2010, it occurred to aj to exclaim: I am trying to install python with make install DESTDIR=/home/blah --prefix=/ ... creating /lib/python2.6 error: could not create '/lib/python2.6': Permission denied make: *** [sharedinstall] Error 1 Obviously,

Re: Iterative vs. Recursive coding

2010-08-20 Thread Baba
On Aug 19, 11:00 pm, Martin Gregorie mar...@address-in-sig.invalid wrote: By way of a hint, here are two versions of the classic example of recursion: calculating factorials. Recursion can be quite a trick to get your mind round at first, so compare the two and follow through their operation

Re: Iterative vs. Recursive coding

2010-08-20 Thread Thomas Jollans
On Saturday 21 August 2010, it occurred to Baba to exclaim: - every time the procedure calls itself the memory gradually fills up with the copies until the whole thing winds down again as the return statements start being executed. - the above point means that a recursive approach is

Re: Python why questions

2010-08-20 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: That is not some kind of ordinal numbering of the terms, that is the power of the variable involved. It's both. Convention is to make the power and the index of the coefficent the same, because it would be pointlessly confusing to do anything else. -- Greg --

Re: Python why questions

2010-08-20 Thread Gregory Ewing
Martin Gregorie wrote: On Mon, 16 Aug 2010 12:33:51 +1200, Gregory Ewing wrote: Ian Kelly wrote: On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie mar...@address-in-sig.invalid wrote: real sample[-500:750]; Ugh, no. The ability to change the minimum index is evil. Not always;

Re: Python why questions

2010-08-20 Thread Gregory Ewing
Robert Kern wrote: On 8/16/10 9:29 PM, Roy Smith wrote: In articlei4cqg0$ol...@lust.ihug.co.nz, Lawrence D'Oliveirol...@geek-central.gen.new_zealand wrote: In messageroy-ee1b7f.21001716082...@news.panix.com, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in

Re: Python why questions

2010-08-20 Thread Gregory Ewing
J.B. Brown wrote: Then users of my class (mainly my research lab coworkers) could specify whichever behavior they wanted. In terms of providing readable code and removing beginning programmer confusion, But having some arrays indexed from 0 and others from 1 can be a recipe for confusion in

Re: Iterative vs. Recursive coding

2010-08-20 Thread Martin Gregorie
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 recursion if hit on the head with a recursion brick and

Re: make install DESTDIR

2010-08-20 Thread aj
On Aug 20, 4:39 pm, Thomas Jollans tho...@jollybox.de 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=/ ... creating /lib/python2.6 error: could not create '/lib/python2.6':

Re: Python why questions

2010-08-20 Thread Gregory Ewing
Martin Braun wrote: Another thing worth mentioning (I guess here is a good a place as any other) is the fact that programming and mathematics are still pretty different things, despite how much we programmers would like to think ourselves as some kind of mathematician. Although when it

Re: Python why questions

2010-08-20 Thread Gregory Ewing
Russ P. wrote: It all boils down to personal preference, but I just find it strange that we would not try to make programming as consistent as possible with notational conventions in the literature. It doesn't matter how much mathematical convention you quote, your assertion that 1-based

Re: Pop return from stack?

2010-08-20 Thread Gregory Ewing
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 directly terminate the program from somewhere deep inside

Re: Simple Python Sandbox

2010-08-20 Thread Stephen Hansen
On 8/16/10 7:01 AM, Roland Koebler wrote: On Sat, Aug 14, 2010 at 08:01:00PM -0700, Stephen Hansen wrote: As you can see, black listing isn't the best approach here. But I have a two pronged strategy: the black list is only half of the equation. One, I'm blacklisting all the meta functions

Re: Problem with tarfile module to open *.tar.gz files - unreliable ?

2010-08-20 Thread m_ahlenius
On Aug 20, 12:55 pm, Peter Otten __pete...@web.de wrote: m_ahlenius wrote: I am using Python 2.6.5. Unfortunately I don't have other versions installed so its hard to test with a different version. As for the log compression, its a bit hard to test.  Right now I may process 100+ of

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

2010-08-20 Thread John Passaniti
On Aug 20, 6:51 pm, Hugh Aguilar hughaguila...@yahoo.com wrote: You can see an example of lists in my novice package (in the list.4th file):http://www.forth.org/novice.html Also in there is symtab, which is a data structure intended to be used for symbol tables (dictionaries). Almost nobody

Re: 79 chars or more?

2010-08-20 Thread Lawrence D'Oliveiro
In message mailman.2230.1282037319.1673.python-l...@python.org, Jean-Michel Pichavant wrote: Saying that, if one intend to distribute its code, he should stick to 80 chars per line. Why? -- http://mail.python.org/mailman/listinfo/python-list

OI VEY, I AGREE -was once [Re: How far can stack [LIFO] solve do automatic garbage collection and prevent memory leak ?]

2010-08-20 Thread Richard Owlett
John Passaniti wrote: On Aug 20, 6:51 pm, Hugh Aguilarhughaguila...@yahoo.com wrote: You can see an example of lists in my novice package (in the list.4th file):http://www.forth.org/novice.html Also in there is symtab, which is a data structure intended to be used for symbol tables

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

2010-08-20 Thread Standish P
On Aug 18, 8:05 pm, Elizabeth D Rather erat...@forth.com wrote: On 8/18/10 2:23 PM, Standish P wrote: On Aug 17, 6:38 pm, John Passanitijohn.passan...@gmail.com  wrote: You asked if Forth borrowed lists from Lisp.  It did not.  In Lisp, lists are constructed with pair of pointers called a

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

2010-08-20 Thread Standish P
On Aug 20, 3:51 pm, Hugh Aguilar hughaguila...@yahoo.com wrote: On Aug 18, 6:23 pm, Standish P stnd...@gmail.com wrote: On Aug 17, 6:38 pm, John Passaniti john.passan...@gmail.com wrote: You asked if Forth borrowed lists from Lisp.  It did not.  In Lisp, lists are constructed with

  1   2   >