ANN: pyftpdlib 0.1.1

2007-03-07 Thread billiejoex
Changed in version 0.1.1 == * port selection on PASV command has been randomized (this to prevent a remote user to know how many data connections are in progress on the server). * fixed bug in demo/unix_ftpd.py script. * ftpd automatically re-use address if current system is

ANN: pinder 0.5.0

2007-03-07 Thread Lawrence Oluyede
Pinder is a straightforward API to interface with Campfire http:// www.campfirenow.com, the web chat application from 37Signals. Pinder allows you to create rooms, delete them, speak from a remote client and more. For example: room = campfire.find_room_by_name('Jonz Room') print room.users()

Re: Any module to parse httpd.conf?

2007-03-07 Thread Ger Flanagan
On 6 Mar 2007 02:03:33 -0800, Gerard Flanagan [EMAIL PROTECTED] wrote: Hello, Does anyone know of an existing module to parse httpd.conf files? Thanks. Jeff McNeil [EMAIL PROTECTED] wrote: I looked at http://www.python.org/pypi/httpdrun not so long ago, itmight be able to do what you

Re: How to check whether file is open or not

2007-03-07 Thread Diez B. Roggisch
Ros wrote: There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case I would ignore processing that particular file and move to next file. How can I

Re: How to check whether file is open or not

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 02:28:33 -0300, Ros [EMAIL PROTECTED] escribió: There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case I would ignore processing

Re: Device Drivers in python(kernel modules)

2007-03-07 Thread Laurent Pointal
John Nagle a écrit : Thomas Ploch wrote: rishi pathak schrieb: I am not much of a kernel programmer , I have a requirement to shift a python code to work as a kernel module. So I was just wondering whether we can write a kernel module in python. A thought is that if we can somehow convert

Re: How to check whether file is open or not

2007-03-07 Thread Mattias Nilsson
Ros wrote: There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case I would ignore processing that particular file and move to next file. How can I

distutils: tweaking my ini to use relevant data_files path

2007-03-07 Thread Anastasios Hatzis
I would like to let my setup script know if the user has provided a custom path for the data_files of my distribution, e.g. by using the --install-data option, so the setup can automagically change a config information in my package to the local path applied, instead of using some default path

Re: askstring Window to the top under Windows

2007-03-07 Thread iwl
On 7 Mrz., 02:49, jim-on-linux [EMAIL PROTECTED] wrote: On Tuesday 06 March 2007 08:13, iwl wrote: Hi, I tryed askstring to input some text in my script, but some ugly empty Window appears with the Input-Window behind and all together behind my Console showing my script. So all have

Re: audio video streaming communications

2007-03-07 Thread Paul Sijben
Hi Ken, I am looking for something similar. I can do the communications myself but need to be able to select a video feed, capture it and also need to display it through wxPython. Trawled the web and even tried to hire coders to create it for me. So far I have been having no luck. I did learn

finding monitor or screen resolution in Linux with standard python module

2007-03-07 Thread akbar
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) . The problem is when you use Beryl or Xgl, it is not correct

How to build a Windows service using win32?

2007-03-07 Thread Gregor Mosheh
I'm trying to write a Win32 service. The following is straight from Python Programming on Win32 and it doesn't work. Is that book out of date; is there a new way to do services? I searched Google for hours trying to find any other method, and have been beating on this one for 5 more hours. The

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: The JonPy version: http://jonpy.sourceforge.net/fcgi.html Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to build a Windows service using win32?

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 07:25:56 -0300, Gregor Mosheh [EMAIL PROTECTED] escribió: I'm trying to write a Win32 service. The following is straight from Python Programming on Win32 and it doesn't work. Is that book out of date; is there a new way to do services? I searched Google for hours

thread and portability Unix/Linux

2007-03-07 Thread awalter1
Hi, I have a Python application that runs under HPUX 11.11 (then unix). It uses threads : from threading import Thread # Class Main class RunComponent(Thread): My application should run under Linux (red hat 3 ou 4) and I read that differences exist between the implementation of threads : on HPUX

Pb with __del__ and inheritence

