Leo 4.4.4 beta 3 released

2007-10-23 Thread Edward K Ream
Leo 4.4.4 beta 3 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106 Leo 4.4.4 contains many important features originally planned for later releases. It's been a good month :-) Leo is a text editor, data organizer, project manager and much more. See:

Re: Monitoring external processes

2007-10-23 Thread Graham Dumpleton
On Oct 23, 3:09 pm, [EMAIL PROTECTED] wrote: Hi, Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Thanks Sunil If using Python 2.3/2.4, you can use os.wait(). If using Python 2.5, there is also have os.wait3()

Re: ignoring chinese characters parsing xml file

2007-10-23 Thread Stefan Behnel
Fabian López wrote: Thanks Mark, the code is like this. The attrib name is the problem: from lxml import etree context = etree.iterparse(file.xml) for action, elem in context: if elem.tag == weblog: print action, elem.tag , elem.attrib[name],elem.attrib[url], The problem is

Re: ignoring chinese characters parsing xml file

2007-10-23 Thread limodou
On 10/23/07, Fabian López [EMAIL PROTECTED] wrote: Hi, I am parsing an XML file that includes chineses characters, like ^�u�u啖啖才是�w.���扉L锍才是�� or ヘアアイロン... The problem is that I get an error like: UnicodeEncodeerror:'charmap' codec can't encode characters in position The thing is that I

Microsoft drops appeal of European antitrust case

2007-10-23 Thread j.d.walker
On Oct 22, 9:25 pm, [EMAIL PROTECTED] wrote: Microsoft drops appeal of European antitrust case template_bas template_bas The software giant, which faces a $1 billion fine, will make some of its Windows operating system code available so developers can better design products for it. By Jim

It's The Oil

2007-10-23 Thread j.d.walker
On Oct 22, 9:34 pm, [EMAIL PROTECTED] wrote: Hiroshima,Nagasaki,Genocide in Australia and North America http://countercurrents.org/holt221007.htm It's The Oil By Jim Holt 22 October, 2007 London Review Of Books Iraq is 'unwinnable', a 'quagmire', a 'fiasco': so goes the received

The finger of suspicion

2007-10-23 Thread j.d.walker
On Oct 22, 9:51 pm, [EMAIL PROTECTED] wrote: The time of fall The fake anthrax letters The absence of pentagon video, the most highly defended building The thermate residue The molten metal pools The pyroclastic flow of dust The shattering of the whole building into dust and small pieces

Re: ignoring chinese characters parsing xml file

2007-10-23 Thread limodou
On 10/23/07, Stefan Behnel [EMAIL PROTECTED] wrote: Fabian López wrote: Thanks Mark, the code is like this. The attrib name is the problem: from lxml import etree context = etree.iterparse(file.xml) for action, elem in context: if elem.tag == weblog: print action,

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Mon, 22 Oct 2007 17:31:51 -0600, Steven Bethard wrote: Bruno Desthuilliers wrote: Computed attributes are IMHO not only a life-saver when it comes to refactoring. There are cases where you *really* have - by 'design' I'd say - the semantic of a property, but know from the start you'll

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Bruno Desthuilliers
Steven Bethard a écrit : Bruno Desthuilliers wrote: Steven Bethard a écrit : (snip) In Python, you can use property() to make method calls look like attribute access. This could be necessary if you have an existing API that used public attributes, but changes to your code require those

Re: Iteration for Factorials

2007-10-23 Thread Hendrik van Rooyen
Marco Mariani marcarta.com wrote: I don't see how my answer is in any way worse than those based on lambda. Maybe I'm just envious because when I was his age I couldn't google for answers. He should at least be able to do that, shouldn't he? But wait. That would mean understanding

Re: Need help parsing with pyparsing...

