[ANN] ftputil 2.4 released

2009-02-15 Thread Stefan Schwarzer
ftputil 2.4 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.3 - The ``FTPHost`` class got a new method ``chmod``, similar to ``os.chmod``, to act on remote files. Thanks go to Tom Parker for the review. There's a new exception

ann: PythonOCC 0.1 released

2009-02-15 Thread Jelle Feringa
-about- pythonOCC aims to provide a full Python wrapper for the OpenCascade's 3D CAD modeling/visualization library classes. The first step is to focus on modeling and import/export classes (IGES, STEP, VRML) in order to provide a complete, powerful, and easy- to-use 3D modeler using Python

Re: How to peek inside a decorated function

2009-02-15 Thread Terry Reedy
Steven D'Aprano wrote: Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func): def f(*args): args = list(args) args.reverse() return func(*args) return f def

Re: Reading a file

2009-02-15 Thread zaheer . agadi
On Feb 15, 10:27 am, Steven D'Aprano st...@pearwood.info wrote: Philipp Pagel wrote: zaheer.ag...@gmail.com wrote: Hi How do i read  a file in Python and search a particular pattern like I have a file char.txt  which has Mango=sweet Sky=blue I want to get the strings sweet and

Re: How to peek inside a decorated function

2009-02-15 Thread Peter Otten
Steven D'Aprano wrote: Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func): def f(*args): args = list(args) args.reverse() return func(*args) return f

Re: GetKeyboardLayoutName Win32API

2009-02-15 Thread Tim Golden
Tsolakos Stavros wrote: Hi all. I was trying to find a way to read the currently selected input layout from an app written in python. I am aware that if the app were written in C, I would have to call the GetKeyboardLayoutName() function. How can this be done in Python? I want to avoid writing

Re: ImportError: dynamic module does not define init function (inittypes)

2009-02-15 Thread Stefan Behnel
konteya joshi wrote: I see the following error on running the program: 'import site' failed; use -v for traceback Traceback (most recent call last): File skyline\alpine_kickoff.py, line 6, in ? import re File C:\Perforce\qa\testware\build\vmqa\python\python-2.4.1-as\lib\re.py,

Re: How to peek inside a decorated function

2009-02-15 Thread Hrvoje Niksic
Steven D'Aprano st...@pearwood.info writes: Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func): def f(*args): args = list(args) args.reverse() return

Fw: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
Hendrik van Rooyen ma...@morp.co.za wrote: If you can get down so low in baud rate, then you can fudge it in software. Set the port to the single stop bit, and make a transmit character function that outputs a single character and a flush(), and then waits for a bit time or so -

Re: How to peek inside a decorated function

2009-02-15 Thread Aaron Brady
On Feb 15, 4:27 am, Hrvoje Niksic hnik...@xemacs.org wrote: Steven D'Aprano st...@pearwood.info writes: Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func):     def f(*args):        

ANN: SuPy 1.3

