list index()

2007-08-29 Thread zzbbaadd
What's with the index() function of lists throwing an exception on not found? Let's hope this is rectified in Python 3. If nothing else, add a function that doesn't throw an exception. There are a million situations where you can have an item not be in a list and it is not an exception situation.

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Werner
On 30 Aug., 06:26, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > ... > > > Another option is to search through the file from the beginning > > looking for whatever signature matches the beginning of a > > "normal" zip file. The self-extracting zipfiles that I've > > dis

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Werner
On 29 Aug., 15:23, [EMAIL PROTECTED] wrote: > On Aug 29, 6:53 am, Werner <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > I try to read (and extract) some "self extracting" zipefiles on a > > Windows system. The standard module zipefile seems not to be able to > > handle this. > > > >>> fName = r

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Russ
> I disagree. IMO automatic testing is thousands of times better than > design by contract and Python has already all the support you need > (unittest, doctest, py.test, nose, ...) In theory, anything you can verify with "design by contract" you can also verify with unittest and the rest. However

We need PIGs :)

2007-08-29 Thread Martin Marcher
Hello, having worked quite a bit with python in the last months (some Java before, and some C++ before that) I was very impressed by an idea the Java people had. Explanation: the JSRs define how to implement certain services and or features in Java so that they can be reused. I haven't found such

Re: Python molecular viewer

2007-08-29 Thread Scott David Daniels
Andy Cheesman wrote: > Dear People, > > I was wondering if people could recommend a simple molecular viewing > package written in python. I'm working in Theoretical chemistry and I'm > not after an all-singing dancing molecular rendering package(pymol does > that rather well) but a program which r

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Scott David Daniels
Grant Edwards wrote: ... > Another option is to search through the file from the beginning > looking for whatever signature matches the beginning of a > "normal" zip file. The self-extracting zipfiles that I've > dissected are just an executable image concatenated with a > "normal" zipfile. If yo

Re: Python molecular viewer

2007-08-29 Thread Greg Couch
Andy Cheesman <[EMAIL PROTECTED]> writes: >Dear People, >I was wondering if people could recommend a simple molecular viewing >package written in python. I'm working in Theoretical chemistry and I'm >not after an all-singing dancing molecular rendering package(pymol does >that rather well) but a

Re: Jython 2.2 on Ubuntu

2007-08-29 Thread smalltalk
On Aug 29, 10:50 pm, Neil Wallace <[EMAIL PROTECTED]> wrote: > Thanks Tim, > > I subscribed to the Jython group hosted by sourceforge, and they are a > great bunch of guys/gals. > > Here's what I did to fix my problem. > > 1. removed Jython 2.1 (using Synaptic)jytho > 2. added the following lines (

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Michele Simionato
On Aug 30, 1:17 am, Dan Stromberg - Datallegro <[EMAIL PROTECTED]> wrote: > IMO, putting Programming by Contract into python as part of the language > itself, or as a simple module, is a little bit like a company or > department coming up with a mission statement. It's easy to say that it's > mean

Re: Is LOAD_GLOBAL really that slow?

2007-08-29 Thread Carsten Haese
On Wed, 2007-08-29 at 19:23 -0600, Adam Olsen wrote: > It seems a common opinion that global access is much slower than local > variable access. However, my benchmarks show a relatively small > difference: > > ./python -m timeit -r 10 -v -s 'x = [None] * 1 > def foo(): > for i in x: > l

Re: IDE for Python

2007-08-29 Thread Eric S. Johansson
Ben Finney wrote: > Stefan Behnel <[EMAIL PROTECTED]> writes: > "Neither"? Emacs is both editor *and* IDE. I think of it more as feature full but somehow unsatisfying. For example, for those of us PRDs ( Politely Referred to as Disabled) who are trying to program by voice could use an enumerat

RE: How to use os.putenv() ?

2007-08-29 Thread Ryan Ginstrom
> On Behalf Of [EMAIL PROTECTED] > What am I doing wrong? How do I change the value of an > environment variable? You'll have to go through the Windows registry. Please have a look at the following recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/55993 I also have my own routines