2007-10-23 Thread Hendrik van Rooyen
Paul McGuire ptstin.rr.com wrote: By the way, are these possible data lines?: A Line With No Upper Case Words A LINE WITH NO TITLE CASE WORDS SOME UPPER CASE WORDS A Title That Begins With A One Letter Word That last one is a killer, and comes under the heading of cruel and unusual.

Re: Need help parsing with pyparsing...

2007-10-23 Thread Hendrik van Rooyen
Just Another Victim of the Ambient Morality ihatemail.com wrote: FAHRENHEIT 451 2000 Copies Sold 1984 Book Of The Year The last example is actually okay but the first one is honestly ambiguous. hey - Fahrenheit 451 - if my memory serves me correctly, by Ray Bradbury, is a classic of

Re: Write by logging.FileHandler to one file by many processess

2007-10-23 Thread Vinay Sajip
On Oct 18, 4:08 am, Gabriel Genellina [EMAIL PROTECTED] wrote: Yes, output from several processes comes horribly mixed... I've avoided it using separate log files for each process; but if that's not possible, one could try using syslog or a SocketHandler and a separate listening process. The

Re: Iteration for Factorials

2007-10-23 Thread cokofreedom
On Oct 23, 8:53 am, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Marco Mariani marcarta.com wrote: I don't see how my answer is in any way worse than those based on lambda. Maybe I'm just envious because when I was his age I couldn't google for answers. He should at least be able to do

Re: Python - why don't this script work?

2007-10-23 Thread cokofreedom
On Oct 23, 6:50 am, Ohmster [EMAIL PROTECTED] wrote: Adam Atlas [EMAIL PROTECTED] wrote in news:1193108392.089611.91170 @v29g2000prd.googlegroups.com: I think you're executing it as a shell script. Run python image- harvester.py, or add #!/usr/bin/env python to the top of the file. Hey

Anagrams

2007-10-23 Thread cokofreedom
This was from a random website I found on practising good programming techniques and I thought I'd see what ways people could find to write out this example. Below are my two examples (which should work...). I am merely interested in other techniques people have (without resorting to overusage of

Re: C++ version of the C Python API?

2007-10-23 Thread Martin Marcher
2007/10/21, Robert Dailey [EMAIL PROTECTED]: On 10/21/07, Martin v. Löwis [EMAIL PROTECTED] wrote: No, I literally meant that the Python C API is object-oriented. You don't need an object-oriented language to write object-oriented code. I disagree with this statement. C is not an object

How to implement function like this?

2007-10-23 Thread Yinghe Chen
Hello gurus, I have a question, a function like below, it is implemented by me, :) def funcA(tarray): a = [2,3,4] if len(tarray) =3: return a[0],a[1], a[2] elif len(tarray) == 2: return a[0],a[1], funcB(1)[0] elif len(tarray) == 1:

Re: Monitoring external processes

2007-10-23 Thread Simon Brunning
On 10/23/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Depending on how much detail you are looking for, PSI might be worth a look. http://www.psychofx.com/psi/ --

Re: How to implement function like this?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 16:28:37 +0800, Yinghe Chen wrote: Hello gurus, I have a question, a function like below, it is implemented by me, :) def funcA(tarray): a = [2,3,4] if len(tarray) =3: return a[0],a[1], a[2] elif len(tarray) == 2:

Re: How to implement function like this?

2007-10-23 Thread Paul Rubin
Yinghe Chen [EMAIL PROTECTED] writes: def funcA(tarray): a = [2,3,4] if len(tarray) =3: return a[0],a[1], a[2] elif len(tarray) == 2: return a[0],a[1], funcB(1)[0] elif len(tarray) == 1: return a[0], funcB(2)[0],

Re: How to implement function like this?

2007-10-23 Thread Loic Mahe
even shorter: def funcA(tarray): s = min(len(tarray), 3) return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to implement function like this?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 11:48:08 +0200, Loic Mahe wrote: even shorter: def funcA(tarray): s = min(len(tarray), 3) return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]] Why the list comprehension!? Ciao, Marc 'Blackjack' Rintsch --