2007-03-07 Thread Erwan Adam
Hello all, Can someone reproduce this bug ... I use : [EMAIL PROTECTED] /home/adam/Work/Python] python Python 2.4.3 (#2, Sep 18 2006, 21:07:35) [GCC 4.1.1 20060724 (prerelease) (4.1.1-3mdk)] on linux2 Type help, copyright, credits or license for more information. First test : [EMAIL

Re: Pb with __del__ and inheritence

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 07:35:05 -0300, Erwan Adam [EMAIL PROTECTED] escribió: Can someone reproduce this bug ... I use : Same on 2.5 Windows. class XObject(object): def __del__(self): print XObject.__del__ return pass class A(XObject): def

Re: re-point mod_python - is it possible?

2007-03-07 Thread leland
great explaination - thanks graham! -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt4: Clickable links in QLabel?

2007-03-07 Thread Tina I
David Boddie wrote: On Thursday 01 March 2007 09:00, Tina I wrote: A short and sweet question: Is it possible to put a clickable link in a QLabel that will open in the systems default browser? Yes. I tried to put in some HTML but it did (of course?) simply display the code instead of a

Re: *** CANADIAN ANTI-TERROR LAW HAS BEEN STRUCK DOWN BY ITS HONORABLE SUPREME COURT UNANIMOUSLY *** (REPOST)

2007-03-07 Thread Aviroce
On Feb 24, 11:22 am, [EMAIL PROTECTED] wrote: Canada anti-terror law is struck downFrom the Associated Press February 24, 2007 OTTAWA - Canada's Supreme Court on Friday unanimously declared it unconstitutional to detain foreign terrorism suspects indefinitely while the courts review their

Re: How to build a Windows service using win32?

2007-03-07 Thread Giles Brown
On 7 Mar, 10:25, Gregor Mosheh [EMAIL PROTECTED] wrote: I'm trying to write a Win32 service. The following is straight from Python Programming on Win32 and it doesn't work. Is that book out of date; is there a new way to do services? I searched Google for hours trying to find any other method,

Re: Python Source Code Beautifier

2007-03-07 Thread Alan Franzoni
Il Tue, 06 Mar 2007 01:55:54 -0300, Gabriel Genellina ha scritto: The problem is that other people -not necesarily smarter and more experienced than you- may use those features, and perhaps you have to read, understand and modify some code written by someone else. So, you should at least

distutils - how to get more flexible configuration

2007-03-07 Thread Jonathan Fine
Hello I'm writing a package that has cgi-bin scripts, html files and data files (templates used by cgi scripts). I find that using distutils in the standard way does not give me enough flexibilty, even if I use a setup.cfg. For example, I want certain data files to go to markedly different

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Greg Copeland
On Feb 26, 5:54 pm, Joshua J. Kugler [EMAIL PROTECTED] wrote: Considering that UNIX Network Programming, Vol 1 (by W. Richard Stevens) recommends _All_ TCP servers should specify [SO_REUSEADDR] to allow the server to be restarted [if there are clients connected], and that

Re: askstring Window to the top under Windows

2007-03-07 Thread jim-on-linux
On Wednesday 07 March 2007 05:05, iwl wrote: On 7 Mrz., 02:49, jim-on-linux [EMAIL PROTECTED] wrote: On Tuesday 06 March 2007 08:13, iwl wrote: Hi, I tryed askstring to input some text in my script, but some ugly empty Window appears with the Input-Window behind and all

Tkinter menu

2007-03-07 Thread Gigs_
hi i have create widget with menu bar and menus on it. when i resize my widget to less than menubar is than from right to left menus on menubar goes to second row. who to disable that? all I want is that when i resize my widget to less size, that menus on menubar stays on default position .

Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
[Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32] Given the following: sum(i for i in range(10)) 45 def f(*args) : print args ... f(i for i in range(10)) (generator object at 0x00A79788,) def f(a,*args) : print a,ar ... f(4,i for i in range(10)) File stdin,

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

2007-03-07 Thread José Antonio Salazar Montenegro
I'm using Beryl too, and xwininfo -root gives te correct resolution. akbar 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

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Facundo Batista
Laurent Pointal wrote: f(4,i for i in range(10)) File stdin, line 1 SyntaxError: invalid syntax Why does Python allow generator expression parenthesis to be mixed with function call parenthesis when there is only one parameter ? For simplicity and elegant coding, so you can do

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

2007-03-07 Thread MonkeeSage
On Mar 7, 4: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) . The

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal [EMAIL PROTECTED] escribió: f(4,i for i in range(10)) File stdin, line 1 SyntaxError: invalid syntax 2.5 has a better error message: py f(4,i for i in range(10)) File stdin, line 1 SyntaxError: Generator expression must be