Re: How to use os.putenv() ?

2007-08-29 Thread Graham Dumpleton
On Aug 30, 11:21 am, [EMAIL PROTECTED] wrote: > >>> import os > > >>> os.environ['PATH'] > > 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\ > \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem' > > >>> os.putenv('PATH', 'C:\\WINNT\\system32') > > >>> os.environ['PATH'] > > 'C:

Re: replacing xml elements with other elements using lxml

2007-08-29 Thread Ultrus
Ah! I figured it out. I forgot that the tree is treated like a list. The solution was to replace the element with the first child, then use Python's insert(i,x) function to insert elements after the first one. lxml rocks! -- http://mail.python.org/mailman/listinfo/python-list

RE: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread Sandipan News
How do I deactivate UAC and Router? I did run as Administrator and installed both Python and Pythonwin into c:\Python25\ This is the error I got ... Here is the log at the end of the install: Copied pythoncom25.dll to C:\Outils\Python\pythoncom25.dll Copied pywintypes25.dll to C:\Outils\Python\

RE: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread Sandipan News
Here is the log at the end of the install: Copied pythoncom25.dll to C:\Outils\Python\pythoncom25.dll Copied pywintypes25.dll to C:\Outils\Python\pywintypes25.dll You do not have the permissions to install COM objects. The sample COM objects were not registered. -> Software\Python\PythonCore\2.5\H

How to use os.putenv() ?

2007-08-29 Thread google
>>> >>> import os >>> >>> os.environ['PATH'] 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\ \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem' >>> >>> os.putenv('PATH', 'C:\\WINNT\\system32') >>> >>> os.environ['PATH'] 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;

Is LOAD_GLOBAL really that slow?

2007-08-29 Thread Adam Olsen
It seems a common opinion that global access is much slower than local variable access. However, my benchmarks show a relatively small difference: ./python -m timeit -r 10 -v -s 'x = [None] * 1 def foo(): for i in x: list; list; list; list; list; list; list; list; list; list' 'foo()' 10

RE: copying files

2007-08-29 Thread Carsten Haese
On Wed, 2007-08-29 at 17:03 -0400, Brian McCann wrote: > what do the + signs do? Start here: http://docs.python.org/tut/ -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Carl Banks
On Tue, 28 Aug 2007 17:30:47 -0500, Erik Jones wrote: > On Aug 28, 2007, at 5:12 PM, Chris Mellon wrote: >> When working with lists, Python has a slice syntax (which is rather >> more powerful than Haskells limited head->tail linked list syntax) that >> you can use to chop a sequence up into variou

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Russ
> But it's always a good idea to make your software "correct and as > reliable as possible", isn't it? The problem is the external constraints > on the project. As the old saying goes: "Cheap, fast, reliable: choose > any two". If you are suggesting that "programming by contract" is not appropria

Re: IDE for Python

2007-08-29 Thread Ben Finney
Stefan Behnel <[EMAIL PROTECTED]> writes: > Eric CHAO wrote: > > I think many python developers don't need such an IDE actually. Just > > like Ruby guys, they use a powerful editor, for example, Textmate, > > instead of all-in-one IDE. It's quick and direct. > > True. However, some use neither an

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Dan Stromberg - Datallegro
On Tue, 28 Aug 2007 23:45:28 -0700, Russ wrote: > On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> > wrote: > >> Why do you think that would ad a strong positive capability? >> To me at least it seems a big fat lot of over-engineering, not >> needed in 99% of programs. In the remaining

Re: replacing xml elements with other elements using lxml

2007-08-29 Thread Ultrus
Stefan, I'm honored by your response. You are correct about the bad xml. I attempted to shorten the xml for this example as there are other tags unrelated to this issue in the mix. Based on your feedback, I was able to make following fully functional code using some different techniques: from lxm

Re: re compiled object result caching?

2007-08-29 Thread Steve Holden
Dan Stromberg - Datallegro wrote: > On Wed, 29 Aug 2007 17:45:36 -0400, Steve Holden wrote: > >> Dan wrote: >>> foo_re = re.compile(r"foo(bar)") >>> # . . . >>> if foo_re.search(line): >>> foo_re.last_result().group(1) >>> >> If you wanted to implement this I don't really see why a method call

