Re: image processing

2007-03-07 Thread edurand
On Mar 7, 5:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 06 Mar 2007 10:16:21 -0300, edurand <[EMAIL PROTECTED]> > escribió: > > > On Mar 6, 9:57 am, Paul Rubin wrote: > >> "edurand" <[EMAIL PROTECTED]> writes: > >> > Have a look at :http://filters.sour

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread Nick Vatamaniuc
On Mar 7, 3:49 pm, "John" <[EMAIL PROTECTED]> wrote: > Then is there anyway to sort the numeric keys and avoid future implemetation > confusion? > > "Ant" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > On Mar 7, 8:18 pm, "John" <[EMAIL PROTECTED]> wrote: > > ... > >> However,

Re: how can I find out the value of an environment variable?

2007-03-07 Thread Tim Roberts
"ken" <[EMAIL PROTECTED]> wrote: > >how can I find out the value of an environment variable in my pythong >script? C:\Apps\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> i

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
Ken Tilton wrote: > John Nagle wrote: >> Brian Adkins wrote: >>> John Nagle wrote: >>> If you want to restart a debate, please go back and reply to some >>> serious post in the thread - don't hijack mine for your own evil >>> purposes and cut out the good parts - did you even see the movie? >> >>

Re: merits of Lisp vs Python

2007-03-07 Thread Paul Rubin
Brian Adkins <[EMAIL PROTECTED]> writes: > This may sound like I'm baiting you, but it's a sincere question. If > your experience with Perl was so good, why did you decide to pursue > Python? Trouble free hosting and no problems in development - sounds > like it worked out well for you. Er, becaus

Re: merits of Lisp vs Python

2007-03-07 Thread Ken Tilton
John Nagle wrote: > Brian Adkins wrote: > >> John Nagle wrote: > > >> If you want to restart a debate, please go back and reply to some >> serious post in the thread - don't hijack mine for your own evil >> purposes and cut out the good parts - did you even see the movie? > > >If you w

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
John Nagle wrote: > Paul Rubin wrote: >> Brian Adkins <[EMAIL PROTECTED]> writes: >> >>> With prices of dedicated servers and virtual private servers so cheap, >>> why would anyone get a hosting account without root access? >> >> Because it turns you into a sysadmin instead of letting specialists

Re: persistent fifo queue class

2007-03-07 Thread Hendrik van Rooyen
"David Bear" <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch wrote: > > Why don't you use a DB for that? If you want pickles, use a blob > > column. But all the rest - a defined protocol, stable server, > > transactions - you get for free. > > > > Diez > > Thanks for the suggestion. I did think o

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Bjoern Schliessmann
John Nagle wrote: > True. It would make sense to disallow mutable values as > initial values for optional arguments. The present behavior > is silly. Why? You're free to only use immutables. Regards, Björn -- BOFH excuse #42: spaghetti cable cause packet failure -- http://mail.pytho

Re: merits of Lisp vs Python

2007-03-07 Thread John Nagle
Paul Rubin wrote: > Brian Adkins <[EMAIL PROTECTED]> writes: > >>With prices of dedicated servers and virtual private servers so cheap, >>why would anyone get a hosting account without root access? > > Because it turns you into a sysadmin instead of letting specialists > handle all the OS stuff

Re: Problem with Packages

2007-03-07 Thread Gabriel Genellina
En Thu, 08 Mar 2007 02:37:51 -0300, Srikanth <[EMAIL PROTECTED]> escribió: > I am learning about Python packages and I am getting an ImportError > but I can't figure out the reason why. It appears that you forgot the basic rule: a package is a directory with an __init__.py file (even if empty).

Exception

2007-03-07 Thread Navid Parvini
Dear All, When an exception occurs in a Python Qt application and it is not caught, an error message is printed to stderr and the control is given back to the event handler (similar to the interactive Python session). The resources allocated before the error occurred is not flushed, but rathe

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
Paul Rubin wrote: > Brian Adkins <[EMAIL PROTECTED]> writes: >> With prices of dedicated servers and virtual private servers so cheap, >> why would anyone get a hosting account without root access? > > Because it turns you into a sysadmin instead of letting specialists > handle all the OS stuff s