Re: How to build a Windows service using win32?

2007-03-07 Thread Gregor Mosheh
Giles Brown wrote: Yeah. You've cleverly decided to simplify the smallest possible python service by removing the if __name__ == '__main__': Ha ha. :) Seriously, though, I removed that long after it was failing to work, and have since replaced it and it didn't affect a thing. Gabriel

Re: askstring Window to the top under Windows

2007-03-07 Thread jim-on-linux
On Wednesday 07 March 2007 05:02, Ingo Wolf wrote: Original-Nachricht Datum: Tue, 06 Mar 2007 20:49:42 -0500 Von: jim-on-linux [EMAIL PROTECTED] An: python-list@python.org CC: iwl [EMAIL PROTECTED] Betreff: Re: askstring Window to the top under Windows By default tk

Re: How to build a Windows service using win32?

2007-03-07 Thread Gregor Mosheh
Giles Brown wrote: Yeah. You've cleverly decided to simplify the smallest possible python service by removing the if __name__ == '__main__': Ha ha. :) Seriously, though, I removed that long after it was failing to work, and have since replaced it and it didn't affect a thing. Gabriel

Re: Python Source Code Beautifier

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 10:29:29 -0300, Alan Franzoni [EMAIL PROTECTED] escribió: Il Tue, 06 Mar 2007 01:55:54 -0300, Gabriel Genellina ha scritto: If we rely on duck typing, by the way, we may encounter two types quacking like ducks, flying like ducks, but in fact acting as slightly

Re: Recommended FastCGI module?

2007-03-07 Thread John Nagle
Jon Ribbens wrote: In article [EMAIL PROTECTED], John Nagle wrote: The JonPy version: http://jonpy.sourceforge.net/fcgi.html Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) Does it work with current Pythons? (2.4, 2.5)? I'm

Re: How to build a Windows service using win32?

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 13:45:44 -0300, Gregor Mosheh [EMAIL PROTECTED] escribió: Now, I did stumble upon the solution to this one this morning, after a fresh night of sleep: I re-ran python tester.py install I got a message that the service had been updated, and now it runs! Hooray! Any

Re: Recommended FastCGI module?

2007-03-07 Thread Robin Becker
John Nagle wrote: What's the recommended FastCGI module for Python. There are at least five: The Robin Dunn / Total Control Software version: http://alldunn.com/python/fcgi.py Last revised in 1998. ... we are using a slightly modified and modernized version

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article [EMAIL PROTECTED], John Nagle wrote: Jon Ribbens wrote: The JonPy version: http://jonpy.sourceforge.net/fcgi.html Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) Does it work with current Pythons? (2.4, 2.5)? I'm

Re: Project organization and import

2007-03-07 Thread [EMAIL PROTECTED]
package_name/ package_pre.py - contains globals for the package component_a.py- a useful-sized collection of functionality component_b.py- another component_c.py- another package_post.py - stuff that relies on the prior stuff __init__.py -

Re: Generator expression parenthesis mixed with function call ones

2007-03-07 Thread Laurent Pointal
Gabriel Genellina wrote: En Wed, 07 Mar 2007 12:53:43 -0300, Laurent Pointal [EMAIL PROTECTED] escribió: f(4,i for i in range(10)) File stdin, line 1 SyntaxError: invalid syntax 2.5 has a better error message: py f(4,i for i in range(10)) File stdin, line 1 SyntaxError:

catching exceptions from an except: block

2007-03-07 Thread Arnaud Delobelle
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 think of doing it: -- # This

Re: persistent fifo queue class

2007-03-07 Thread David Bear
Diez B. Roggisch wrote: David Bear schrieb: I'm looking to see if there are any examples or prewritting fifo queue classes. I know this is a broad topic. I'm looking to implement a simple application where a web server enqueue and pickle using a local socket on to a 'queue server' -- and

Debugging segmentation faults