Re: re compiled object result caching?

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 21:54:50 +, Dan Stromberg - Datallegro wrote: > I've long felt that publicly accessible attributes probably should be > syntactic sugared to look like accessor methods, a bit like how __add__ > ends up being + - so that if your attribute ever needs to become methods > (say,

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Il Wed, 29 Aug 2007 23:11:53 +0200, Gigs_ ha scritto: > Gigs_ wrote: >> Fabio Z Tessitore wrote: >>> Are you sure your script is in the right dir? >>> >>> On my home computer, php script will work in /var/www but my python >>> script need an other dir to work properly (i don't remember which now >

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Erik Max Francis
Marco Mariani wrote: > Ricardo Aráoz ha scritto: > >> L = ['one', 'two', 'three', 'four', 'five'] >> >> print L[0]# This would be 'head' >> print L[1:] # This would be 'tail' >> >> Caution : L[0] and L[1:] are COPIES of the head and tail of the list. > > This might surprise people who see L

Re: re compiled object result caching?

2007-08-29 Thread Dan Stromberg - Datallegro
On Wed, 29 Aug 2007 17:45:36 -0400, Steve Holden wrote: > Dan wrote: >> foo_re = re.compile(r"foo(bar)") >> # . . . >> if foo_re.search(line): >> foo_re.last_result().group(1) >> > If you wanted to implement this I don't really see why a method call is > necessary. It would surely only need

Re: re compiled object result caching?

2007-08-29 Thread Steve Holden
Dan wrote: > I find myself often using regular expressions in the following > pattern: > > foo_re = re.compile(r"foo(bar)") > # . . . > re_result = foo_re.search(line) > if re_result: > bar = re_result.group(1) > # . . . > > But, I keep thinking this is awkward, and I would kind of like t

Re: copying files

2007-08-29 Thread Ricardo Aráoz
Brian McCann wrote: > > > > Hi Ricardo, > > what do the + signs do? > Add the different strings. You had 'm' and 'TEST_HOME' inside a string, so they would be taken as characters and not variables. >>> TEST_HOME = "/v01/test_home" >>> m = "./lib" >>> "cp -r " +

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Steve Holden
Chris Mellon wrote: > On 8/29/07, Russ <[EMAIL PROTECTED]> wrote: [...] >> If you are >> programming something that doesn't really need to be correct, than you >> probably don't need it. But if you really need (or want) your software >> to be correct and reliable as possible, I think you you should

Thread issue

2007-08-29 Thread James Matthews
Hi I have a program that downloads webpages. The webpages are stored in a list and i make each has it's own thread that downloads it. Sometimes the threads exit (because urlopen() throws an exception) Now the question is how can i recover from this thread failing Example Code from urllib import

Re: cgi

2007-08-29 Thread Gigs_
Gigs_ wrote: > Fabio Z Tessitore wrote: >> Are you sure your script is in the right dir? >> >> On my home computer, php script will work in /var/www but my python >> script need an other dir to work properly (i don't remember which now >> ;-)) >> >> bye >> > i think that it is in right dir becaus

Re: Short, crazy example: list-derived class, with __iadd__

2007-08-29 Thread Marshall T. Vandegrift
Moon <[EMAIL PROTECTED]> writes: > class Vec(list): > def __init__(self): > list.__init__(self, [0.0, 0.0]) > > def __iadd__(self, other): > assert isinstance(other, Vec) > self[0] += other[0] > self[1] += other[1] > print "right now, v is: ", self,

Re: cgi

2007-08-29 Thread Gigs_
Fabio Z Tessitore wrote: > Are you sure your script is in the right dir? > > On my home computer, php script will work in /var/www but my python > script need an other dir to work properly (i don't remember which now ;-)) > > bye > i think that it is in right dir because other script in same di

Re: Short, crazy example: list-derived class, with __iadd__ <- nevermind, me == idiot

2007-08-29 Thread Moon
__iadd__ is supposed to /return/ something, most likely self. My bad. On Wed, 29 Aug 2007 20:49:59 +, Moon wrote: > class Vec(list): > def __init__(self): > list.__init__(self, [0.0, 0.0]) > > def __iadd__(self, other): > assert isinstance(other, Vec) > sel

RE: copying files

2007-08-29 Thread Brian McCann
Hi Ricardo, what do the + signs do? From: Ricardo Aráoz [mailto:[EMAIL PROTECTED] Sent: Wed 8/29/2007 2:51 PM To: Brian McCann Cc: python-list@python.org Subject: Re: copying files Brian McCann wrote: > Hi, > > with the code

Re: Haskell like (c:cs) syntax

2007-08-29 Thread Stefan Niemann
Thanks for all the good answers. In fact the `Extended Iterable Unpacking' is exactly what I was looking for. Ok, my main aspect of writing head, *tail = seq instead of head, tail = seq[0], seq[1:] is the syntactic sugar. As mentioned in the PEP this may also be faster when iterables

Short, crazy example: list-derived class, with __iadd__

2007-08-29 Thread Moon
class Vec(list): def __init__(self): list.__init__(self, [0.0, 0.0]) def __iadd__(self, other): assert isinstance(other, Vec) self[0] += other[0] self[1] += other[1] print "right now, v is: ", self, " as you'd expect" v = Vec() w = Vec() w[0] = 1.0

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Are you sure your script is in the right dir? On my home computer, php script will work in /var/www but my python script need an other dir to work properly (i don't remember which now ;-)) bye -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing docstrings at runtime?

2007-08-29 Thread Kenneth Love
On 08/29/07, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote: >> How do I print the docstring for a class property? >> >> [[[ SNIP EXAMPLE ]]] >> >> What am I doing wrong? >> > > You're looking at an instance, not at the class. y.x is going through > the

Re: Unzip: Memory Error

2007-08-29 Thread David Bolen
mcl <[EMAIL PROTECTED]> writes: > I am trying to unzip an 18mb zip containing just a single 200mb file > and I get a Memory Error. When I run the code on a smaller file 1mb > zip, 11mb file, it works fine. (...) > def unzip_file_into_dir(file, dir): > #os.mkdir(dir, 0777) > zfobj = zi

Re: Creating a multi-tier client/server application

2007-08-29 Thread David Bolen
Jeff <[EMAIL PROTECTED]> writes: > reasons, not the least of which is that I've been working almost > entirely on web apps for the past few years, and I am getting mighty > sick of it. A lot of that is due to the language (PHP, which I have > since grown to hate) I had to use. I've worked on a s

ANNOUNCE: Spiff Workflow 0.0.2

2007-08-29 Thread Samuel
Introduction Spiff Workflow is a library implementing a framework for workflows. It is based on http://www.workflowpatterns.com and implemented in pure Python. Spiff Workflow is part of the Spiff platform, which aims to produce a number of generic libraries generally needed in enterp

Re: IDE for Python

2007-08-29 Thread Stefan Behnel
Eric CHAO wrote: > I think many python developers don't need such an IDE actually. Just > like Ruby guys, they use a powerful editor, for example, Textmate, > instead of all-in-one IDE. It's quick and direct. True. However, some use neither an editor nor an IDE but Emacs. Stefan -- http://mail.p

Re: sys.argv is munging my command line options

2007-08-29 Thread Arnau Sanchez
Chris Allen escribió: > action key=value key=value... > > Where action is a required string (ie. 'backup', 'init', 'restore', > etc) and the program can accept one or more key value pairs. I know > this syntax isn't standard, but I think it works great for my program > as each key can override a

re compiled object result caching?

2007-08-29 Thread Dan
I find myself often using regular expressions in the following pattern: foo_re = re.compile(r"foo(bar)") # . . . re_result = foo_re.search(line) if re_result: bar = re_result.group(1) # . . . But, I keep thinking this is awkward, and I would kind of like to have the re object to cache it

Re: sys.argv is munging my command line options

2007-08-29 Thread Chris Allen
Thanks for the reply. Oops... I forget that I was calling the program from a shell script, the shell script was responsible for goofing up my command line options. Solved. Thanks again. On Aug 29, 12:28 pm, Ant <[EMAIL PROTECTED]> wrote: > On Aug 29, 8:11 pm, Chris Allen <[EMAIL PROTECTED]> wr

Re: sys.argv is munging my command line options

2007-08-29 Thread Ant
On Aug 29, 8:11 pm, Chris Allen <[EMAIL PROTECTED]> wrote: ... > But I'm running into a problem with this which is that sys.argv splits > my key=value options. I need to know the option associations, and > there's no way to know this by inspecting sys.argv. Can I get access > to the command line

Re: cgi

2007-08-29 Thread Gigs_
Fabio Z Tessitore wrote: > Il Wed, 29 Aug 2007 19:24:54 +0200, Gigs_ ha scritto: > >> i have simple page and form that ask for name and color and cgi script >> that print that name in another page and background in chosen color >> >> all the time this error pop: >> Error response >> >> Error code

sys.argv is munging my command line options

2007-08-29 Thread Chris Allen
The command line syntax for my program is as follows: action key=value key=value... Where action is a required string (ie. 'backup', 'init', 'restore', etc) and the program can accept one or more key value pairs. I know this syntax isn't standard, but I think it works great for my program as eac

Re: Creating a multi-tier client/server application

2007-08-29 Thread askel
On Aug 29, 1:31 pm, Jeff <[EMAIL PROTECTED]> wrote: > Goldfish--thanks, I'll check it out. > > > > That, or something similar, may be what I do. It would mean, however, > > > developing my own method for transferring objects across the network, > > > Why transfering "objects" ? You only need to tr

Unzip: Memory Error

2007-08-29 Thread mcl
I am trying to unzip an 18mb zip containing just a single 200mb file and I get a Memory Error. When I run the code on a smaller file 1mb zip, 11mb file, it works fine. I am running on a hosted Apache web server I am using some code I found on the web somewhere. def unzip_file_into_dir(file, di

Re: copying files

2007-08-29 Thread kyosohma
On Aug 29, 1:51 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Brian McCann wrote: > > Hi, > > > with the code below I set a variable TEST_HOME to a path and the > > variable m to a path > > in my current dir. > > I have a symbolic link setting m>lib > > when I run the script I get no errors an

Re: cgi

2007-08-29 Thread Fabio Z Tessitore
Il Wed, 29 Aug 2007 19:24:54 +0200, Gigs_ ha scritto: > i have simple page and form that ask for name and color and cgi script > that print that name in another page and background in chosen color > > all the time this error pop: > Error response > > Error code 501. > > Message: Can only POST t

Re: copying files

2007-08-29 Thread Ricardo Aráoz
Brian McCann wrote: > Hi, > > with the code below I set a variable TEST_HOME to a path and the > variable m to a path > in my current dir. > I have a symbolic link setting m>lib > when I run the script I get no errors and the lib dir with its 20 files > does not get copied to /v01/test_home >

Re: copying files

2007-08-29 Thread Ricardo Aráoz
Brian McCann wrote: > Hi, > > with the code below I set a variable TEST_HOME to a path and the > variable m to a path > in my current dir. > I have a symbolic link setting m>lib > when I run the script I get no errors and the lib dir with its 20 files > does not get copied to /v01/test_home >

Re: Accessing docstrings at runtime?

2007-08-29 Thread Bruno Desthuilliers
Chris Mellon a écrit : > On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote: > >>How do I print the docstring for a class property? (snip) > You're looking at an instance, not at the class. y.x is going through > the descriptor lookup and is returning the string, so the __doc__ is > the the __doc_

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : > Goldfish--thanks, I'll check it out. > > >>>That, or something similar, may be what I do. It would mean, however, >>>developing my own method for transferring objects across the network, >> >>Why transfering "objects" ? You only need to transfer data. > > I suppose I don't nee

RE: copying files

2007-08-29 Thread Brian McCann
one thing I just noticed is that when I run the script I get a new symbolic link created in my current dir TEST_HOME-->lib --Brian From: [EMAIL PROTECTED] on behalf of Brian McCann Sent: Wed 8/29/2007 2:40 PM To: python-list@py

copying files

2007-08-29 Thread Brian McCann
Hi, with the code below I set a variable TEST_HOME to a path and the variable m to a path in my current dir. I have a symbolic link setting m>lib when I run the script I get no errors and the lib dir with its 20 files does not get copied to /v01/test_home any help would be greatly apprecia

Re: Accessing docstrings at runtime?

2007-08-29 Thread Chris Mellon
On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote: > How do I print the docstring for a class property? > > When I run the code below, I get the docstring for the string module > and not the one I set for the property. > > - > # NOTE: Found in Python doc

Accessing docstrings at runtime?

2007-08-29 Thread Kenneth Love
How do I print the docstring for a class property? When I run the code below, I get the docstring for the string module and not the one I set for the property. - # NOTE: Found in Python docs defining built-in functions (such as # property()). FIX

Re: general function for sorting a matrix

2007-08-29 Thread Neil Cerutti
On 2007-08-29, Xah Lee <[EMAIL PROTECTED]> wrote: > A couple years ago, i posted a programing problem, about > writing a function that will sort a arbitrarily dimentioned > matrix in any possible way to sort it. > > Such a function, is rather typical in functional programing > languages. I wrote a

Re: Creating a multi-tier client/server application

2007-08-29 Thread Jeff
Goldfish--thanks, I'll check it out. > > That, or something similar, may be what I do. It would mean, however, > > developing my own method for transferring objects across the network, > > Why transfering "objects" ? You only need to transfer data. I suppose I don't need to transfer objects, it

cgi

2007-08-29 Thread Gigs_
i have simple page and form that ask for name and color and cgi script that print that name in another page and background in chosen color all the time this error pop: Error response Error code 501. Message: Can only POST to CGI scripts. Error code explanation: 501 = Server does not support th

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Chris Mellon
On 8/29/07, Russ <[EMAIL PROTECTED]> wrote: > On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> > wrote: > > > Why do you think that would ad a strong positive capability? > > To me at least it seems a big fat lot of over-engineering, not > > needed in 99% of programs. In the remaining 1%,

Re: Gmane's been quiet ...

2007-08-29 Thread Grant Edwards
On 2007-08-29, Robert Marshall <[EMAIL PROTECTED]> wrote: >> Given that I have now read a reply to my post-via-gmane on gmane >> before seeing the original post appear there I shall assume they've >> been having some sort of issue. > > See http://news.gmane.org/gmane.discuss for some discussion of

Re: general function for sorting a matrix

2007-08-29 Thread Stefan Behnel
Xah Lee wrote: [undermotivated blah stripped] don't feed the troll. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Gmane's been quiet ...

2007-08-29 Thread Robert Marshall
On Wed, 29 Aug 2007, Steve Holden wrote: > > Lawrence Oluyede wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >>> Posting that were made to mailing lists via gmane? >> >> That, I do not know >> > Given that I have now read a reply to my post-via-gmane on gmane > before seeing the original post

Re: replacing xml elements with other elements using lxml

2007-08-29 Thread Stefan Behnel
Ultrus wrote: > I'm attempting to generate a random story using xml as the document, > and lxml as the parser. I want the document to be simplified before > processing it further, and am very close to accomplishing my goal. > Below is what I have so far. Any ideas on how to move forward? > > The g

Re: general function for sorting a matrix

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 08:47:27 -0700, Xah Lee wrote: > While reviewing this code, there's something interesting of note. > > Namely, in my perl solution, the approach is drastically different > than the python version. Instead of sorting by looping thru the > sorting directives, it parses the direc

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : >> You could explore something like a custom-made GUI client app >> communicating thru the http protocol with a web-server app. http is just >> a protocol, and it doesn't necessarily imply using html and a browser... >> IIRC, some GUI toolkits uses XML description files for the UI. >

python + gcov

2007-08-29 Thread labrach
Hi I want to profile (and analyse coverage) some c++ code imported as a python module I've compiled python (2.4.2) with gcc 3.4.3 and flags=-Wall -fprofile- arcs -ftest-coverage in order to use gcov. However, the python binary does not generate any coverage file (such than *.gcno, gcda) during exe

Re: What's the difference ?

2007-08-29 Thread Alexandre Badez
Thanks for all you information. I'll continue to use 'in' instead of 'has_key' for a "faster, more concise, & readable" code (^L^ ) -- http://mail.python.org/mailman/listinfo/python-list

general function for sorting a matrix

2007-08-29 Thread Xah Lee
A couple years ago, i posted a programing problem, about writing a function that will sort a arbitrarily dimentioned matrix in any possible way to sort it. Such a function, is rather typical in functional programing languages. I wrote a version in 1999 in perl for practical purposes, since sortin

Re: encoding problems

2007-08-29 Thread Damjan
> > is there a way to sort this string properly (sorted()?) > I mean first 'a' then 'à' then 'e' etc. (sorted puts accented letters at > the end). Or should I have to provide a comparison function to sorted? After setting the locale... locale.strcoll() -- damjan -- http://mail.python.org/mai

Re: What's the difference ?

2007-08-29 Thread kyosohma
On Aug 29, 9:44 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > <[EMAIL PROTECTED]> wrote: > >... > > > Weird. Hetland's book, "Beginning Python" states that it's a matter of > > taste. > > If your taste is for more verbose AND slower notation without any > compensating advantage, sure. > > > Ma

Re: strange list comprehension on generator

2007-08-29 Thread [EMAIL PROTECTED]
On Aug 29, 6:50 am, Roland Puntaier <[EMAIL PROTECTED] automation.com> wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for i in range(len(aa)): > for x in c

replacing xml elements with other elements using lxml

2007-08-29 Thread Ultrus
Hello, I'm attempting to generate a random story using xml as the document, and lxml as the parser. I want the document to be simplified before processing it further, and am very close to accomplishing my goal. Below is what I have so far. Any ideas on how to move forward? The goal: read and edit

Re: handling tabular data in python--newbie question

2007-08-29 Thread hyena
Thanks Bruno and Steve for the quick answer! >What make you think such a thing ? I am also using R and java from time to time, and think it is very covinient that in R tables are handled as matrixs or data frames. Thus I expect python has something similiar. :) And I went for Steve's first sugg

Re: Jython 2.2 on Ubuntu

2007-08-29 Thread Neil Wallace
Thanks Tim, I subscribed to the Jython group hosted by sourceforge, and they are a great bunch of guys/gals. Here's what I did to fix my problem. 1. removed Jython 2.1 (using Synaptic)jytho 2. added the following lines (as root) to /etc/profile # set PATH for Jython PATH=$

Re: What's the difference ?

2007-08-29 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Weird. Hetland's book, "Beginning Python" states that it's a matter of > taste. If your taste is for more verbose AND slower notation without any compensating advantage, sure. > Martelli's "Python Cookbook 2nd Ed." says to use the get() > method instead as you

Re: What's the difference ?

2007-08-29 Thread Alex Martelli
Alex <[EMAIL PROTECTED]> wrote: > Hye, > > I was just wondering what is the difference between > > >> if my_key in mydict: > >> ... > > and > > >> if mydict.has_keys(my_key): Mis-spelled (no final s in the method name). > >> ... > > I've search a bit in the python documentation, and

Re: strange list comprehension on generator

2007-08-29 Thread Martin v. Löwis
> #this does not return the way I would expect. why? You yield the very same list object all the times. So when you make a later change, all earlier results will get changed, too (since they are the same object). Of course, it won't affect the terminal output, so you don't see that the older value

Re: strange list comprehension on generator

2007-08-29 Thread Bjoern Schliessmann
No greeting, no text? Pity. Roland Puntaier wrote: > def changeOne(aa,idx): > aa[idx]=not aa[idx] > yield aa > for i in range(idx): > for x in changeOne(aa,i): > yield x > > def changeOneOrder(aa): > yield aa > for i in range(len(aa)): > for x in changeOne(aa,i): >

Re: Creating a multi-tier client/server application

2007-08-29 Thread Goldfish
Perhaps Spring Python can help you out (http://springpython.python- hosting.com). It reuses technologies like Pyro for remoting, offers database templates, has a plugable security component, an AOP solution should the need arise, an IoC container, and has a couple of web-app demos using CherryPy. O

Re: Creating a multi-tier client/server application

2007-08-29 Thread Jeff
> You could explore something like a custom-made GUI client app > communicating thru the http protocol with a web-server app. http is just > a protocol, and it doesn't necessarily imply using html and a browser... > IIRC, some GUI toolkits uses XML description files for the UI. That, or something

Re: self extracting zipefile (windows) and (standard module) zipefile

2007-08-29 Thread Grant Edwards
On 2007-08-29, Hyuga <[EMAIL PROTECTED]> wrote: >> I try to read (and extract) some "self extracting" zipefiles >> on a Windows system. The standard module zipefile seems not to >> be able to handle this. [...] > > First of all, there's really no such thing as a "self > extracting zipefile". Perh

Re: non-blocking communication with imaplib

2007-08-29 Thread Igor V. Rafienko
[ Lawrence D'Oliveiro ] [ ... ] > According to the documentation > , you can override > the "read" and "readline" methods. How about replacing them with > routines that use select.select on the socket() object to implement > a timeout? Sounds like

Re: status of Programming by Contract (PEP 316)?

2007-08-29 Thread Aahz
In article <[EMAIL PROTECTED]>, Russ <[EMAIL PROTECTED]> wrote: > >I just stumbled onto PEP 316: Programming by Contract for Python >(http://www.python.org/dev/peps/pep-0316/). This would be a great >addition to Python, but I see that it was submitted way back in 2003, >and its status is "deferred

strange list comprehension on generator

2007-08-29 Thread Roland Puntaier
def changeOne(aa,idx): aa[idx]=not aa[idx] yield aa for i in range(idx): for x in changeOne(aa,i): yield x def changeOneOrder(aa): yield aa for i in range(len(aa)): for x in changeOne(aa,i): yield x a=[False]*3 og=changeOneOrder(a) #this does not return the way I wo

Re: What's the difference ?

2007-08-29 Thread Marc 'BlackJack' Rintsch
On Wed, 29 Aug 2007 13:39:27 +, Alex wrote: > Hye, > > I was just wondering what is the difference between > >>> if my_key in mydict: >>> ... > > and > >>> if mydict.has_keys(my_key): >>> ... > > I've search a bit in the python documentation, and the only things I > found was that

Re: What's the difference ?

2007-08-29 Thread kyosohma
On Aug 29, 8:39 am, Alex <[EMAIL PROTECTED]> wrote: > Hye, > > I was just wondering what is the difference between > > >> if my_key in mydict: > >> ... > > and > > >> if mydict.has_keys(my_key): > >> ... > > I've search a bit in the python documentation, and the only things I > found was th

Re: Pythonwin Install COM exceptions on Windows Vista Ultimate

2007-08-29 Thread Larry Bates
Sandipan News wrote: > What do I do? Can't do without Python! > Any experience, advice, hope is welcome. > Thanks. > Sandipan > > If you are asking if you can run COM objects created in Python on Windows Vista Ultimate, the answer is yes. I have several. -Larry -- http://mail.python.org/mailm

Re: How to free memory ( ie garbage collect) at run time with Python 2.5.1(windows)

2007-08-29 Thread M�ta-MCI \(MVP\)
Hi! I've send the soft. But, I have no news ; good news? @+ Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a multi-tier client/server application

2007-08-29 Thread Bruno Desthuilliers
Jeff a écrit : > Thanks for the quick responses. > > I was really hoping to avoid an entirely web-based app, for a few > reasons, not the least of which is that I've been working almost > entirely on web apps for the past few years, and I am getting mighty > sick of it. A lot of that is due to th

What's the difference ?

2007-08-29 Thread Alex
Hye, I was just wondering what is the difference between >> if my_key in mydict: >> ... and >> if mydict.has_keys(my_key): >> ... I've search a bit in the python documentation, and the only things I found was that they are "equivalent". But in this (quiet old) sample ( "http://aspn.ac

  1   2   >