japanese encoding iso-2022-jp in python vs. perl

2007-10-23 Thread kettle
Hi, I am rather new to python, and am currently struggling with some encoding issues. I have some utf-8-encoded text which I need to encode as iso-2022-jp before sending it out to the world. I am using python's encode functions: -- var = var.encode(iso-2022-jp, replace) print var -- I am

Re: How to implement function like this?

2007-10-23 Thread Loic Mahe
Marc 'BlackJack' Rintsch a écrit : On Tue, 23 Oct 2007 11:48:08 +0200, Loic Mahe wrote: even shorter: def funcA(tarray): s = min(len(tarray), 3) return [2, 3, 4][0:s] + [e for e in funcB(3-s)[0:3-s]] Why the list comprehension!? Ciao, Marc 'Blackjack' Rintsch sorry

Re: Iteration for Factorials

2007-10-23 Thread Marco Mariani
Tim Chase wrote: fact = lambda i: i 1 and reduce(mul, xrange(1, i+1)) or not i and 1 or None Stunts like this would get a person fired around here if they were found in production code :) eheh, indeed. def fact(n): try: return eval('*'.join(str(x) for x in range(1,n+1)))

Re: Iteration for Factorials

2007-10-23 Thread tokland
On 22 oct, 23:39, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Nope, still doesn't work: def fact(x): return reduce(operator.mul,xrange(1,x+1),1) fact() should raise an exception if x is negative. So, where is the problem? if not allowing negative numbers is so important for you, add

Re: Iteration for Factorials

2007-10-23 Thread cokofreedom
On Oct 23, 1:58 pm, [EMAIL PROTECTED] wrote: On 22 oct, 23:39, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Nope, still doesn't work: def fact(x): return reduce(operator.mul,xrange(1,x+1),1) fact() should raise an exception if x is negative. So, where is the problem? if not

numpy confusion

2007-10-23 Thread Papalagi Pakeha
Hi all, I'm trying to do some calculations with NumPy but apparently didn't quite got the basics. For example I need Exponential Moving Average function. That is, I have an array of values and want to apply a function F(current, previous) to each element of the array. How can I pass the

Problem with PEXPECT in Python

2007-10-23 Thread jai simhan
import sys,os import pexpect source_file= 'sourcefile.txt' user='username' ip='00.00.00.00' desti_path='/home/jai/………' password='bond007' cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path try: foo = pexpect.spawn(cmd)

pure python data compression (zip)

2007-10-23 Thread Rene Maurer
Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately this is not solution for me, because my target only has a python

RE: japanese encoding iso-2022-jp in python vs. perl

2007-10-23 Thread Ryan Ginstrom
On Behalf Of kettle I am rather new to python, and am currently struggling with some encoding issues. I have some utf-8-encoded text which I need to encode as iso-2022-jp before sending it out to the world. I am using python's encode functions: -- var = var.encode(iso-2022-jp, replace)

Re: pure python data compression (zip)

2007-10-23 Thread Guilherme Polo
2007/10/23, Rene Maurer [EMAIL PROTECTED]: Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately this is not solution for me,

Re: pure python data compression (zip)

2007-10-23 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 14:47:40 +0200, Rene Maurer [EMAIL PROTECTED] wrote: Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately this

Re: Problem with PEXPECT in Python

2007-10-23 Thread Laszlo Nagy
cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path You might wanna try to login with a public/private key pair, then scp won't ask for a password. -- http://mail.python.org/mailman/listinfo/python-list

Re: Monitoring external processes

2007-10-23 Thread arunasunil
On Oct 22, 11:33 pm, Graham Dumpleton [EMAIL PROTECTED] wrote: On Oct 23, 3:09 pm, [EMAIL PROTECTED] wrote: Hi, Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Thanks Sunil If using Python 2.3/2.4, you

How can i protect text format ?