2007-03-07 Thread George Sakkis
I have a pure python program (no C extensions) that occasionally core dumps in a non-reproducible way. The program is started by a (non- python) cgi script when a form is submitted. It involves running a bunch of other programs through subprocess in multiple threads and writing its output in

Any HTML to Latex module available in Python

2007-03-07 Thread Ramdas
Any HTML to Latex module available in Python which I can use to convert HTML text to Latex Ramdas -- http://mail.python.org/mailman/listinfo/python-list

Re: catching exceptions from an except: block

2007-03-07 Thread Miki
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 handling, not flow control.

RE: Python 2.1 and Daylight saving time

2007-03-07 Thread Hammett, Wayne
Thanks for the quick reply. Help me OB1, I mainly needed to know if I could avert Daylight Saving Time issues by upgrading to Python 2.5. It appears that Python gets it UTC settings from a table in the C library. Does this still hold true for Python 2.5. It looks that it will fail to recognize

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Joshua J. Kugler
Greg Copeland wrote: Is there some history to this of which I'm not aware? Is there a good reason for it to default to false? SNIP Greg's very informative reply Long story short, it is not a bug. It is a feature. The proper default is that of the OS, which is to ensure SO_REUSEADDR is

Re: SPE python IDE: Call for testers!

2007-03-07 Thread SPE - Stani's Python Editor
On 6 Mrz., 23:21, MonkeeSage [EMAIL PROTECTED] wrote: Very nice. One issue I've come across is that it doesn't seem to work with wxwidgets-2.8 (segfault when trying to load a file), so you should probably set MIN_WX_VERSION to 2.8. Regards, Jordan Hi Jordan, Thanks for trying. Did you try

Re: thread and portability Unix/Linux

2007-03-07 Thread Joshua J. Kugler
awalter1 wrote: Hi, I have a Python application that runs under HPUX 11.11 (then unix). It uses threads : from threading import Thread # Class Main class RunComponent(Thread): My application should run under Linux (red hat 3 ou 4) and I read that differences exist between the

Re: catching exceptions from an except: block

2007-03-07 Thread Arnaud Delobelle
On 7 Mar, 19:26, Miki [EMAIL PROTECTED] wrote: Hello Arnaud, Hi Miki [snip] Exceptions are for error handling, not flow control. Maybe but it's not always that clear cut! As error handling is a form of flow control the two have to meet somewhere. [snip] As a side note, try to avoid catch:,

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-07 Thread Chris Mellon
On 3/7/07, Joshua J. Kugler [EMAIL PROTECTED] wrote: Greg Copeland wrote: Is there some history to this of which I'm not aware? Is there a good reason for it to default to false? SNIP Greg's very informative reply Long story short, it is not a bug. It is a feature. The proper default

Re: using python to query active directory

2007-03-07 Thread Michael Ströder
David Bear wrote: Is it possible to use python to make calls agains microsoft active directory? What do you mean with calls agains microsoft active directory? Querying user and computer entries etc.? python-ldap might be an option for you. Ciao, Michael. --

Is numeric keys of Python's dictionary automatically sorted?

2007-03-07 Thread John
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 ordered in the dictionary. part of my code is like this:

Re: catching exceptions from an except: block

2007-03-07 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Arnaud Delobelle wrote: # This one only works because a,b,c are functions # Moreover it seems like an abuse of a loop construct to me def rolled_first(x): for f in a, b, c: try: return f(x) except: continue raise

Re: catching exceptions from an except: block

2007-03-07 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Miki wrote: Exceptions are for error handling, not flow control. That's not true, they are *exceptions* not *errors*. They are meant to signal exceptional situations. And at least under the cover it's used in every ``for``-loop because the end condition is signaled by a

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

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

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) . The

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 depends on

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 ordered

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 confirm my

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 think

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 -

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. How

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 had

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 parenthesis when

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

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 handling,

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 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 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 handle

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 can

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 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 is a string

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

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, quoique pas

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 original post. -

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 this

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: 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: 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, change to one

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

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 function?

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 not callable objects

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 openssl/bn.h #include openssl/err.h #include

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

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, change to one

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 :

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: 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

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 Python works.

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':5, 'c':-3} How do

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 there.

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. possible = {'a':10,

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 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':10, 'b':5, 'c':-3}

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 (),

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 = []

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

  1   2   >