Re: merits of Lisp vs Python

2007-03-07 Thread Paul Rubin
Brian Adkins <[EMAIL PROTECTED]> writes: > With prices of dedicated servers and virtual private servers so cheap, > why would anyone get a hosting account without root access? Because it turns you into a sysadmin instead of letting specialists handle all the OS stuff so you can concentrate on you

Problem with Packages

2007-03-07 Thread Srikanth
Hi, I am learning about Python packages and I am getting an ImportError but I can't figure out the reason why. I have three modules and they are stored in a directory hierarchy as: my_apps | |--> mod3.py |--> dir1/dir1_1/mod1.py |--> dir2/dir2_2/mod2.py mod1.py defines a function called add(num

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
John Nagle wrote: > Brian Adkins wrote: >> alex23 wrote: >> >>> John Nagle wrote: >>> Hosting providers and distro makers aren't concerned over whether Python works. They care if C, C++, Java, PHP, and Perl work, but not Python or LISP. Ask them. >>> >>> >>> Do you have any rea

Exception

2007-03-07 Thread Navid Parvini
Dear All, When an exception occurs in a Python Qt application and it is not caught, an error message is printed to stderr and the control is given back to the event handler (similar to the interactive Python session). The resources allocated before the error occurred is not flushed, but rathe

Re: merits of Lisp vs Python

2007-03-07 Thread John Nagle
Brian Adkins wrote: > alex23 wrote: > >> John Nagle wrote: >> >>> Hosting providers and distro >>> makers aren't concerned over whether Python works. They >>> care if C, C++, Java, PHP, and Perl work, but not Python or LISP. >>> Ask them. >> >> >> Do you have any real experience with recent linux

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
alex23 wrote: > John Nagle wrote: >> Hosting providers and distro >> makers aren't concerned over whether Python works. They >> care if C, C++, Java, PHP, and Perl work, but not Python or LISP. >> Ask them. > > Do you have any real experience with recent linux distros? Or with any > _real_ hostin

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread C Barr Leigh
Oh, oops! Of course... :) A great and sensible feature if you're expecting it. Thanks very much, everyone, for the links and discussion! Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2007-03-07 Thread Paul Rubin
"alex23" <[EMAIL PROTECTED]> writes: > > Hosting providers and distro > > makers aren't concerned over whether Python works. They > > care if C, C++, Java, PHP, and Perl work, but not Python or LISP. > > Ask them. > > Do you have any real experience with recent linux distros? Or with any > _real_

VIM: Python type indented-block command equivalent to % for C?

2007-03-07 Thread Paddy3118
Not python: but python type indented text Notice the blank line above. It could have several spaces or tabs, and still be a part of the block beginning 'Not python:': The block ends at the first non-blank line with less indent. Assuming that only s

Re: merits of Lisp vs Python

2007-03-07 Thread alex23
John Nagle wrote: > Hosting providers and distro > makers aren't concerned over whether Python works. They > care if C, C++, Java, PHP, and Perl work, but not Python or LISP. > Ask them. Do you have any real experience with recent linux distros? Or with any _real_ hosting providers? Because what

Re: Debugging segmentation faults

2007-03-07 Thread John Nagle
George Sakkis wrote: > On Mar 7, 4:15 pm, John Nagle <[EMAIL PROTECTED]> wrote: > > >>You're using Python on a web server to do something >>complicated. You must suffer. >> >>Are you trying to fork off a subprocess in a multithreaded >>program? That's unlikely to work. The sematics dif

Re: More M2Crypto build problems

