Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Chris
If all you wanted was some grouping of exceptions why not something like... soft_exception_list = [IndexError, TypeError] hard_exception_list = [ZeroDivision] try: do_something() except Exception, e: if e.__class__ in soft_exception_list: handle_soft_exception() elif e.__class

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> | The various free tools differ by their chosen optimization paths and > | their degree of specialization. My preference would be, > | > | 1. Doesn't really matter how long it takes to compute the N numbers per > image > > Your problem here is that there is really no such thing as 'general > feat

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread Mensanator
On Mar 10, 10:44�pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Why does my compiler say invalid syntax and then highlight the > quotation marks in the following code: > > # This program is to find primes. Needs work. ## Do you want to calculate primes? 1 = yes and 2 = no. 1 ## What number do yo

Re: parsing directory for certain filetypes

2008-03-10 Thread royG
On Mar 10, 8:03 pm, Tim Chase wrote: > In Python2.5 (or 2.4 if you implement the any() function, ripped > from the docs[1]), this could be rewritten to be a little more > flexible...something like this (untested): > that was quite a good lesson for a beginner like me.. thanks guys in the versio

Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Frank Millman
Gilles Ganault wrote: > On Mon, 10 Mar 2008 11:27:06 -0400, "Malcolm Greene" > <[EMAIL PROTECTED]> wrote: > >Any suggestions on an alternative Python client-side GUI library (pyQT > >?) or tips on where I can find out more about wxPython/wxWidget > >problems? > > One thing that bothers me is that

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread Wubbulous
I may have your problem: if prime < 0: primes.append(x) else: print x, "is not prime. " # highlights the final " you have to separate each output with a comma, so try adding one after x. -- http://mail.python.org/mailman

python "import" of statically linked module with SWIG