2009-02-15 Thread Greg Ewing
SuPy 1.3 Available -- http://www.cosc.canterbury.ac.nz/greg.ewing/SuPy/ Changes in this version: - Added the rest of the promised functionality to the menus module (submenus and separators) and provided an example of its usage in examples.py. - The scheme for preserving

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
John Nagle na...@...ats.comwrote: So the correct combination, 5 bits with 1.5 stop bits, isn't supported in Python. 1 stop bit will not physically work on Baudot teletypes; the main camshaft doesn't come around fast enough. (Yes, there's an actual mechanical reason for 1.5 stop bits.)

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
MRAB goo...@m...tt.plus.com wrote: Grant Edwards wrote: On 2009-02-14, John Nagle na...@animats.com wrote: Can Python's serial port support be made to run at 45.45 baud, the old 60 speed Teletype machine speed? If your hardware and OS supports it, Python can be made to support

Python WebDAV library

2009-02-15 Thread zaheer . agadi
Hi I am looking for WebDAV library in Python I found one in http://users.sfo.com/~jdavis/Software/PyDAV/readme.html and one here http://pypi.python.org/packages/any/P/Python_WebDAV_Library/ I basically have to upload and download files/folders to/from a server should be able to copy them move

Re: How to peek inside a decorated function

2009-02-15 Thread Steven D'Aprano
Hrvoje Niksic wrote: Is there any way to peek inside the decorated function rsay() to get access to the undecorated function say()? This works in Python 2.5.2: rsay.func_closure[0].cell_contents function say at 0xb7e67224 Thanks to everyone who responded. The reason I ask is because

Re: How to peek inside a decorated function

2009-02-15 Thread Peter Otten
Steven D'Aprano wrote: Suppose I have a function f() which I know has been decorated, but I don't have access to the original undecorated function any longer: def reverse(func): def f(*args): args = list(args) args.reverse() return func(*args) return f

Re: Who's on First, IDLE or pythonWin? Dialog Problem?

2009-02-15 Thread Steve Holden
W. eWatson wrote: It looks like I got an accidentally case of send message 3 times. Well, here's a correct below. The question now is what can I do about it? reboot? Just to re-iterate the answer I provided to *the question to a post above*, I'm using Tkinter for the program's GUI. Just

Re: How to peek inside a decorated function

2009-02-15 Thread Duncan Booth
Steven D'Aprano st...@pearwood.info wrote: The reason I ask is because I've just spent the weekend battling with doctests of decorated functions, and discovering that without functools.wraps() all my doctests weren't being called. I'm wondering whether it would be a good idea for doctest to

Re: hpw to convert a linux python script ?

2009-02-15 Thread Steve Holden
Stephen Hansen wrote: # Absolute path to the directory that holds media. # Example: /home/media/media.lawrence.com/ MEDIA_ROOT = fsroot+'/Projects/PytDj/images/' Note that most Windows APIs allow you to use the forward slash as a delimiter. It's mostly the command line and Windows Explorer

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Diez B. Roggisch
Hrvoje Niksic schrieb: Diez B. Roggisch de...@nospam.web.de writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't work on 64-bit architectures, nor does it work when

Re: Byte type?

2009-02-15 Thread Steve Holden
Erik Max Francis wrote: John Nagle wrote: With bytearray, the element type is considered to be unsigned byte, or so says PEP 3137: The element data type is always 'B' (i.e. unsigned byte). Let's try: Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Roy Smith
In article vjwdnzbzqsvzowrunz2dnuvz_rdin...@posted.usinternet, Grant Edwards gra...@visi.com wrote: My guess is that it was _supposed_ to be a CRC routine, but somebody botched it. They used the same botched routine on the host end when they did testing, so nobody noticed it was broken.

Re: Byte type?

2009-02-15 Thread Benjamin Peterson
Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series ... It's not an ugly hack. It just isn't all that you might hope it'd live up to be. --

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Thomas Heller
Christian Heimes schrieb: Hrvoje Niksic schrieb: Diez B. Roggisch de...@nospam.web.de writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't work on 64-bit

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread MRAB
Roy Smith wrote: In article vjwdnzbzqsvzowrunz2dnuvz_rdin...@posted.usinternet, Grant Edwards gra...@visi.com wrote: My guess is that it was _supposed_ to be a CRC routine, but somebody botched it. They used the same botched routine on the host end when they did testing, so nobody noticed it

python in emacs

2009-02-15 Thread kentandkat
When I visit a file with extension .py, emacs says loading python...done, and gives me a python menu with options like start interpreter and eval buffer. When I try to use one of these options emacs says loading compile...done, then hangs and has to be shut down from the task manager. The Python

Re: python in emacs

2009-02-15 Thread Diez B. Roggisch
kentand...@sbcglobal.net schrieb: When I visit a file with extension .py, emacs says loading python...done, and gives me a python menu with options like start interpreter and eval buffer. When I try to use one of these options emacs says loading compile...done, then hangs and has to be shut down

Re: Byte type?

2009-02-15 Thread Steve Holden
Benjamin Peterson wrote: Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series ... It's not an ugly hack. It just isn't all that you might hope it'd live up to be. I take

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Steve Holden
MRAB wrote: Roy Smith wrote: In article vjwdnzbzqsvzowrunz2dnuvz_rdin...@posted.usinternet, Grant Edwards gra...@visi.com wrote: My guess is that it was _supposed_ to be a CRC routine, but somebody botched it. They used the same botched routine on the host end when they did testing, so

Re: Byte type?

2009-02-15 Thread John Nagle
Benjamin Peterson wrote: Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series ... It's not an ugly hack. It just isn't all that you might hope it'd live up to be. The

Re: Easier to wrap C or C++ libraries?

2009-02-15 Thread Nick Craig-Wood
Christian Heimes li...@cheimes.de wrote: Hrvoje Niksic schrieb: Diez B. Roggisch de...@nospam.web.de writes: The answer is easy: if you use C, you can use ctypes to create a wrapper - with pure python, no compilation, no platform issues. The last part is not true. ctypes doesn't

Re: Byte type?

2009-02-15 Thread Benjamin Kaplan
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle na...@animats.com wrote: Benjamin Peterson wrote: Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series ... It's not an ugly

BaseHttpServer

2009-02-15 Thread Paul
Hi, I currently have a webserver using BaseHttpServe that serves images like this: if self.path.endswith(.jpg): print(curdir + sep + self.path) f = open(curdir + sep + self.path,b) self.send_response(200)

Re: python in emacs

2009-02-15 Thread Craig
I would go to ubuntu linux if you can. --- On Sun, 2/15/09, Diez B. Roggisch de...@nospam.web.de wrote: From: Diez B. Roggisch de...@nospam.web.de Subject: Re: python in emacs To: python-list@python.org Date: Sunday, February 15, 2009, 9:23 AM kentand...@sbcglobal.net schrieb: When I visit a

Pythonic way to determine if a string is a number

2009-02-15 Thread python
What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. I searched the string and cMath libraries for a similar function without success. I can think of at least 3 or 4 ways to build my own function. Here's what I came up with as a

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Christian Heimes
pyt...@bdurham.com schrieb: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. I searched the string and cMath libraries for a similar function without success. I can think of at least 3 or 4 ways to build my own function. Here's what

python in emacs

2009-02-15 Thread kentandkat
When I visit a file with extension .py, emacs says loading Python...done and gives me a Python menu with options like start interpreter and eval buffer. When I try to use these options, or others on the Python menu, emacs says loading compile...done, then hangs and has to be shut down from the

PHP like documentation?

2009-02-15 Thread Pavan Mishra
I was wondering if I can use python documentation source (reStructuredText) and restructure it along the lines of PHP documentation. Allowing users to add comments, improving search etc. I was thinking if it would be useful. -- http://mail.python.org/mailman/listinfo/python-list

Re: Byte type?

2009-02-15 Thread Mark Tolonen
John Nagle na...@animats.com wrote in message news:499841bf$0$1624$742ec...@news.sonic.net... Benjamin Peterson wrote: Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Philip Semanchuk
On Feb 15, 2009, at 12:46 PM, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. try: int(number) is_an_int = True except: is_an_int = False try: float(number) is_a_float = True except:

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread John Nagle
John Nagle wrote: MRAB wrote: John Nagle wrote: [snip] So the correct combination, 5 bits with 1.5 stop bits, isn't supported in Python. 1 stop bit will not physically work on Baudot teletypes; the main camshaft doesn't come around fast enough. (Yes, there's an actual mechanical reason for

Re: Byte type?

2009-02-15 Thread John Nagle
Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle na...@animats.com wrote: Benjamin Peterson wrote: Because b'x' is NOT a bytearray. It is a bytes object. When you actually use a bytearray, it behaves like you expect. type(b'x') class 'bytes' type(bytearray(b'x'))

Re: Byte type?

2009-02-15 Thread John Nagle
Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle na...@animats.com wrote: Benjamin Peterson wrote: Because b'x' is NOT a bytearray. It is a bytes object. When you actually use a bytearray, it behaves like you expect. type(b'x') class 'bytes' type(bytearray(b'x'))

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Roy Smith
In article mailman.9571.1234720024.3487.python-l...@python.org, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. try: int(myString) except ValueError: print That's bogus, man --

Re: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

2009-02-15 Thread Christian Heimes
tkevans schrieb: Found a couple of references to this in the newsgroup, but no solutions. I'm trying to build libsbml-3.3.0 with python 2.5.4 support on RHEL 5.3. This RedHat distro has python 2.4.5, and libsbml builds ok with that release. After building 2.5.4 (./configure CFLAGS=-fPIC

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Christian Heimes
Philip Semanchuk schrieb: On Feb 15, 2009, at 12:46 PM, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. try: int(number) is_an_int = True except: is_an_int = False Please don't teach new

Re: Rapidshare to Megaupload script

2009-02-15 Thread aiwarrior
Thanks a lot for your input i really needed because i realized these are minor flaws but even so define whether its good or bad code and i really need to improve that. I already implemented the changes you suggested and this one, cookie = dict(x.split(=) for x in cookie) for me is just very

Re: Rapidshare to Megaupload script

2009-02-15 Thread aiwarrior
Thanks a lot for your input i really needed because i realized these are minor flaws but even so define whether its good or bad code and i really need to improve that. I already implemented the changes you suggested and this one, cookie = dict(x.split(=) for x in cookie) for me is just very

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread MRAB
Roy Smith wrote: In article mailman.9571.1234720024.3487.python-l...@python.org, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. try: int(myString) It could be a float, so: float(myString) This will

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Roy Smith
In article mailman.9577.1234722607.3487.python-l...@python.org, Christian Heimes li...@cheimes.de wrote: Philip Semanchuk schrieb: On Feb 15, 2009, at 12:46 PM, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer

Re: Rapidshare to Megaupload script

2009-02-15 Thread MRAB
aiwarrior wrote: Thanks a lot for your input i really needed because i realized these are minor flaws but even so define whether its good or bad code and i really need to improve that. I already implemented the changes you suggested and this one, cookie = dict(x.split(=) for x in cookie)

Cannot able to retreive compressed html URL

2009-02-15 Thread rushik
Hi, I am trying to build python script which retreives and analyze the various URLs and generate reports. Some of the urls are like http://xyz.com/test.html.gz;, I am trying to retreive it using urllib2 library and then using gzip library trying to decompress it. ex - server_url is say -

Python interface to ODF documents?

2009-02-15 Thread Dotan Cohen
Is there a Python interface to ODF documents? I'm thinking of something that will import, for example, an ADS spreadsheet into a multidimensional array (including formulas and formatting) and let me manipulate it, then save it back. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread python
Thanks for everyone's feedback. I believe my original post's code (updated following my signature) was in line with this list's feedback. Christian: Thanks for reminding me about exponential formats. My updated code accounts for these type of numbers. I don't need to handle inf or nan values. My

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Christian Heimes
Roy Smith wrote: I agree that the bare except is incorrect in this situation, but I don't agree that you should *never* use them. A bare except should be used when followed by a raise try: func() except: log_error() raise They make sense when you need to recover from any error that

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Tim Golden
pyt...@bdurham.com wrote: code # str_to_num.py def isnumber( input ): try: num = float( input ) return True except ValueError: return False Just for the info, Malcolm, you don't actually need to assign the result of float (input) to anything if you don't need

Re: Python interface to ODF documents?

2009-02-15 Thread Tino Wildenhain
Hi, Dotan Cohen wrote: Is there a Python interface to ODF documents? I'm thinking of something that will import, for example, an ADS spreadsheet into a multidimensional array (including formulas and formatting) and let me manipulate it, then save it back. Yes, you have zipfile and a host of

Re: PHP like documentation?

2009-02-15 Thread Jaap van Wingerde
Pavan Mishra wrote: I was wondering if I can use python documentation source (reStructuredText) and restructure it along the lines of PHP documentation. Allowing users to add comments, improving search etc. I was thinking if it would be useful. Very good idea! -- Jaap van Wingerde e-mail:

Re: Python interface to ODF documents?

2009-02-15 Thread Krishnakant
hello look at python-ooolib it can do what ever is needed and more. happy hacking. Krishnakant. On Sun, 2009-02-15 at 21:10 +0100, Tino Wildenhain wrote: Hi, Dotan Cohen wrote: Is there a Python interface to ODF documents? I'm thinking of something that will import, for example, an ADS

Re: BaseHttpServer

2009-02-15 Thread Pierre Quentel
On 15 fév, 18:31, Paul pauljeffer...@gmail.com wrote: Hi, I currently have a webserver using BaseHttpServe that serves images like this: if self.path.endswith(.jpg):                 print(curdir + sep + self.path)                 f = open(curdir + sep + self.path,b)                

Re: Byte type?

2009-02-15 Thread Steve Holden
John Nagle wrote: Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle na...@animats.com wrote: Benjamin Peterson wrote: Because b'x' is NOT a bytearray. It is a bytes object. When you actually use a bytearray, it behaves like you expect. type(b'x') class 'bytes'

error while importing os

2009-02-15 Thread karan
Hi, Iam new to python i see the following when iam in the python shell and i try to import os,though i can import the sys and sys.path does contain the path to the python binary or the folder where the python binaries reside: Traceback (most recent call last): File stdin, line 1, in ? File

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread python
Tim, Just for the info, Malcolm, you don't actually need to assign the result of float (input) to anything if you don't need to use it. All you're looking for is the exception. Let the intepreter convert it and then throw it away. Yes! Also, as an alternative style which can be more

Re: BaseHttpServer

2009-02-15 Thread Steve Holden
Paul wrote: Hi, I currently have a webserver using BaseHttpServe that serves images like this: if self.path.endswith(.jpg): print(curdir + sep + self.path) f = open(curdir + sep + self.path,b) self.send_response(200)

Re: Cannot able to retreive compressed html URL

2009-02-15 Thread rushik
On Feb 15, 11:56 am, rushik rushik.upadh...@gmail.com wrote: Hi, I am trying to build python script which retreives and analyze the various URLs and generate reports. Some of the urls are like http://xyz.com/test.html.gz;, I am trying to retreive it using urllib2 library and then using gzip

Re: error while importing os

2009-02-15 Thread Jason Scheirer
On Feb 15, 12:38 pm, karan konte...@gmail.com wrote: Hi, Iam new to python i see the following when iam in the python shell and i try to import os,though i can import the sys and sys.path does contain the path to the python binary or the folder where the python binaries reside: Traceback

Module to read/write MIDI ?

2009-02-15 Thread Peter Billam
Greetings, I speak as a newbie, in the sense that I've been programming Perl45 for fifteen years, but am checking out Python3 as an alternative to Perl6. So far I've translated one of my cpan modules into Python3 http://www.pjb.com.au/comp/free/TermClui.py

Re: PHP like documentation?

2009-02-15 Thread J. Clifford Dyer
On Sun, 2009-02-15 at 09:54 -0800, Pavan Mishra wrote: I was wondering if I can use python documentation source (reStructuredText) and restructure it along the lines of PHP documentation. Allowing users to add comments, improving search etc. I was thinking if it would be useful. --

documentation link for python 3.0.1 on python.org is broken

2009-02-15 Thread Brendan Miller
Like the title says. -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHttpServer

2009-02-15 Thread Paul
On Feb 15, 8:46 pm, Steve Holden st...@holdenweb.com wrote: Paul wrote: Hi, I currently have a webserver using BaseHttpServe that serves images like this: if self.path.endswith(.jpg):                 print(curdir + sep + self.path)                 f = open(curdir + sep + self.path,b)

Re: Python is slow?

2009-02-15 Thread José Matos
On Monday 06 October 2008 00:01:50 Lawrence D'Oliveiro wrote: Not listed as one http://www.fsf.org/licensing/licenses/index_html/view?searchterm=license. Look further http://directory.fsf.org/project/gnuplot/ -- José Abílio -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP like documentation?

2009-02-15 Thread Terry Reedy
Pavan Mishra wrote: I was wondering if I can use python documentation source (reStructuredText) and restructure it along the lines of PHP documentation. Allowing users to add comments, improving search etc. I presume the docs that are part of the distribution are covered by the rather liberal

Re: documentation link for python 3.0.1 on python.org is broken

2009-02-15 Thread Terry Reedy
Brendan Miller wrote: Like the title says. but on which page? in any case, inform webmas...@python.org of specific site problems -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interface to ODF documents?

2009-02-15 Thread Terry Reedy
Dotan Cohen wrote: Is there a Python interface to ODF documents? I'm thinking of something that will import, for example, an ADS spreadsheet into a multidimensional array (including formulas and formatting) and let me manipulate it, then save it back. odf2py, probably among others. --

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Mel
Christian Heimes wrote: Roy Smith wrote: They make sense when you need to recover from any error that may occur, possibly as the last resort after catching and dealing with more specific exceptions. In an unattended embedded system (think Mars Rover), the top-level code might well be:

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Scott David Daniels
pyt...@bdurham.com wrote: Thanks for everyone's feedback def isnumber( input ): try: num = float( input ) return True except ValueError: return False Pretty good, but what about 0x23? def isnumber( input ): try: num = float(input)

illegal list name

2009-02-15 Thread Sandra Quiles
Hello. I have followed the instructions of a post on Installing mailman on OS X 10.4, and got to step 7 and hit this error. The hard- and software involved is: OS X 10.4.x, Python 2.3.5, Mailman 2.1.5 (using this outdated version because I don't know how to upgrade Python despite going

Above and beyond, A critique request

2009-02-15 Thread Vincent Davis
So I am new to python and not much of a programmer. Mostly program using statistical packages. I been working on a project to simulate the medical residency match for about 2 weeks. I don't know any python programmers so I would greatly appreciate any comment or suggestions you may have to improve

Re: illegal list name

2009-02-15 Thread Vincent Davis
You probably have got 2.6 installed you just need to tell terminal to use 2.6, there should be a shell command inside the 2.6 folder that updates the terminal to use 2.6 otherwise you start python by referring directly to the python you need to use. Sorry I have no advise on mailman. Thanks

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Philip Semanchuk
On Feb 15, 2009, at 1:27 PM, Christian Heimes wrote: Philip Semanchuk schrieb: On Feb 15, 2009, at 12:46 PM, pyt...@bdurham.com wrote: What's the Pythonic way to determine if a string is a number? By number I mean a valid integer or float. try: int(number) is_an_int = True except:

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread John Machin
On Feb 16, 7:05 am, pyt...@bdurham.com wrote: Thanks for everyone's feedback. I believe my original post's code (updated following my signature) was in line with this list's feedback. Christian: Thanks for reminding me about exponential formats. My updated code accounts for these type of

Display a list using PyQt

2009-02-15 Thread member Basu
I'm writing an application with PyQt as the GUI toolkit. I have a function that returns a simple list and I would like to update a List View widget with it. However I can't get it to work. I'm not sure if I need to subclass one of the Model classes, because it is just a list. Can someone point me

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Roy Smith
In article gnaak5$1ne...@services.telesweet.net, Mel mwil...@the-wire.com wrote: Christian Heimes wrote: Roy Smith wrote: They make sense when you need to recover from any error that may occur, possibly as the last resort after catching and dealing with more specific exceptions. In an

testing xml against xpather with firefox

2009-02-15 Thread bruce
hi... got a short test against a website, and i'm using xpath (libxml2dom) in order to extract the data. in order to create the xpath function/query, i display the page in firefox, and use DOM/Xpather to get the xpath. i'm then attempting to implement the xpath in my test python script. my issue

Re: RELEASED Python 3.0.1

2009-02-15 Thread Ned Deily
In article ec96e1390902132046k75fbaa12h7c54ab0f8f346...@mail.gmail.com, Benjamin Kaplan benjamin.kap...@case.edu wrote: Any chance of getting a Mac installer for this one? BTW, I see the a link to the OS X installer has now been added to the 3.0.1 release page:

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Grant Edwards
On 2009-02-15, John Nagle na...@animats.com wrote: Linux support for nonstandard baud rates is possible, but needs a call to setserial, Or use of a non-POSIX ioctl() call. which is not standard POSIX. True -- there is no way to do non-standard baud rates using just POSIX calls. -- Grant

Pythonic way to determine if one char of many in a string

2009-02-15 Thread python
I need to test strings to determine if one of a list of chars is in the string. A simple example would be to test strings to determine if they have a vowel (aeiouAEIOU) present. I was hopeful that there was a built-in method that operated similar to startswith where I could pass a tuple of chars

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread python
Scott, Pretty good, but what about 0x23? snipped num = int(input, 0) # Convert to int, base spec in arg Very nice! I wasn't familiar with the use of 0 as a radix value. A quick visit back to the documentation and I'm an enlightened man :) Thanks for your feedback, Malcolm --

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread python
John, Do you care about numbers that are representable as an int, but are treated as inf by float()? For example: | s = '1' * 310 | float(s) | inf | a = int(s) | # OK My code range checks all numbers once they've been parsed, so I don't believe this will be a problem for me.

Re: Pythonic way to determine if one char of many in a string

2009-02-15 Thread python
Nicolas, I would go for something like: for char in word: if char in 'aeiouAEIUO': char_found = True break else: char_found = False It is clear (imo), and it is seems to be the intended idiom for a search loop, that short-circuits as soon as a match is found.

Re: Pythonic way to determine if one char of many in a string

2009-02-15 Thread Nicolas Dandrimont
* pyt...@bdurham.com pyt...@bdurham.com [2009-02-16 00:17:37 -0500]: I need to test strings to determine if one of a list of chars is in the string. A simple example would be to test strings to determine if they have a vowel (aeiouAEIOU) present. I was hopeful that there was a built-in method

Re: Pythonic way to determine if one char of many in a string

2009-02-15 Thread Chris Rebert
On Sun, Feb 15, 2009 at 9:17 PM, pyt...@bdurham.com wrote: I need to test strings to determine if one of a list of chars is in the string. A simple example would be to test strings to determine if they have a vowel (aeiouAEIOU) present. I was hopeful that there was a built-in method that

Re: Turning a signature-changing decorator into a signature-preserving one

2009-02-15 Thread Michele Simionato
On Feb 14, 3:27 pm, Michele Simionato michele.simion...@gmail.com wrote: I should probably raise a clearer error message. Ok, I have uploaded version 3.0.1 of the decorator module, which raises a more meaningful message in case you try to decorate a method incorrectly. I have also added a

Found a very nice, small, cross-platform GUI toolkit for Python.

2009-02-15 Thread laplacian42
I think I just found the GUI toolkit for Python I've been searching for. It seems to meet all of the following requirements: * free software * small (I don't need batteries -- Python already comes with those.) * easy to use * actively maintained * cross-platform * easy to install *

ANN: SuPy 1.4

2009-02-15 Thread Greg Ewing
SuPy 1.4 Available -- http://www.cosc.canterbury.ac.nz/greg.ewing/SuPy/ Changes in this version: - Python tuples are converted to Ruby arrays, so you can pass them directly to Sketchup methods that require an array. - 'Array' function for converting other Python sequences

Re: Match items in large list

2009-02-15 Thread Fisherking
Thank you all for your answers! I must say I'm really impressed by the willing to help and the quick responses in this group (since it is my first post)! I solved the problem using SQL-queries. I added a id, the same for each item in a chain (two or more similar posts) and just updated the

hist without plotting

2009-02-15 Thread Nick Matzke
Hi, Is there a way to run the numpy hist function or something similar and get the outputs (bins, bar heights) without actually producing the plot on the screen? (R has a plot = false option, something like this is what I'm looking for...) Cheers! Nick --

Re: hist without plotting

2009-02-15 Thread Tino Wildenhain
Nick Matzke wrote: Hi, Is there a way to run the numpy hist function or something similar and get the outputs (bins, bar heights) without actually producing the plot on the screen? (R has a plot = false option, something like this is what I'm looking for...) something like

Re: Pythonic way to determine if a string is a number

2009-02-15 Thread Python Nutter
Type casting seems to be the wrong way to go about this. teststring = '15719' teststring.isdigit() returns True That takes care of integers. from string import digits digits '0123456789' now you have all the digits and you can do set testing in your logic to see if the teststring has anything

Re: illegal list name

2009-02-15 Thread Tim Roberts
Sandra Quiles sandr...@silverica.com wrote: Hello. I have followed the instructions of a post on Installing mailman on OS X 10.4, and got to step 7 and hit this error. The hard- and software involved is: OS X 10.4.x, Python 2.3.5, Mailman 2.1.5 (using this outdated version because I don't

  1   2   3   >