2007-03-07 Thread John Nagle
Now I understand what's wrong. It's an incompatibility between SWIG, OpenSSL, and M2Crypto. OpenSSL was built with OPENSSL_NO_EC defined. That's actually defined via "opensslconf.h", which includes, based on whether __i386__ is defined, the file "opensslconf-i386.h". OpenSSL didn't alwa

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > def factorial(n, _cache={}): > try: >return _cache[n] > except KeyError: > There are other ways of implementing caches, but this is quick and easy > and works well for many functions. I like this better (examples are untested): def

Jython Data Extraction problem

2007-03-07 Thread Steve Williams
The data is an 8-byte 2s complement binary integer stored in a MSSQL 2005 CHAR column. (COBOL did that, not me). I'm using zxJDBC to read the data and Jython to process. I could extract the integer if it wasn't returned in the resultset as unicode. Things like ord(char) and struct.unpack('>B',

Re: Debugging segmentation faults

2007-03-07 Thread George Sakkis
On Mar 7, 4:15 pm, John Nagle <[EMAIL PROTECTED]> wrote: > You're using Python on a web server to do something > complicated. You must suffer. > > Are you trying to fork off a subprocess in a multithreaded > program? That's unlikely to work. The sematics differ > from OS to OS (Solaris

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Steven D'Aprano
On Thu, 08 Mar 2007 03:14:53 +, John Nagle wrote: > Paul Rubin wrote: >> "C Barr Leigh" <[EMAIL PROTECTED]> writes: >> >>>Help! Have I found a serious bug? >>>This seems like highly undesired behaviour to me. From the program >>>below, I get output: >> >> >> It is intentional, not a bug, se

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
On Mar 7, 10:24 pm, Paul Rubin wrote: > John Nagle <[EMAIL PROTECTED]> writes: > > True. It would make sense to disallow mutable values as > > initial values for optional arguments. The present behavior is silly. > > That would be the worst of both worlds. The main

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread George Sakkis
On Mar 7, 10:14 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > "C Barr Leigh" <[EMAIL PROTECTED]> writes: > > >>Help! Have I found a serious bug? > >>This seems like highly undesired behaviour to me. From the program > >>below, I get output: > > > It is intentional, not a bug, se

Re: catching exceptions from an except: block

2007-03-07 Thread Steven D'Aprano
On Wed, 07 Mar 2007 10:32:53 -0800, Arnaud Delobelle wrote: > Hi all, > > Imagine I have three functions a(x), b(x), c(x) that each return > something or raise an exception. Imagine I want to define a function > that returns a(x) if possible, otherwise b(x), otherwise c(x), > otherwise raise Can

Seo , Search Engine Optimizer , Seo Search engine Optimization , search engine optimization services, SEO Consulting

2007-03-07 Thread Se0 Guy
Search Engine Optimization http://www.yourseoconsulting.com/ Seo Optimization , Semantic Results, Artificial intelligence in Search, Auto Content Generators, Search Engine Results. SEO optimizer. SEO consulting -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Paul Rubin
John Nagle <[EMAIL PROTECTED]> writes: > True. It would make sense to disallow mutable values as > initial values for optional arguments. The present behavior is silly. That would be the worst of both worlds. The main alternative to the present behavior is re-computing the default value eve

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread John Nagle
Paul Rubin wrote: > "C Barr Leigh" <[EMAIL PROTECTED]> writes: > >>Help! Have I found a serious bug? >>This seems like highly undesired behaviour to me. From the program >>below, I get output: > > > It is intentional, not a bug, see the docs. Whether it's desirable is > a different question.

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 23:39:21 -0300, C Barr Leigh <[EMAIL PROTECTED]> escribió: > Help! Have I found a serious bug? Not at all! This is by design. > def testPersistence(anarg,twooption=[]): > #print anarg > if not twooption: > twooption.append('Set within test for '+anarg) See

Re: tkinter how to write

2007-03-07 Thread faulkner
On Mar 8, 7:07 pm, Gigs_ <[EMAIL PROTECTED]> wrote: > as I write my first gui program (text editor) I wanna ask you guys how > to separate code in classes.? > Should I put in one class my menu and in another class text and > scorllbars etc? > > or something else? > > thanks Use the force. Do what

Re: Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread Paul Rubin
"C Barr Leigh" <[EMAIL PROTECTED]> writes: > Help! Have I found a serious bug? > This seems like highly undesired behaviour to me. From the program > below, I get output: It is intentional, not a bug, see the docs. Whether it's desirable is a different question. -- http://mail.python.org/mailman

Bug in python!? persistent value of an optional parameter in function!

2007-03-07 Thread C Barr Leigh
Help! Have I found a serious bug? This seems like highly undesired behaviour to me. From the program below, I get output: call1: ['sdf'] call2: ['Set within test for call2'] call3: ['Set within test for call2'] instead of what I should get, call1: ['sdf'] call2: ['Set within test for call2'] cal

Re: is it possible to give an instance a value?

2007-03-07 Thread Steven D'Aprano
On Wed, 07 Mar 2007 16:02:05 +0100, egbert wrote: > On Tue, 06 Mar 2007 14:45:45 -0800, manstey wrote: >> >> class Test(object): >> def __init__(self, val): >>self.val = val >> >> a = Test('hello') > >> Is there a way to make a have the value a.val when it is used as >> above,

Re: merits of Lisp vs Python

2007-03-07 Thread John Nagle
Brian Adkins wrote: > John Nagle wrote: > If you want to restart a debate, please go back and reply to some > serious post in the thread - don't hijack mine for your own evil > purposes and cut out the good parts - did you even see the movie? If you want to post jokes, try rec.humor.funny.

www.OutpatientSurgicare.com/video/

2007-03-07 Thread [EMAIL PROTECTED]
www.OutpatientSurgicare.com/video/ Outpatient Doctors Surgery Center is committed to offering the healthcare the community needs. We offer patients a meaningful alternative to traditional surgery. This state-of-the-art outpatient surgery center, located in the heart of Orange County, at 10900 Warne

Re: catching exceptions from an except: block

2007-03-07 Thread MonkeeSage
On Mar 7, 4:58 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >except_retry: # the missing(???) keyword you're after What is 'except_retry'? To the OP, with the loop and the callables you could also break out of the loop when the condition is met and use the else condition to raise the ex

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Paul Rubin
"Sergio Correia" <[EMAIL PROTECTED]> writes: > 2) Reduce > eggs = reduce(lambda x, y: x+y, spam) > > I feel the 1st way is too cumbersome (three lines), and although I > like the 2nd way (except for the lambda part), I understand reduce is > discouraged by Guido so I want to know if there is a "Be

Re: Descriptor/Decorator challenge

2007-03-07 Thread Jack Diederich
On Tue, Mar 06, 2007 at 11:44:48AM -0800, Arnaud Delobelle wrote: > On 5 Mar, 18:59, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > [snip] > > Well in fact I couldn't help but try to improve it a bit. Objects now > > don't need a callerclass attribute, instead all necessary info is > > stored in a

Error 1 during install of python 2.5 on CentOS

2007-03-07 Thread nat
Hi guys, I'm running CentOS 4.4 and the current version on my system is Python 2.3.4. Ideally I wanted to use an RPM to update the system python but a lot of dependencies failed and since I need to run the latest Python for a particular script, I read on this group somewhere a suggestion to run

Re: Calling a function with unknown arguments?

2007-03-07 Thread Rob
> You can do this with a list comprehension: > bob(*[possible[k] for k in bob2.func_code.co_varnames]) > > The LC creates a list of arg values in the same order as the var names > for the function. Putting a * before the list when you call bob() > turns that list into it's arguments. Thanks Tom! T

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Sergio Correia
O_o List comprehensions never cease to amaze me. Thanks, On 3/7/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Wed, 07 Mar 2007 21:41:16 -0300, Sergio Correia > <[EMAIL PROTECTED]> escribió: > > > I forgot to say: I've already checked the discussions about > > recursive/iterative/etc fl

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Michael Spencer
Sergio Correia wrote: > spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] > > Into something like > eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] > > There are *no* special cases (no empty sub-lists). eggs = [i for j in spam for i in j] Michael -- http://mail.python.org/mailman/listinfo/

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 21:41:16 -0300, Sergio Correia <[EMAIL PROTECTED]> escribió: > I forgot to say: I've already checked the discussions about > recursive/iterative/etc flatten() functions that can sweep through a > list of arbitrary length, but that's really overkill for what I want. > > Howeve

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Matimus
> Any ideas? how about list comprehension (should actually work even if there is an empty sub-list): >>> spam = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]] >>> [parrot for egg in spam for parrot in egg] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] -m -- http://mail.python.org/mailman/listinfo/python-list

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Sergio Correia
I forgot to say: I've already checked the discussions about recursive/iterative/etc flatten() functions that can sweep through a list of arbitrary length, but that's really overkill for what I want. However, "sum(eggs, [])" or itertools seem to do it w/out the need for a new function. Thanks a lo

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Virgil Dupras
On Mar 7, 7:14 pm, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm looking for an easy way to flatten a two level list like this > > spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] > > Into something like > eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] > > There are *no* special c

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 21:14:43 -0300, Sergio Correia <[EMAIL PROTECTED]> escribió: > I'm looking for an easy way to flatten a two level list like this Try google. > PS: Why does `sum` works only with numbers? Try google. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python