2007-10-23 Thread Abandoned
Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And than it looks line 1 hi line 2 how r u.. How can i protect \n characters ? --

Re: How can i protect text format ?

2007-10-23 Thread J. Clifford Dyer
On Tue, Oct 23, 2007 at 06:30:18AM -0700, Abandoned wrote regarding How can i protect text format ?: Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And

Set operations on object attributes question

2007-10-23 Thread TheSeeker
Hi, I have run into something I would like to do, but am not sure how to code it up. I would like to perform 'set-like' operations (union, intersection, etc) on a set of objects, but have the set operations based on an attribute of the object, rather than the whole object. For instance, say I

Cross-compiling porting of io.h, distutils compilator argument

2007-10-23 Thread Otacon22
Hi all, I want to create a robot with a router board based on processor atheros 2.6, called fonera. I have installed a version of linux, Openwrt and python and i want to use it for some reasons, but i have problems to have access to GPIO pins on the board to read and write on harware(pic,

Re: Cross-compiling porting of io.h, distutils compilator argument

2007-10-23 Thread Paul Boddie
On 23 Okt, 15:20, Otacon22 [EMAIL PROTECTED] wrote: If someone know how i can also directly use the gcc cross-compilator to build the module, without using distutils, but i need also to know when i compile it, then howto use on python as library. I think that this bug/patch is the most

Re: How can i protect text format ?

2007-10-23 Thread Abandoned
On Oct 23, 4:41 pm, J. Clifford Dyer [EMAIL PROTECTED] wrote: On Tue, Oct 23, 2007 at 06:30:18AM -0700, Abandoned wrote regarding How can i protect text format ?: Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u

Re: How can i protect text format ?

2007-10-23 Thread Amit Khemka
On 10/23/07, Abandoned [EMAIL PROTECTED] wrote: Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And than it looks line 1 hi line 2 how r u.. How can i protect

Re: How can i protect text format ?

2007-10-23 Thread Paul Boddie
On 23 Okt, 15:30, Abandoned [EMAIL PROTECTED] wrote: Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And than it looks line 1 hi line 2 how r u.. How can i

Re: Set operations on object attributes question

2007-10-23 Thread A.T.Hofkamp
On 2007-10-23, TheSeeker [EMAIL PROTECTED] wrote: Hi, I have run into something I would like to do, but am not sure how to code it up. I would like to perform 'set-like' operations (union, intersection, etc) on a set of objects, but have the set operations based on an attribute of the

Re: parsing the output from matlab

2007-10-23 Thread Travis Brady
On 10/22/07, wang frank [EMAIL PROTECTED] wrote I have a big log file generated from matlabe, for each variable, it print the name of the variable and an empty line and then the value. such as: x1 = 0.1 y = 7 z = 6.7 x1 = 0.5 I want to use python to parse the

Re: web.py postgresql error

2007-10-23 Thread Adam Atlas
On Oct 22, 9:06 pm, [EMAIL PROTECTED] wrote: hi everyone, i'm very new to python and to this forum. i'm actually just trying to work through the tutorial on webpy.org. so far, so good, but as i tried to incorporate a postgresql database into the demo web app i'm receiving this error print

Re: Iteration for Factorials

2007-10-23 Thread Roberto Bonvallet
On Oct 22, 11:45 am, Ant [EMAIL PROTECTED] wrote: Er, no. And neither is mine. You may want to google for the definition of factorial! Don't google for the definition... google for the answer! import urllib import re urllib.URLopener.version = Mozilla/4.0 def fact(x): r = re.compile(r%d !

Re: Bidirectional communication over unix socket (named pipe)

2007-10-23 Thread Raúl Gómez C.
Hi list, I've been looking around and I found a very interesting solution to this problem, but instead of using a file for communication the author (Eduardo Fleury) uses a reference to the abstract namespace, chek it out... http://blog.eduardofleury.com/archives/2007/09/13/ Raul --

Re: Regular Expression

2007-10-23 Thread Shawn Milochik
On 10/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm trying to learn regular expressions, but I am having trouble with this. I want to search a document that has mixed data; however, the last line of every entry has something like C5H4N4O3 or CH5N3.ClH. All of the letters are

Re: Regular Expression

2007-10-23 Thread Paul McGuire
On Oct 22, 5:29 pm, [EMAIL PROTECTED] wrote: Hi, I'm trying to learn regular expressions, but I am having trouble with this. I want to search a document that has mixed data; however, the last line of every entry has something like C5H4N4O3 or CH5N3.ClH. All of the letters are upper case and

Re: Iteration for Factorials

2007-10-23 Thread Jon Ribbens
On 2007-10-23, Hendrik van Rooyen [EMAIL PROTECTED] wrote: Yuk. Reminds me of one of the Hitachi processors that has a single depth hardware link register that tells a subroutine where it was called from. That's how ARM processors work, and they're everywhere these days. --

Re: Iteration for Factorials

2007-10-23 Thread Hendrik van Rooyen
Dennis Lee Bieber [EMAIL PROTECTED] wrote: Heh... the one saving grace of taking a CS major in a period where the primary languages taught were FORTRAN (IV), COBOL (74), and something close to KK BASIC. Heck, even the assembler class followed the FORTRAN parameter handling scheme (argument

Re: Iteration for Factorials

2007-10-23 Thread Marco Mariani
Roberto Bonvallet wrote: import urllib import re urllib.URLopener.version = Mozilla/4.0 def fact(x): r = re.compile(r%d ! = (\d+) % x) for line in urllib.urlopen(http://www.google.cl/search?q=%d%%21; % x): m = r.search(line) if m: return

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Josiah Carlson
On 22 Ott, 12:28, Giampaolo Rodola' [EMAIL PROTECTED] wrote: Hi there. We're talking about an asyncore-based server. Just for the heck of it I'd like to set a timeout which will disconnects the clients if they're inactive (i.e., no command or data transfer in progress) for a long period of

Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
[Duane] LoTuples1 = [(1,1,0),(1,2,1),(1,3,3)] Set1=set(LoTuples1) LoTuples2 = [(2,1,3),(2,2,4),(2,3,2)] Set2=set(LoTuples2) What I would like to be able to do is: Set3 = Set1union(Set2) Set3.intersection(Set2, use object[2]) to return: set([(2,1,3), (1,3,3)]) How can one do this

Speed of Nested Functions Lambda Expressions

2007-10-23 Thread beginner
Hi All, It is really convenient to use nested functions and lambda expressions. What I'd like to know is if Python compiles fn_inner() only once and change the binding of v every time fn_outer() is called or if Python compile and generate a new function object every time. If it is the latter,

greatest and least of these...

2007-10-23 Thread Shawn Minisall
I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a number. I included a while statement for a loop just for the menu and compared it to my other

Re: Speed of Nested Functions Lambda Expressions

2007-10-23 Thread Gary Herron
beginner wrote: Hi All, It is really convenient to use nested functions and lambda expressions. What I'd like to know is if Python compiles fn_inner() only once and change the binding of v every time fn_outer() is called or if Python compile and generate a new function object every time. If

Hiding tracebacks from end-users

2007-10-23 Thread Steven D'Aprano
I'm writing a command-line application that is meant to be relatively user friendly to non-technical users. (Some wags might like to say that user friendly and command-line application are, by definition, contradictory. I disagree.) Consequently, I'd like to suppress Python's tracebacks if an

Re: pure python data compression (zip)

2007-10-23 Thread Rene Maurer
Guilherme Polo writes (23.10.2007): 2007/10/23, Rene Maurer [EMAIL PROTECTED]: I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately

Leo 4.4.4 beta 3 released

2007-10-23 Thread Edward K Ream
Leo 4.4.4 beta 3 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106 Leo 4.4.4 contains many important features originally planned for later releases. It's been a good month :-) Leo is a text editor, data organizer, project manager and much more. See:

Re: pure python data compression (zip)

2007-10-23 Thread Rene Maurer
Jean-Paul Calderone wrote (23.10.2007): On Tue, 23 Oct 2007 14:47:40 +0200, Rene Maurer [EMAIL PROTECTED] wrote: Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/,

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Jean-Paul Calderone
On Tue, 23 Oct 2007 15:34:19 -, Josiah Carlson [EMAIL PROTECTED] wrote: [snip] Calling time.time() is relatively inexpensive in comparison to pure Python function calls, but indeed, it could be a bottleneck. Did you benchmark this on some system? There isn't really any pure Python function

Re: ignoring chinese characters parsing xml file

2007-10-23 Thread Fabian López
Thanks, I have tried all you told me. It was an error on print statement. So I decided to catch the exception if I had an UnicodeEncodeError, that is, if I had chinese/japanese characters because they don't interest to me and it worked. The strip_asian function of Ryan didn't work well here, but

Re: greatest and least of these...

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 11:56:33 -0400, Shawn Minisall wrote: I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a number. I included a while

Re: greatest and least of these...

2007-10-23 Thread Jason Drew
What do you mean when you say the menu doesn't kick in? Do you get an exception, or does simply nothing happen? Before the if statements, you should put print choice so you can see what value is being returned by the input function. Also maybe print type(choice) for a bit more inspection.

Life-time of temporary variables in list comprehensions

2007-10-23 Thread beginner
Hi All, If I have a list comprehension: ab=[A,B] c = ABC [1.0 if c=='A' else c='B' for c in ab] print c B My test shows that if c is not defined before the list comprehension, it will be created in the list comprehension; if it is defined before the list comprehension, the value will be

Re: Normalize a polish L

2007-10-23 Thread Roberto Bonvallet
On Oct 22, 7:50 pm, Mike Orr [EMAIL PROTECTED] wrote: Well, that gets into official vs unofficial conversions. Does the Spanish Academy really say 'ü' should be converted to 'u'? No, but it's the only conversion that makes sense. The only Spanish letter that doesn't have a standard common

New module for method level access modifiers

2007-10-23 Thread TimeHorse
I have started work on a new module that would allow the decoration of class methods to restrict access based on calling context. Specifically, I have created 3 decorators named public, private and protected. These modifiers work as follows: Private: A private method can only be called from a

Re: greatest and least of these...

2007-10-23 Thread Erik Jones
On Oct 23, 2007, at 10:56 AM, Shawn Minisall wrote: I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a number. I included a while statement

Re: Hiding tracebacks from end-users

2007-10-23 Thread myonov
On Oct 23, 7:07 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I'm writing a command-line application that is meant to be relatively user friendly to non-technical users. (Some wags might like to say that user friendly and command-line application are, by definition,

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Carsten Haese
On Tue, 2007-10-23 at 17:02 +, beginner wrote: Hi All, If I have a list comprehension: ab=[A,B] c = ABC [1.0 if c=='A' else c='B' for c in ab] c='B' is invalid syntax. Maybe you mean c=='B'. That doesn't make much sense, but at least it's correct syntax. print c B My test

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Diez B. Roggisch
beginner schrieb: Hi All, If I have a list comprehension: ab=[A,B] c = ABC [1.0 if c=='A' else c='B' for c in ab] print c B My test shows that if c is not defined before the list comprehension, it will be created in the list comprehension; if it is defined before the list

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Steven D'Aprano
On Tue, 23 Oct 2007 17:02:48 +, beginner wrote: My test shows that if c is not defined before the list comprehension, it will be created in the list comprehension; if it is defined before the list comprehension, the value will be overwritten. In other words, temp variables are not local

Re: Iteration for Factorials

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 6:58 am, [EMAIL PROTECTED] wrote: On 22 oct, 23:39, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Nope, still doesn't work: def fact(x): return reduce(operator.mul,xrange(1,x+1),1) fact() should raise an exception if x is negative. So, where is the problem? The fact

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Marc 'BlackJack' Rintsch wrote: On Mon, 22 Oct 2007 17:31:51 -0600, Steven Bethard wrote: Bruno Desthuilliers wrote: Computed attributes are IMHO not only a life-saver when it comes to refactoring. There are cases where you *really* have - by 'design' I'd say - the semantic of a property,

Re: Iteration for Factorials

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 5:55 am, Marco Mariani [EMAIL PROTECTED] wrote: Tim Chase wrote: fact = lambda i: i 1 and reduce(mul, xrange(1, i+1)) or not i and 1 or None Stunts like this would get a person fired around here if they were found in production code :) eheh, indeed. def fact(n):

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Bruno Desthuilliers wrote: Steven Bethard a écrit : Bruno Desthuilliers wrote: Steven Bethard a écrit : (snip) In Python, you can use property() to make method calls look like attribute access. This could be necessary if you have an existing API that used public attributes, but changes

Re: Can't Write to PostGIS PostGreSQL database via psycopg2

2007-10-23 Thread David Michael Schruth,
On Oct 22, 8:43 pm, Erik Jones [EMAIL PROTECTED] wrote: On Oct 22, 2007, at 8:19 PM, David Michael Schruth, wrote: Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write

Re: open remote terminal

2007-10-23 Thread Fabian Braennstroem
Hi Rafael, Rafael Sachetto wrote: Take a look at this documentation: http://pexpect.sourceforge.net/pxssh.html thanks for the link, but it actually looks to me almost like my little example... I somehow don't get it!? Any more hints? Fabian pexpect would be the usual solution, I

Re: Set operations on object attributes question

2007-10-23 Thread TheSeeker
Hi, Thanks for the response! (See below for more discussion) On Oct 23, 10:39 am, Raymond Hettinger [EMAIL PROTECTED] wrote: [Duane] LoTuples1 = [(1,1,0),(1,2,1),(1,3,3)] Set1=set(LoTuples1) LoTuples2 = [(2,1,3),(2,2,4),(2,3,2)] Set2=set(LoTuples2) What I would like to be able to do

Re: Hiding tracebacks from end-users

2007-10-23 Thread kyosohma
On Oct 23, 11:07 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I'm writing a command-line application that is meant to be relatively user friendly to non-technical users. (Some wags might like to say that user friendly and command-line application are, by definition,

Re: Iteration for Factorials

2007-10-23 Thread Marco Mariani
[EMAIL PROTECTED] wrote: Needs work. Uh... ok.. this one gives an exception ;-) def fact(n): try: return eval('*'.join(str(x) for x in range(1,n+1))) except: return n=0 or ValueError print fact(-1) type 'exceptions.ValueError' --

Re: Hiding tracebacks from end-users

2007-10-23 Thread Alan Meyer
On Oct 23, 12:07 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: ... if expert_mode: # experts get the full traceback with no hand-holding. raise else: # print a more friendly error message ... Another approach is to always print a friendly

Root element name not declared

2007-10-23 Thread korovev76
Hi guys, i'm using pyrxp to parse some xml like this one: ?xml version=1.0? !DOCTYPE MyMessage SYSTEM mymessage.dtd MyMessage release=2.0 Fromabc/From Todef/To . where the dtd is defined like this: !ENTITY % UsingLocalNames IGNORE ![%UsingLocalNames;[ !ENTITY % MyMessage

Re: Cross-platform GUI development

2007-10-23 Thread maco
On Oct 13, 12:34 am, Michael L Torrie [EMAIL PROTECTED] wrote: Alexandre Badez wrote: Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is much more integrated with all desktop than Gtk. In fact, your application in Qt on Mac, Win or Linux look like a native app. Qt

tracking/ordering log files

2007-10-23 Thread nik
Hi, I heard that there was a utility for keeping files and specifically log files organized, but haven't been able to find anything but the logging class. The logging class seems to help create the content of a log file, but unless I am missing something, it doesn't keep track of multiple log

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Bruno Desthuilliers
Steven Bethard a écrit : Bruno Desthuilliers wrote: Steven Bethard a écrit : Bruno Desthuilliers wrote: Steven Bethard a écrit : (snip) In Python, you can use property() to make method calls look like attribute access. This could be necessary if you have an existing API that used

Can't refer to base class attribute?

2007-10-23 Thread mrstephengross
I've got a Base class with an attribute foo (of type Foo), and a Derived class (derived from Base). In Derived's constructor, I try to refer to Base.foo, but python complains: AttributeError: class Base has no attribute 'foo' Any ideas? (code below) === CODE === #!/usr/bin/python class Foo:

Re: Cross-platform GUI development

2007-10-23 Thread Chris Mellon
On 10/23/07, maco [EMAIL PROTECTED] wrote: On Oct 13, 12:34 am, Michael L Torrie [EMAIL PROTECTED] wrote: Alexandre Badez wrote: Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is much more integrated with all desktop than Gtk. In fact, your application in Qt on Mac,

Re: New module for method level access modifiers

2007-10-23 Thread Bruno Desthuilliers
TimeHorse a écrit : I have started work on a new module that would allow the decoration of class methods to restrict access based on calling context. Specifically, I have created 3 decorators named public, private and protected. Lord have mercy. --

Re: japanese encoding iso-2022-jp in python vs. perl

2007-10-23 Thread Martin v. Löwis
var = var.encode(iso-2022-jp, replace) print var [...] ↓東京メトロ日比谷線・北千住行 So, what's the deal? Why can't python properly encode some of these characters? It's not clear. As Ryan says, it works just fine (and so it does for me with Python 2.4.4 on Debian). What Python version are you

Re: New module for method level access modifiers

2007-10-23 Thread Simon Brunning
On 10/23/07, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Specifically, I have created 3 decorators named public, private and protected. Lord have mercy. +1 QOTW. -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ GTalk: simon.brunning | MSN: small_values |

Re: Monitoring external processes

2007-10-23 Thread arunasunil
On Oct 22, 11:33 pm, Graham Dumpleton [EMAIL PROTECTED] wrote: On Oct 23, 3:09 pm, [EMAIL PROTECTED] wrote: Hi, Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Thanks Sunil If using Python 2.3/2.4, you

Re: Can't refer to base class attribute?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 18:54:06 +, mrstephengross wrote: I've got a Base class with an attribute foo (of type Foo), and a Derived class (derived from Base). In Derived's constructor, I try to refer to Base.foo, but python complains: AttributeError: class Base has no attribute 'foo'

Re: New module for method level access modifiers

2007-10-23 Thread J. Clifford Dyer
On Tue, Oct 23, 2007 at 08:54:52PM +0200, Bruno Desthuilliers wrote regarding Re: New module for method level access modifiers: TimeHorse a ?crit : I have started work on a new module that would allow the decoration of class methods to restrict access based on calling context.

Re: Write by logging.FileHandler to one file by many processess

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 05:08:11 -0300, Vinay Sajip [EMAIL PROTECTED] escribi�: On Oct 18, 4:08 am, Gabriel Genellina [EMAIL PROTECTED] wrote: Yes, output from several processes comes horribly mixed... I've avoided it using separate log files for each process; but if that's not possible, one

Python on Intel A110?

2007-10-23 Thread Bob Greschke
Will the stock Windows version of Python install on a Samsung Q1U-EL UMPC running Vista and with an Intel A110 processor? I want to do some development and just happened to think about this. I don't know what these processors are compatible with at the binary level. Thanks! Bob --

  1   2   >