2008-03-10 Thread samsappleton
Hi I compiled a SWIG wrapper & linked it with a main program in C (i'm extending the main program/C with a python interpreter). How can I "import" the swig wrapper module in Python? If I just use "import ", of course I get ImportError: no module named I don't want to expose any .so files i

Re: is operator

2008-03-10 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | What is the notion of equal defined for functions? Isness. The developers did not see sufficient reason to refine it further by comparing all the attributes, including the code object. But there has just been a discussion on pydev

python interactive - threaded console (run -i)

2008-03-10 Thread castironpi
#interactive run -i import threading import Queue import functools class GenThread( threading.Thread, Queue.Queue ): _taskid= 0 def __init__( self, *ar, **kw ): threading.Thread.__init__( self, *ar, **kw ) Queue.Queue.__init__( self ) self.setDaemon( True ) s

Re: image matching algorithms

2008-03-10 Thread Terry Reedy
"Daniel Fetchinson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | The various free tools differ by their chosen optimization paths and | their degree of specialization. My preference would be, | | 1. Doesn't really matter how long it takes to compute the N numbers per image Your

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread 7stud
On Mar 10, 9:44 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Why does my compiler say invalid syntax and then highlight the > quotation marks in the following code: > > # This program is to find primes. > primes = [] > import math > import gmpy > while 1: >     run = int(raw_input("Do you want to

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread 7stud
On Mar 10, 9:44 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Why does my compiler say invalid syntax and then highlight the > quotation marks in the following code: > > # This program is to find primes. > primes = [] > import math > import gmpy > while 1: >     run = int(raw_input("Do you want to

Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread Nathan Pinno
Why does my compiler say invalid syntax and then highlight the quotation marks in the following code: # This program is to find primes. primes = [] import math import gmpy while 1: run = int(raw_input("Do you want to calculate primes? 1 = yes and 2 = no. ")) if run == 1: y = int(ra

Re: for-else

2008-03-10 Thread Terry Reedy
"Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Just to play Devil's advocate, there is one draw drawback to "such | elegance": when there are multiple break statements. Which means | you'd have to duplicate the break-only condition, or refactor somehow | (which may or

Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Gilles Ganault
On Mon, 10 Mar 2008 11:27:06 -0400, "Malcolm Greene" <[EMAIL PROTECTED]> wrote: >Any suggestions on an alternative Python client-side GUI library (pyQT >?) or tips on where I can find out more about wxPython/wxWidget >problems? One thing that bothers me is that it seems like there's no ecosystem a

Re: for-else

2008-03-10 Thread Terry Reedy
"rockingred" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Mar 8, 4:15 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > If the sense of else were reversed, one would have to write the clumbsier > > complete = True # though false at this point > while loop_condition: > > if break_c

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Benjamin
On Mar 10, 2:11 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Malcolm Greene wrote: > >> My personal experience with wxPython has its ups and downs. Specifically > >> when it comes to crashes, I wouldn't bet my life on it. > > > I'm new to Python and getting ready to build a small client based > >

Re: TextWrapper keepking line breaks?

2008-03-10 Thread Arnaud Delobelle
On Mar 10, 11:31 pm, js <[EMAIL PROTECTED]> wrote: > Hi list, > > Can I make TextWrapper keep line breaks in the text? > > For example, > > >>> s = "spam\nham" > >>> print wrap(s) > > spam > ham > > As far as I can tell, there seems no way to do this, > but before writing my own solution, I want to

Re: How to factor using Python?

2008-03-10 Thread Mensanator
On Mar 10, 6:32 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > On Mar 10, 12:10 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > > > > On Mar 10, 12:48 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > > On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > > > > How do I factor a numb

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> >>> There are a number of free tools for image matching but it's not very > >>> easy to decipher the actual algorithm from the code that includes db > >>> management, GUI, etc, etc. I have my own image database and GUI so all > >>> I need is the actual algorithm preferably in pseudo code and not

Re: image matching algorithms

2008-03-10 Thread Shane Geiger
Daniel Fetchinson wrote: >>> There are a number of free tools for image matching but it's not very >>> easy to decipher the actual algorithm from the code that includes db >>> management, GUI, etc, etc. I have my own image database and GUI so all >>> I need is the actual algorithm preferably in pse

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread kperkins257
On Mar 10, 3:33 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 10, 2:11 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > > > Malcolm Greene wrote: > > >> My personal experience with wxPython has its ups and downs. Specifically > > >> when it comes to crashes, I wouldn't bet my life on it.

Re: image matching algorithms

2008-03-10 Thread Yu-Xi Lim
Daniel Fetchinson wrote: > Thanks for the info! SIFT really looks like a heavy weight solution, > but do you think the whole concept can be simplified if all I needed > was: given a photo, find similar ones? I mean SIFT first detects > objects on the image and find similarities, but I don't need t

Re: How to factor using Python?

2008-03-10 Thread Nathan Pinno
On Mar 10, 12:10 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Mar 10, 12:48 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > > On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > > > How do I factor a number? > > If factoring is actually what you want, the sympy module can do it. >

TextWrapper keepking line breaks?

2008-03-10 Thread js
Hi list, Can I make TextWrapper keep line breaks in the text? For example, >>> s = "spam\nham" >>> print wrap(s) spam ham As far as I can tell, there seems no way to do this, but before writing my own solution, I want to know whether the solution already exists or not. Thanks. -- http://mail.

python-list@python.org

2008-03-10 Thread Jason
Eric von Horst wrote: > Hi, > > I need some advice on Drag&Drop. > > What I want to achieve is the following: > - I have a window that is divided in two : on the left hand I > have a wx.TreeCtlr and on the other hand a wx.StaticBitmap > > I want to be able to drag an item from the tree o

Re: Python Sockets Help

2008-03-10 Thread Joe Riopel
On Mon, Mar 10, 2008 at 6:58 PM, Mark M Manning <[EMAIL PROTECTED]> wrote: > I need your expertise with a sockets question. > > Let me preface this by saying I don't have much experience with > sockets in general so this question may be simple. I would suggest taking a quick look at this tutori

Re: image matching algorithms

2008-03-10 Thread Daniel Fetchinson
> > There are a number of free tools for image matching but it's not very > > easy to decipher the actual algorithm from the code that includes db > > management, GUI, etc, etc. I have my own image database and GUI so all > > I need is the actual algorithm preferably in pseudo code and not in > > t

Python Sockets Help

2008-03-10 Thread Mark M Manning
I need your expertise with a sockets question. Let me preface this by saying I don't have much experience with sockets in general so this question may be simple. I am playing with the mini dns server from a script I found online: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491264/inde

python-list@python.org

2008-03-10 Thread Stef Mientki
Eric von Horst wrote: > Hi, > > I need some advice on Drag&Drop. > > What I want to achieve is the following: > - I have a window that is divided in two : on the left hand I > have a wx.TreeCtlr and on the other hand a wx.StaticBitmap > > I want to be able to drag an item from the tree ont

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread dave_mikesell
On Mar 10, 2:21 pm, Bob Martin <[EMAIL PROTECTED]> wrote: > > Java is more portable than most other languages, especially if your app needs > a gui. The promise of Java portability was one of the biggest scams ever perpetrated on the software industry. There are issues going from OS to OS, VM t

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > On Mar 9, 2:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Is this soft-exception implemented anywhere, so that one can see what >> experiences and best practices have evolved around using it? > > Lie's idea is to separate exceptions in two groups, those that

Re: building arbitrary files with distutils?

2008-03-10 Thread Martin v. Löwis
> How can I add such commands (including timestamp checking) to a setup.py > file, > so that it runs when I call 'python setup.py build' ? I can write python > functions to perform those command, and I found timestamp checking functions > in distutils.dep_util, but just can't find the way to co

Re: List as FIFO in for loop

2008-03-10 Thread Arnaud Delobelle
On Mar 8, 2:43 pm, malkarouri <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I have an algorithm in which I need to use a loop over a queue on > which I push values within the loop, sort of: > > while not(q.empty()): >     x = q.get() >     #process x to get zero or more y's >     #for each y: >    

Re: any chance regular expressions are cached?

2008-03-10 Thread Arnaud Delobelle
On Mar 10, 3:39 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: [...] > Having said that, at least four out of the five examples you give are > good examples of when you SHOULDN'T use regexes. > > re.sub(r'\n','\n'+spaces,s) > > is better written as s.replace('\n', '\n'+spaces). D

Re: Problem with zipfile and newlines

2008-03-10 Thread John Machin
On Mar 10, 11:14 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Neil Crighton" <[EMAIL PROTECTED]> wrote: > > I'm using the zipfile library to read a zip file in Windows, and it > > seems to be adding too many newlines to extracted files. I've found > > that for extracted text-encoded files, removi

Re: execute python script question

2008-03-10 Thread Sam
Hello, I may misunderstand your problem, but it may be related to the execution environment, especially the PYTHONPATH variable. Have a look at the following log: [EMAIL PROTECTED]:/$ pwd / [EMAIL PROTECTED]:/$ cat -n /tmp/test_import.py 1 class A(object): 2 def __init__(self):

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Diez B. Roggisch
> > Java is more portable than most other languages, especially if your app needs > a gui. Depending on what GUI you want, python is at least as portable - Tkinter is available for lots of platforms. And swing as a GUI plain sucks - there is a reason for SWT. But that needs to be installed se

Re: image matching algorithms

2008-03-10 Thread Yu-Xi Lim
Daniel Fetchinson wrote: > There are a number of free tools for image matching but it's not very > easy to decipher the actual algorithm from the code that includes db > management, GUI, etc, etc. I have my own image database and GUI so all > I need is the actual algorithm preferably in pseudo code

python-list@python.org

2008-03-10 Thread Mike Driscoll
On Mar 10, 4:04 pm, Eric von Horst <[EMAIL PROTECTED]> wrote: > Hi, > > I need some advice on Drag&Drop. > > What I want to achieve is the following: > - I have a window that is divided in two : on the left hand I > have a wx.TreeCtlr and on the other hand a wx.StaticBitmap > > I want to b

Re: Converting a string to the most probable type

2008-03-10 Thread John Machin
On Mar 11, 3:19 am, [EMAIL PROTECTED] wrote: > The trick in the case of when you do not want to guess, or the choices > grow too much, is to ask the user to tell you in what format they want > it and format according to their wishes. > > Neatly avoids too much guessing and isn't much extra to add.

Re: Converting a string to the most probable type

2008-03-10 Thread John Machin
On Mar 11, 2:24 am, rockingred <[EMAIL PROTECTED]> wrote: > > In the case where dots are used as a date separator, count the number > of dots (you should also count commas). If a single comma appears and > is preceeded by only numbers or numbers with decimals, assume "foreign > float". Bt. 1,

python-list@python.org

2008-03-10 Thread Eric von Horst
Hi, I need some advice on Drag&Drop. What I want to achieve is the following: - I have a window that is divided in two : on the left hand I have a wx.TreeCtlr and on the other hand a wx.StaticBitmap I want to be able to drag an item from the tree onto the static bitmap. I know how to d

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Carl Banks
On Mar 9, 7:41 pm, Roopan <[EMAIL PROTECTED]> wrote: > Hello! > > I am looking at developing an enterprise-grade distributed data > sharing application - key requirements are productivity and platform > portability. > > Will it be sensible to use C++ for performance-critical sections and > Python f

Re: any chance regular expressions are cached?

2008-03-10 Thread John Machin
On Mar 10, 3:42 pm, John Machin <[EMAIL PROTECTED]> wrote rather baroquely: > ...>>> def myfunc(s, spaces): > > ... return '\n'.join(spaces + x.rstrip() if x.rstrip() else '' for > x in s.splitlines()) Better: ... return '\n'.join((spaces + x).rstrip() for x in s.splitlines()) -- http://

Re: Keep a python script running after browser window closed

2008-03-10 Thread [EMAIL PROTECTED]
On Mar 10, 1:42 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > On Mar 7, 4:33 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > > > > > On Mar 7, 10:28 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I have a cgi script that performs a very long computation that can > > > take several

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Stefan Behnel
Bob Martin wrote: > Java is more portable than most other languages, especially if your app needs > a gui. I don't think anything is more portable for an App GUI than HTML through a built-in web server. That said, does gcj compile GUI Apps by now? Or does that not count as "portable"? Stefan -

building arbitrary files with distutils?

2008-03-10 Thread Wilbert Berendsen
Hi all, I want to convert a python project from Makefiles to distutils. Currently the makefiles perform some tasks like building a PNG icon from a SVN file etc. How can I add such commands (including timestamp checking) to a setup.py file, so that it runs when I call 'python setup.py build' ? I

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Mike Driscoll
On Mar 10, 2:11 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Malcolm Greene wrote: > >> My personal experience with wxPython has its ups and downs. Specifically > >> when it comes to crashes, I wouldn't bet my life on it. > > > I'm new to Python and getting ready to build a small client based > >

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Stef Mientki
Stefan Behnel wrote: > Malcolm Greene wrote: > >>> My personal experience with wxPython has its ups and downs. Specifically >>> when it comes to crashes, I wouldn't bet my life on it. >>> >> I'm new to Python and getting ready to build a small client based >> application intended to run

Re: Distributed App - C++ with Python for Portability?

2008-03-10 Thread Bob Martin
in 337513 20080310 115744 "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Roopan wrote: > >> Hello! >> >> I am looking at developing an enterprise-grade distributed data >> sharing application - key requirements are productivity and platform >> p

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Diez B. Roggisch
> The problem with callbacks is that it works only for a small amount of > callbacks, it'd be too messy to have twenty different callbacks. > And the ultimate problem with callbacks is that we can't determine > from the outside whether the operation should continue or breaks at > the point of the c

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Stefan Behnel
Duncan Booth wrote: > Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Duncan Booth wrote: >>> I would start by ensuring that any DLLs you write are written using >>> Pyrex or Cython: almost always problems with C libraries called from >>> Python are due to faulty reference counting but if you keep all

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread [EMAIL PROTECTED]
On Mar 9, 2:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Is this soft-exception implemented anywhere, so that one can see what > experiences and best practices have evolved around using it? Lie's idea is to separate exceptions in two groups, those that must be handled and those that don'

Re: wxPython/wxWidgets ok for production use ?

2008-03-10 Thread Stefan Behnel
Malcolm Greene wrote: >> My personal experience with wxPython has its ups and downs. Specifically >> when it comes to crashes, I wouldn't bet my life on it. > > I'm new to Python and getting ready to build a small client based > application intended to run on Windows and Linux. I was planning on

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Duncan Booth
Stefan Behnel <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: >> I would start by ensuring that any DLLs you write are written using >> Pyrex or Cython: almost always problems with C libraries called from >> Python are due to faulty reference counting but if you keep all of >> your Python related

Re: BitVector

2008-03-10 Thread Ross Ridge
DanielJohnson <[EMAIL PROTECTED]> wrote: >I am trying to solve a genetic algorithm problem where I want to read >a bitvector of very large size (say 1) and manipulate bits based >on certain algorithms. > >I am a newbie in Python. What data structure are good to read such >huge data set. Are th

SV: Adjust a canvas as the window is resized

2008-03-10 Thread K Viltersten
>> Do i need to set a callback to a canvas >> in order to "listen" to the root window >> being resized in order to make it adjust >> its contents? >> >> If so, how? If not, how do i make the >> canvas draw a line from one corner to >> an other? > > import Tkinter as tk > > root = tk.Tk() > canva

Re: What c.l.py's opinions about Soft Exception?

2008-03-10 Thread Lie
On Mar 10, 12:12 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Sat, 08 Mar 2008 22:24:36 -0800, Kay Schluehr wrote: > > >> On 9 Mrz., 06:30, Steven D'Aprano <[EMAIL PROTECTED] > >> cybersource.com.au> wrote: > >> Is it really so exotic that it requires the demand for mor

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Mike Driscoll
> > > is there a newsgroup explicitly for python windows extensions? > > Not that I know of, other than what's described here: > > https://sourceforge.net/mail/?group_id=78018 > > -tkc There is a PyWin32 user's group: http://mail.python.org/mailman/listinfo/python-win32 The maintainer of the pr

Re: How to factor using Python?

2008-03-10 Thread Mensanator
On Mar 10, 12:48 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > On 10 mar, 02:08, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > > How do I factor a number? If factoring is actually what you want, the sympy module can do it. >>> n = 85085**3 >>> print n 615969217989125 >>> import sympy >>> f = s

Re: BitVector

2008-03-10 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes: > Bitwise operations like & | ^ << >> etc work on long integers. This > happens at C speed. The problem is if you want to set a bit, you have to allocate a whole new long integer. -- http://mail.python.org/mailman/listinfo/python-list

Re: any chance regular expressions are cached?

2008-03-10 Thread mh
John Machin <[EMAIL PROTECTED]> wrote: > Yes they will be cached. great. > But do yourself a favour and check out the > string methods. Nifty... thanks all! -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list

execute python script question

2008-03-10 Thread Gabriel Rossetti
Hello, I have been developping something in python that has the following hierarchy : project/src/myPackage/ project/src/myPackage/__init__.py project/src/myPackage/module1.py project/src/myPackage/module2.py project/src/myPackage/test/ project/src/myPackage/test/__init__.py project/src/myPackag

Re: __iter__ yield

2008-03-10 Thread Boris Borcic
Paul Hankin wrote: > On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: >> >> >> >>> On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: Someone knows if it's possible to make this __iter__ function with just one 'yie

Re: Keep a python script running after browser window closed

2008-03-10 Thread sophie_newbie
On Mar 7, 4:33 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 10:28 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a cgi script that performs a very long computation that can > > take several hours to complete. Is there any smart way that I can keep > > this script ru

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Simon Brunning
On Mon, Mar 10, 2008 at 5:20 PM, davidj411 <[EMAIL PROTECTED]> wrote: > why does this occur when using the python windows extensions? There's nothing Windows specific about this - it just means that you have unicode strings. See , -- Cheers, Simon B. [

Re: lowercase u before string in "python for windows"

2008-03-10 Thread Tim Chase
> why does this occur when using the python windows extensions? all > string are prefixed by a lowercase "u". They are Unicode strings: http://docs.python.org/ref/strings.html > is there a newsgroup explicitly for python windows extensions? Not that I know of, other than what's described here:

lowercase u before string in "python for windows"

2008-03-10 Thread davidj411
why does this occur when using the python windows extensions? all string are prefixed by a lowercase "u". is there a newsgroup explicitly for python windows extensions? example of output below. SMBIOSBIOSVersion:u'A16' SMBIOSMajorVersion:2 SMBIOSMinorVersion:3 SMBIOSPresent:True SoftwareElementID

Re: is operator

2008-03-10 Thread castironpi
On Mar 10, 11:36 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 10 Mar 2008 07:39:25 -0700, Gary Herron wrote: > > If either is a surprise, then understand that the "is" operator should > > probably *never* be used with immutable types. > > Mutable or immutable, it make

Re: error/warning color customization in interactive console?

2008-03-10 Thread yhvh
I've just discovered ipython - An Enhanced Interactive Python, which among other things colorizes output including error codes -- http://mail.python.org/mailman/listinfo/python-list

Re: tcp client socket bind problem

2008-03-10 Thread castironpi
On Mar 10, 9:40 am, Marc Christiansen <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I have a linux box with multiple ip addresses. I want to make my > > python client connect from one of the ip addresses. Here is my code, > > no matter what valid information I put in the bind it always

Re: for-else

2008-03-10 Thread castironpi
> > The idea of the if-else is: > > . depending on some condition either do this or do something else, > > . don't do them both. > > constructs, I asked myself whether the application of a different idea > resulted in a consistent, sensible interpretation. They could just as easily have defined

Re: Checking if a variable is a dictionary

2008-03-10 Thread Steven D'Aprano
On Mon, 10 Mar 2008 14:29:48 +, Andrew Koenig wrote: > So the question you need to answer is whether you want to determine > whether an object is exactly of type dict, or whether it you are willing > to accept types derived from dict also. Or other mappings that don't inherit from dict but be

Re: is operator

2008-03-10 Thread Steven D'Aprano
On Mon, 10 Mar 2008 07:39:25 -0700, Gary Herron wrote: > If either is a surprise, then understand that the "is" operator should > probably *never* be used with immutable types. Carl Banks has already mentioned testing for None with "is". The standard idiom for using mutable default arguments goe

Re: Regarding coding style

2008-03-10 Thread [EMAIL PROTECTED]
On Mar 10, 11:30 am, rockingred <[EMAIL PROTECTED]> wrote: > On Mar 10, 10:26 am, Roel Schroeven <[EMAIL PROTECTED]> > wrote: > > > > > rockingred schreef: > > > > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > > >> //Copyright (C) 2008 Foobar Computer Consulting > > >> // > > >> //

Re: Converting a string to the most probable type

2008-03-10 Thread cokofreedom
The trick in the case of when you do not want to guess, or the choices grow too much, is to ask the user to tell you in what format they want it and format according to their wishes. Neatly avoids too much guessing and isn't much extra to add. -- http://mail.python.org/mailman/listinfo/python-lis

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Gerard Flanagan
On Mar 10, 4:39 pm, Sam <[EMAIL PROTECTED]> wrote: > Hello > > I would like to implement some kind of comparator, that could be > called as instance method, or static method. Here is a trivial pseudo > code of what I would like to execute > > >> class MyClass: > > ...def __init__(self, value):

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Sam
> Did you try that it doesn't work? because it should. Whenever you do > No... -_- I kept on trying things @staticmethod. Thanks for your hint, it works fine! Sam -- http://mail.python.org/mailman/listinfo/python-list

Obtaining the PyObject * of a class

2008-03-10 Thread Cooper, Andrew
I',m currently using SWIG to generate a python interface to a C DLL. I'm new to the Python C API and have a question that has been stumping me for the last week. As part of the wrapper process I want to hide some of the complexity with dealing with handles using a python class. But the problem I

BitVector read-from-file Question

2008-03-10 Thread Michael Wieher
I'm trying to read in data from large binary files using BitVector (thanks btw, for whoever mentioned it on the list, its nice) I'll be reading the data in as requested by the user, in (relatively) small chunks as needed. Problem is I can't read the whole file in at once (its ridiculously large)

Re: for-else

2008-03-10 Thread Jeffrey Barish
egbert wrote: > The idea of the if-else is: > .  depending on some condition either do this or do something else, > .  don't do them both. Indubitably, this statement is correct for other programming languages. I was initially surprised by loop-else when learning Python because I approached thes

Re: defining a method that could be used as instance or static method

2008-03-10 Thread Diez B. Roggisch
Sam wrote: > Hello > > I would like to implement some kind of comparator, that could be > called as instance method, or static method. Here is a trivial pseudo > code of what I would like to execute > >>> class MyClass: > ...def __init__(self, value): > ...self.value = value > ...

defining a method that could be used as instance or static method

2008-03-10 Thread Sam
Hello I would like to implement some kind of comparator, that could be called as instance method, or static method. Here is a trivial pseudo code of what I would like to execute >> class MyClass: ...def __init__(self, value): ...self.value = value ...def comp(self, compValue): ...

Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Mike Driscoll
On Mar 10, 10:27 am, "Malcolm Greene" <[EMAIL PROTECTED]> wrote: > Stefan, > > > My personal experience with wxPython has its ups and downs. Specifically > > when it comes to crashes, I wouldn't bet my life on it. (but then, the OP > > I'm new to Python and getting ready to build a small client ba

Re: Regarding coding style

2008-03-10 Thread rockingred
On Mar 10, 10:26 am, Roel Schroeven <[EMAIL PROTECTED]> wrote: > rockingred schreef: > > > > > > > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > >> //    Copyright (C) 2008 Foobar Computer Consulting > >> // > >> //    VERSION   PROJECT#     DATE     DESCRIPTION > >> //    ---   --

Re: float / rounding question

2008-03-10 Thread Piet van Oostrum
> Dennis Lee Bieber <[EMAIL PROTECTED]> (DLB) wrote: >DLB> On Fri, 07 Mar 2008 23:12:27 +0100, Piet van Oostrum <[EMAIL PROTECTED]> >DLB> declaimed the following in comp.lang.python: >>> Sorry to come in so late in this discussion. Although it is correct to say >>> that many real numbers tha

Re: Regarding coding style

2008-03-10 Thread Roel Schroeven
rockingred schreef: > On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: >> //Copyright (C) 2008 Foobar Computer Consulting >> // >> //VERSION PROJECT# DATE DESCRIPTION >> //--- -- >> // 1.00 12345601/04/08 Origi

Re: is operator

2008-03-10 Thread Carl Banks
On Mar 10, 10:39 am, Gary Herron <[EMAIL PROTECTED]> wrote: > Metal Zong wrote: > > > The operator is and is not test for object identity: x is y is true if > > and only if x and y are the same objects. > > > >>> x = 1 > > > >>> y = 1 > > > >>> x is y > > > True > > > Is this right? Why? Thanks. >

wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-10 Thread Malcolm Greene
Stefan, > My personal experience with wxPython has its ups and downs. Specifically when > it comes to crashes, I wouldn't bet my life on it. (but then, the OP I'm new to Python and getting ready to build a small client based application intended to run on Windows and Linux. I was planning on usi

Re: Converting a string to the most probable type

2008-03-10 Thread rockingred
On Mar 7, 6:12 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Mar 8, 1:53 am, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > > On Mar 6, 9:17 pm, Luis M. González <[EMAIL PROTECTED]> wrote: > > > > On 6 mar, 11:27, Pierre Quentel <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I w

Re: Regarding coding style

2008-03-10 Thread rockingred
On Mar 8, 8:27 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > //    Copyright (C) 2008 Foobar Computer Consulting > // > //    VERSION   PROJECT#     DATE     DESCRIPTION > //    ---       -- > //      1.00     123456    01/04/08   Original creation. > // > > Elev

Re: Python-URL! - weekly Python news and links (Feb 18)

2008-03-10 Thread Fuzzyman
On Mar 10, 2:33 pm, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > > Peter Otten <[EMAIL PROTECTED]> (PO) wrote: > >PO> Piet van Oostrum wrote: > "Gabriel Genellina" <[EMAIL PROTECTED]> (GG) wrote: > > >GG> "Given this indispensable process and architecture issue, isn't it > obviou

Re: tcp client socket bind problem

2008-03-10 Thread Marc Christiansen
[EMAIL PROTECTED] wrote: > I have a linux box with multiple ip addresses. I want to make my > python client connect from one of the ip addresses. Here is my code, > no matter what valid information I put in the bind it always comes > from the default ip address on the server. Am I doing something w

Re: Quality assurance in Python projects containing C modules

2008-03-10 Thread Stefan Behnel
Duncan Booth wrote: > [EMAIL PROTECTED] wrote: >> We are thinking about writing a project for several customers in >> Python. This project would include (among others) wxPython, a C/C++ >> module. But what happens if this application generates a segmentation >> fault on a customers PC. What changes

Re: List as FIFO in for loop

2008-03-10 Thread rockingred
On Mar 8, 5:37 pm, malkarouri <[EMAIL PROTECTED]> wrote: > On Mar 8, 6:24 pm, rockingred <[EMAIL PROTECTED]> wrote: > > > I think it's a bad practice to get into.  Did you intend to do the > > "process" step again over the added variables?  If not I would set a > > new variable, based on your awful

Re: parsing directory for certain filetypes

2008-03-10 Thread Robert Bossy
jay graves wrote: > On Mar 10, 9:28 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > >> Personally, I'd use glob.glob: >> >> import os.path >> import glob >> >> def parsefolder(folder): >> path = os.path.normpath(os.path.join(folder, '*.py')) >> lst = [ fn for fn in glob.glob(path) ] >>

Re: parsing directory for certain filetypes

2008-03-10 Thread Tim Chase
> i wrote a function to parse a given directory and make a sorted list > of files with .txt,.doc extensions .it works,but i want to know if it > is too bloated..can this be rewritten in more efficient manner? > > here it is... > > from string import split > from os.path import isdir,join,normpat

Re: parsing directory for certain filetypes

2008-03-10 Thread jay graves
On Mar 10, 9:28 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > Personally, I'd use glob.glob: > > import os.path > import glob > > def parsefolder(folder): > path = os.path.normpath(os.path.join(folder, '*.py')) > lst = [ fn for fn in glob.glob(path) ] > lst.sort() > return lst > Wh

Re: parsing directory for certain filetypes

2008-03-10 Thread sam
Robert Bossy napisał(a): > I leave you the exercice to add .doc files. But I must say (whoever's > listening) that I was a bit disappointed that glob('*.{txt,doc}') didn't > work. "{" and "}" are bash invention and not POSIX standard unfortunately -- UFO Occupation www.totalizm.org -- http:/

  1   2   >