Re: merits of Lisp vs Python

2007-03-07 Thread Ken Tilton
Brian Adkins wrote: > John Nagle wrote: > >>Neither Lisp nor Python is an "industrial strength language". >> The infrastructure is too weak. Hosting providers and distro >> makers aren't concerned over whether Python works. They >> care if C, C++, Java, PHP, and Perl work, but not Python o

tkinter how to write

2007-03-07 Thread Gigs_
as I write my first gui program (text editor) I wanna ask you guys how to separate code in classes.? Should I put in one class my menu and in another class text and scorllbars etc? or something else? thanks -- http://mail.python.org/mailman/listinfo/python-list

Flatten a two-level list --> one liner?

2007-03-07 Thread Sergio Correia
Hi, I'm looking for an easy way to flatten a two level list like this spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] Into something like eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] There are *no* special cases (no empty sub-lists). I have found two ways: 1) Accumulator eggs = [] fo

Re: is it possible to give an instance a value?

2007-03-07 Thread manstey
Thanks everyone for your replies. The language is Cache Object Script, a language used in Intersystems Relational Dbase. I think egbert's answer provides the simplest answer. It allows our python interface to Cache to be almost identical to Cache Object Script, with simeply the addition of (), wh

Re: Calling a function with unknown arguments?

2007-03-07 Thread Tombo
On Mar 7, 10:55 pm, "Rob" <[EMAIL PROTECTED]> wrote: > I can get a list of a function's arguments.>>> def bob(a, b): > > ... return a+b > ...>>> bob.func_code.co_varnames > > ('a', 'b') > > Let's say that I also have a dictionary of possible arguments for this > function. > > >>> possible = {'a

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
John Nagle wrote: >Neither Lisp nor Python is an "industrial strength language". > The infrastructure is too weak. Hosting providers and distro > makers aren't concerned over whether Python works. They > care if C, C++, Java, PHP, and Perl work, but not Python or LISP. > Ask them. > >

Re: Calling a function with unknown arguments?

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 19:55:08 -0300, Rob <[EMAIL PROTECTED]> escribió: > I can get a list of a function's arguments. def bob(a, b): > ... return a+b > ... bob.func_code.co_varnames > ('a', 'b') > > Let's say that I also have a dictionary of possible arguments for this > function.

Re: Best place for a function?

2007-03-07 Thread Sergio Correia
I also found out I can't use `unittest` with nested functions :-( Thank you all for the responses, Best, Sergio On 7 Mar 2007 14:57:54 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Diez B. Roggisch: > > If it really has no other use as in this class, put it as an > > instancemethod in th

Re: Calling a function with unknown arguments?

2007-03-07 Thread Grant Edwards
On 2007-03-07, Rob <[EMAIL PROTECTED]> wrote: > I can get a list of a function's arguments. def bob(a, b): > ... return a+b > ... bob.func_code.co_varnames > ('a', 'b') > > Let's say that I also have a dictionary of possible arguments for this > function. possible = {'a':10, 'b':

Re: merits of Lisp vs Python

2007-03-07 Thread John Nagle
Brian Adkins wrote: > George Sakkis wrote: > >> [EMAIL PROTECTED] wrote: >> >>> 1. Lisp is the only industrial strength language Neither Lisp nor Python is an "industrial strength language". The infrastructure is too weak. Hosting providers and distro makers aren't concerned over whether Pyt

IronPython with Apache

2007-03-07 Thread edfialk
Hi all, I'm completely new to Python, but fairly experienced in PHP and few other languages. Long story short: The IronPython executable doesn't work for .cgi scripts in my browser. I've been assigned to write a service that pulls in parameters from the URL, accesses a file and serves some data

Re: Best place for a function?

2007-03-07 Thread bearophileHUGS
Diez B. Roggisch: > If it really has no other use as in this class, put it as an > instancemethod in there. Alternatively, you _could_ nest it like this: Using an instancemethod may be the most formally correct solution for that problem, but often nested function are the simpler solution. A downsi

Calling a function with unknown arguments?

2007-03-07 Thread Rob
I can get a list of a function's arguments. >>> def bob(a, b): ... return a+b ... >>> bob.func_code.co_varnames ('a', 'b') Let's say that I also have a dictionary of possible arguments for this function. >>> possible = {'a':10, 'b':5, 'c':-3} How do I proceed to call bob(a=10, b=5) with this

Re: image processing

2007-03-07 Thread Claudio Grondi
edurand wrote: > Hi, > > We are are pleased to announce the version 3.0 of the image processing > library 'Filters'. > You can use it in Python, and we have provided tutorials and samples > in Python, with for exemple conversion from/to PIL image format. > > Have a look at : http://filters.source

Re: catching exceptions from an except: block

2007-03-07 Thread Diez B. Roggisch
Arnaud Delobelle schrieb: > On Mar 7, 8:52 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [snip] >> Without knowing more about the functions and the variable it is somewhat >> hard to tell what you are trying to accomplish. If a, b, c are functions >> that act on x when it is a different type, chang

Re: Best place for a function?

2007-03-07 Thread Bruno Desthuilliers
Sergio Correia a écrit : > I'm writing a class, where one of the methods is kinda complex. The > method uses a function which I know for certain will not be used > anywhere else. This function does not require anything from self, only > the args passed by the method. > > Where should I put the fun

Re: More M2Crypto build problems

2007-03-07 Thread John Nagle
Still more M2Crypto build problems: In M2Crypto's file "SWIG/_ec.i", there's this: #if OPENSSL_VERSION_NUMBER < 0x0090800fL || defined(OPENSSL_NO_EC) #undef OPENSSL_NO_EC %constant OPENSSL_NO_EC = 1; #else %constant OPENSSL_NO_EC = 0; %{ #include #include #include #include #include #inc

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : > En Wed, 07 Mar 2007 18:48:18 -0300, Arnaud Delobelle > <[EMAIL PROTECTED]> escribió: > >> for f in int, float, complex: >> try: >> return f(x) >> except ValueError: >> continue >> raise CantDoIt >> >> But if the three things I want to do are

Re: Best place for a function?

2007-03-07 Thread Diez B. Roggisch
Sergio Correia schrieb: > I'm writing a class, where one of the methods is kinda complex. The > method uses a function which I know for certain will not be used > anywhere else. This function does not require anything from self, only > the args passed by the method. > > Where should I put the func

Best place for a function?

2007-03-07 Thread Sergio Correia
I'm writing a class, where one of the methods is kinda complex. The method uses a function which I know for certain will not be used anywhere else. This function does not require anything from self, only the args passed by the method. Where should I put the function? a) Inside the module but outs

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : > On Mar 7, 8:52 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [snip] > >>Without knowing more about the functions and the variable it is somewhat >>hard to tell what you are trying to accomplish. If a, b, c are functions >>that act on x when it is a different type, chan

Re: merits of Lisp vs Python

2007-03-07 Thread Brian Adkins
George Sakkis wrote: > [EMAIL PROTECTED] wrote: > >> 1. Lisp is the only industrial strength language > ^^^ > You keep using that phrase. I don't think it means what you think it > means. [Vizzini has just cut the rope The Dread Pirate Roberts is climbing up]

Re: Direct memory access

2007-03-07 Thread Collin Stocks
One last thing. Does anyone know how to take a python object and measure how much space it is taking up in memory? I'm thinking probably not, but it's worth asking. -- http://mail.python.org/mailman/listinfo/python-list

Re: catching exceptions from an except: block

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 18:48:18 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: > for f in int, float, complex: > try: > return f(x) > except ValueError: > continue > raise CantDoIt > > But if the three things I want to do are not callable objects but > chunks of code

Re: catching exceptions from an except: block

2007-03-07 Thread garrickp
On Mar 7, 3:04 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 2:48 pm, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > > > > > > > I'm not really thinking about this situation so let me clarify. Here > > is a simple concrete example, taking the following for the functions > > a,b,c I mention in my origin

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : > En Wed, 07 Mar 2007 19:00:59 -0300, Bruno Desthuilliers > <[EMAIL PROTECTED]> escribió: > >> this kind of cose is exactly what OO polymorphic dispatch is supposed to > > > this kind of cose? sorry s/cose/code/ > Ce genre de chose? > En quelques sortes, oui, quo

RE: Python 2.1 and Daylight saving time

2007-03-07 Thread skip
removing webmaster email address... Others reading this with more experience manipulating timezones please reply. This is completely out of the realm of my experience, but since I pointed Wayne here from the webmaster mailing list I felt I should respond. What I've written is based solely on read

Re: catching exceptions from an except: block

2007-03-07 Thread garrickp
On Mar 7, 2:48 pm, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > > I'm not really thinking about this situation so let me clarify. Here > is a simple concrete example, taking the following for the functions > a,b,c I mention in my original post. > - a=int > - b=float > - c=complex > - x i

Re: Direct memory access

2007-03-07 Thread Collin Stocks
Thanks. I didn't know about ctypes. -- http://mail.python.org/mailman/listinfo/python-list

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : > Hi all, > > Imagine I have three functions a(x), b(x), c(x) that each return > something or raise an exception. Imagine I want to define a function > that returns a(x) if possible, otherwise b(x), otherwise c(x), > otherwise raise CantDoIt. > > Here are three ways I

Re: catching exceptions from an except: block

2007-03-07 Thread Arnaud Delobelle
On Mar 7, 8:52 pm, Larry Bates <[EMAIL PROTECTED]> wrote: [snip] > Without knowing more about the functions and the variable it is somewhat > hard to tell what you are trying to accomplish. If a, b, c are functions > that act on x when it is a different type, change to one function that > can hand

Re: catching exceptions from an except: block

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 19:00:59 -0300, Bruno Desthuilliers <[EMAIL PROTECTED]> escribió: > this kind of cose is exactly what OO polymorphic dispatch is supposed to this kind of cose? Ce genre de chose? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Larry Bates a écrit : (snip) > def d(x): > if isinstance(x, basestring): > # > # Code here for string > # > elif isinstance(x, int): > # > # Code here for int > # > elif isinstance(x, float): > # > # Code here for string >

Re: catching exceptions from an except: block

2007-03-07 Thread Bruno Desthuilliers
Miki a écrit : > Hello Arnaud, > > >>Imagine I have three functions a(x), b(x), c(x) that each return >>something or raise an exception. Imagine I want to define a function >>that returns a(x) if possible, otherwise b(x), otherwise c(x), >>otherwise raise CantDoIt. > > Exceptions are for error

Re: Debugging segmentation faults

2007-03-07 Thread John Nagle
You're using Python on a web server to do something complicated. You must suffer. Are you trying to fork off a subprocess in a multithreaded program? That's unlikely to work. The sematics differ from OS to OS (Solaris forks all the threads, most other operating systems don't; most UNIX-

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 15:21:57 -0300, Laurent Pointal <[EMAIL PROTECTED]> escribió: > Gabriel Genellina wrote: > >> En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal >> <[EMAIL PROTECTED]> escribió: >> >>> Why does Python allow generator expression parenthesis to be mixed with >>> function call

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread Robert Kern
John wrote: > Then is there anyway to sort the numeric keys and avoid future implemetation > confusion? sorted(mydict.keys()) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it h

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Joshua J. Kugler
Chris Mellon wrote: >> My problem (and the reason I set reuse to True) is this: if I have >> connections active when I restart my service, upon restart, the socket >> will >> fail to bind because there is still a connection in a WAIT state. > > This is just the way sockets work on your platform. H

Re: Debugging segmentation faults

2007-03-07 Thread SPE - Stani's Python Editor
If the error is reproducable and you can run wxPython, you could use the excellent WinPdb debugger, which ships with SPE (python editor): http://www.digitalpeers.com/pythondebugger/ ... but if you can only run your script on a remote server this won't help you. Stani -- SPE - http://pythonide.st

Re: catching exceptions from an except: block

2007-03-07 Thread Larry Bates
Arnaud Delobelle wrote: > Hi all, > > Imagine I have three functions a(x), b(x), c(x) that each return > something or raise an exception. Imagine I want to define a function > that returns a(x) if possible, otherwise b(x), otherwise c(x), > otherwise raise CantDoIt. > > Here are three ways I can

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread John
Then is there anyway to sort the numeric keys and avoid future implemetation confusion? "Ant" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mar 7, 8:18 pm, "John" <[EMAIL PROTECTED]> wrote: > ... >> However, I am not sure whether it is always like this. Can anybody >> confir

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread Carsten Haese
On Wed, 2007-03-07 at 15:18 -0500, John wrote: > I am coding a radix sort in python and I think that Python's dictionary may > be a choice for bucket. > > The only problem is that dictionary is a mapping without order. But I just > found that if the keys are numeric, the keys themselves are orde

Re: Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread Ant
On Mar 7, 8:18 pm, "John" <[EMAIL PROTECTED]> wrote: ... > However, I am not sure whether it is always like this. Can anybody confirm > my finding? >From the standard library docs: "Keys and values are listed in an arbitrary order which is non-random, varies across Python implementations, and dep

Re: finding monitor or screen resolution in Linux with standard python module

2007-03-07 Thread consmash
On Mar 7, 11:25 am, "akbar" <[EMAIL PROTECTED]> wrote: > I googled and searched in archive. All I can find is finding > resolution with Tkinter and pygame. Any idea to find monitor > resolution with standard python module? > I can check from output of: xprop -root > _NET_DESKTOP_GEOMETRY(CARDINAL)

Re: Direct memory access

2007-03-07 Thread Travis Oliphant
Collin Stocks wrote: > Does anyone know how to directly handle memory using python? > I want to be able, for example, to copy the actual contents of a memory > address, or set the actual contents of a memory address. This kind of thing is generally not what Python is used for, so it's not really

More M2Crypto build problems

2007-03-07 Thread John Nagle
Trying to build M2Crypto on a dedicated server running Red Hat Fedora Core 6. I'm trying to do this right, without manual patching. The error message I'm getting during build is: python setup.py build ... swig -python -I/usr/include -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i /usr/include/openssl/o

  1   2   >