Re: hist without plotting

2009-02-15 Thread Nick Matzke
Nevermind, I was running the pylab hist; the numpy.histogram function generates the bar counts etc. without plotting the histogram. Cheers! Nick 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

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

2009-02-15 Thread odeits
On Feb 15, 9:56 pm, Chris Rebert wrote: > On Sun, Feb 15, 2009 at 9:17 PM,   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

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

2009-02-15 Thread Python Nutter
Had a look and it is still under my radar unfortunately because of TkInter. OceanGUI has a lot of large decencies (Pygame, SDL libraries, PyObjC, etc.) to install on my system to just to get a GUI thats no better loking than TkInter which comes pre-installed (no dependencies) on most every major pl

Changing the Image on a button

2009-02-15 Thread odeits
I want to be able to toggle if the button has an image or text. For some reason the following code gets the button to have an image but when i push the button i expect the image to go away but it does not. Am I missing something? from Tkinter import * def do(): btn.configure(image = None) r

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

2009-02-15 Thread Tino Wildenhain
Roy Smith wrote: In article , Mel 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 unattended embedded system (think Mars Rover)

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

2009-02-15 Thread Tino Wildenhain
Python Nutter wrote: Type casting seems to be the wrong way to go about this. teststring = '15719' teststring.isdigit() returns True Actually its instantiating not type casting and it works by using the type's actual description of the data it accepts. This looks pretty good approach instead o

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

2009-02-15 Thread Python Nutter
silly me, forgot to mention build a set from digits + '.' and use that for testing. Cheers, PN 2009/2/16 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 imp

Re: illegal list name

2009-02-15 Thread Tim Roberts
Sandra Quiles 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 know how to upgrade

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 i

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 scipy.histogram

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

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

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 * b

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 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 discussion of that case in the "c

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, 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 operated similar

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

2009-02-15 Thread Nicolas Dandrimont
* 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 that operated

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

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 p

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

2009-02-15 Thread python
Scott, > Pretty good, but what about 0x23? > > 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 -- http://mail.pytho

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 to

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Grant Edwards
On 2009-02-15, John Nagle 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 -- http://mai

Re: RELEASED Python 3.0.1

2009-02-15 Thread Ned Deily
In article , Benjamin Kaplan 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: It would be great if someone could add OS X links for the 3.0

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: Pythonic way to determine if a string is a number

2009-02-15 Thread Roy Smith
In article , Mel 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 unattended embedded system (think Mars Rove

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 t

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

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

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

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 to

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)

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: 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. -- http://m

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: 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: 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 > . Look further http://directory.fsf.org/project/gnuplot/ -- José Abílio -- http://mail.python.org/mailman/listinfo/python-list

Re: BaseHttpServer

2009-02-15 Thread Paul
On Feb 15, 8:46 pm, Steve Holden 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") > >

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

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 Perl4&5 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 http://www.pjb.com.au/comp/free/tes

Re: error while importing os

2009-02-15 Thread Jason Scheirer
On Feb 15, 12:38 pm, karan 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 (most recent

Re: Cannot able to retreive compressed html URL

2009-02-15 Thread rushik
On Feb 15, 11:56 am, rushik 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 library > trying t

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

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 "", line 1, in ? File "C:\P

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 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') >> > type(bytear

Re: BaseHttpServer

2009-02-15 Thread Pierre Quentel
On 15 fév, 18:31, 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(20

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

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

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 xm

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

2009-02-15 Thread Tim Golden
pyt...@bdurham.com wrote: # 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 to u

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 th

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 o

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

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

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)

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

2009-02-15 Thread Roy Smith
In article , 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) > >i

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

2009-02-15 Thread MRAB
Roy Smith wrote: In article , 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 work even if it's an int. except ValueError: p

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

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 CFLAG

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

2009-02-15 Thread Roy Smith
In article , 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" -- http://mail.python.org/mailman/listinfo/python-list

Re: "Byte" type?

2009-02-15 Thread John Nagle
Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle 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') type(bytearray(b'x')) ba = bytearray(b'abc') ba[0] + ba

Re: "Byte" type?

2009-02-15 Thread John Nagle
Benjamin Kaplan wrote: On Sun, Feb 15, 2009 at 11:57 AM, John Nagle 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') type(bytearray(b'x')) ba = bytearray(b'abc') ba[0] + ba

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 1

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

Re: "Byte" type?

2009-02-15 Thread Mark Tolonen
"John Nagle" wrote in message news:499841bf$0$1624$742ec...@news.sonic.net... Benjamin Peterson wrote: Steve Holden 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

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

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 f

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

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 proof-of-concept

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 wrote: From: Diez B. Roggisch 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 file with extension .py, emacs says "lo

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) self.send_header('Content-

Re: "Byte" type?

2009-02-15 Thread Benjamin Kaplan
On Sun, Feb 15, 2009 at 11:57 AM, John Nagle wrote: > Benjamin Peterson wrote: > >> Steve Holden 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

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

2009-02-15 Thread Nick Craig-Wood
Christian Heimes wrote: > Hrvoje Niksic schrieb: > > "Diez B. Roggisch" 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 > > a

Re: "Byte" type?

2009-02-15 Thread John Nagle
Benjamin Peterson wrote: Steve Holden 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 semantic

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Steve Holden
MRAB wrote: > Roy Smith wrote: >> In article , Grant >> Edwards 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. >> >> Stuff like this h

Re: "Byte" type?

2009-02-15 Thread Steve Holden
Benjamin Peterson wrote: > Steve Holden 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 t

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

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

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread MRAB
Roy Smith wrote: In article , Grant Edwards 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. Stuff like this happens all the time. That's why R

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

2009-02-15 Thread Thomas Heller
Christian Heimes schrieb: > Hrvoje Niksic schrieb: >> "Diez B. Roggisch" 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 >> architec

Re: "Byte" type?

2009-02-15 Thread Benjamin Peterson
Steve Holden 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. -- http://mail.python.org/mailman/list

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Roy Smith
In article , Grant Edwards 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. Stuff like this happens all the time. That's why RFC 2026 requ

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

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

2009-02-15 Thread Diez B. Roggisch
Hrvoje Niksic schrieb: "Diez B. Roggisch" 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 Python is built wi

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 Windo

Re: How to peek inside a decorated function

2009-02-15 Thread Duncan Booth
Steven D'Aprano 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 auto-detect tes

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

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) > ret

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 > Thanks to everyone who responded. The reason I ask is because I've just spent

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: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
"MRAB" wrote: > Grant Edwards wrote: > > On 2009-02-14, John Nagle 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 it. > > > [snip] >

Re: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
"John Nagle" wrote: > 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.) Requesting 2 s

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: How to peek inside a decorated function

2009-02-15 Thread Aaron Brady
On Feb 15, 4:27 am, Hrvoje Niksic wrote: > Steven D'Aprano 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) > >      

Fw: Can Python serial support run at 45.45 baud?

2009-02-15 Thread Hendrik van Rooyen
"Hendrik van Rooyen" 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 - time.sleep(0.022) will

Re: How to peek inside a decorated function

2009-02-15 Thread Hrvoje Niksic
Steven D'Aprano 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 func(*args) > re

  1   2   >