Re: Seeking assistance - string processing.

2006-11-14 Thread John Machin
[EMAIL PROTECTED] wrote: > Thanks Fredrik, Peter and John for your help. > > John, I especially enjoyed your line by line assasination of my code, > keep it up. > > I'm not a programmer, I dislike programming, I'm bad at it. I just > agreed to do this to help someone out, I didn't even know what p

Re: Unpacking sequences and keywords in one function call

2006-11-14 Thread OKB (not okblacke)
Dennis Lee Bieber wrote: > On Tue, 14 Nov 2006 05:45:57 GMT, "OKB (not okblacke)" > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> >> I was just wondering about this yesterday. Is there a >> reason you >> can only unpack a sequence at the END of t

Looking for a way to stop execution of script, in the script

2006-11-14 Thread Josh Bloom
Hi everyone, I'm looking for a way to stop execution of a script from within the script. I'm familiar with this idiom:While 1:  doFirstThing()  doSecondThing()  if something:    break  doThirdThing()   breakBut that seems a little kludgy to me with extra breaks involved. Is there a way to do someth

Re: Looking for a way to stop execution of script, in the script

2006-11-14 Thread Fredrik Lundh
Josh Bloom wrote: > Hi everyone, I'm looking for a way to stop execution of a script from > within the script. > > I'm familiar with this idiom: > > While 1: > doFirstThing() > doSecondThing() > if something: > break > doThirdThing() > break I'm not. why are you using a while st

Re: Looking for a way to stop execution of script, in the script

2006-11-14 Thread Josh Bloom
Thanks Fredrik, yeah the while loop for single run is pretty stupid. sys.exit() thats the call I was looking for. -JoshOn 11/14/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: Josh Bloom wrote:> Hi everyone, I'm looking for a way to stop execution of a script from> within the script.>> I'm familiar w

Re: Is python for me?

2006-11-14 Thread [EMAIL PROTECTED]
By large I mean an application with intensive operations, such as a fancy GUI maybe a couple of threads, accessing a database, etc. lennart wrote: > [EMAIL PROTECTED] schreef: > > > As stated above python is capable of all those things, however on > > larger applications like that it can tend to s

How to check for instances of a class

2006-11-14 Thread erokar
Traversing a list of variables, I need to check wheter an element in the list is an instance of a (user defined) class. What cind of comparison operator can I use? Can't seem to find this in the documentation. I anyone have an example it is much appreciated. -- http://mail.python.org/mailman/list

Re: How to check for instances of a class

2006-11-14 Thread Dennis Benzinger
On 14 Nov 2006 11:00:53 -0800 [EMAIL PROTECTED] wrote: > Traversing a list of variables, I need to check wheter an element in > the list is an instance of a (user defined) class. What cind of > comparison operator can I use? Can't seem to find this in the > documentation. I anyone have an example

Re: How to check for instances of a class

2006-11-14 Thread Gabriel Genellina
At Tuesday 14/11/2006 16:00, [EMAIL PROTECTED] wrote: Traversing a list of variables, I need to check wheter an element in the list is an instance of a (user defined) class. What cind of comparison operator can I use? Can't seem to find this in the documentation. I anyone have an example it is m

Re: Python development time is faster.

2006-11-14 Thread Jordan
Just a little something I realized after writing the same program in C++ and python (a simple chat client and server, with one on one and chat room capabilities). I used wxwidgets and wxpython respectively for the GUIs, and they weren't extremely elaborate, just some basic functionality, a few fra

Re: How to check for instances of a class

2006-11-14 Thread erokar
That did the trick, thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
At Tuesday 14/11/2006 13:41, [EMAIL PROTECTED] wrote: > When the rich comparison methods raise NotImplementedError, the > comparison logic inside the interpreter tries reversing the operands. Can you point me to a description of this algorithm? It doesn't seem to be described in the documentat

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
At Tuesday 14/11/2006 09:33, Fredrik Lundh wrote: GeneralizedTime() > datetime.now() > Traceback (most recent call last): > File "", line 1, in ? > TypeError: can't compare datetime.datetime to GeneralizedTime > > Clearly I'm misunderstanding something, here. As I understand my code, > I'

Re: Is python for me?

2006-11-14 Thread Tim Chase
> By large I mean an application with intensive operations, such > as a fancy GUI maybe a couple of threads, accessing a > database, etc. I can't say I've had any python related problems on such matters. I've done some modestly large-sized apps, and the bottlenecks are almost always I/O bound...

Python v PHP: fair comparison?

2006-11-14 Thread walterbyrd
I don't know if this is a fair comparison or not. Any comments appreciated. - Python is more readable, and more general purpose - PHP has awful backward compatibility - PHP has a lower barrier to entry - Most inexpensive web-hosters support PHP, but not Python - PHP has far more pre-writen scripts

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>> I confess I find myself in the position of a Yorkshire Youngster - > I >>> don't believe you! > >Robert> Okay, not often enough or annoyingly enough for me to remember >Robert> having done so. Perhaps seven years ag

Re: Tkinter: Strange behavior using place() and changing cursors

2006-11-14 Thread Wojciech Muła
Mudcat wrote: > I have also determined that this is not a problem if the button is not > packed inside the frame. So somehow the interaction of the internal > button is causing this problem. Problem is really strange, and seems to be a Tk issue, not Tkinter. I've observed that if method configure

multi split function taking delimiter list

2006-11-14 Thread [EMAIL PROTECTED]
Hi, I'm looking for something like: multi_split( 'a:=b+c' , [':=','+'] ) returning: ['a', ':=', 'b', '+', 'c'] whats the python way to achieve this, preferably without regexp? Thanks. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob | datetime question

2006-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 4:22 pm, "Demel, Jeff" <[EMAIL PROTECTED]> wrote: > I'm having trouble finding exactly what I need by googling, so thought > I'd try to get a quick answer from the group. This seems like something > that should be dead simple. > > I need to generate a string value of a date in the for

Re: multi split function taking delimiter list

2006-11-14 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? I think regexps are likely the right way to do this kind of tokenization. The s

Re: multi split function taking delimiter list

2006-11-14 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? I think in this case the regexp approach is the simplest, though: >>> def mu

Re: multi split function taking delimiter list

2006-11-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? What do you have against regexp? re.split() does exactly what you want: In [1

Re: Python v PHP: fair comparison?

2006-11-14 Thread Bjoern Schliessmann
walterbyrd wrote: > - PHP has a lower barrier to entry Which kind of barrier do you mean -- syntax, availability, ...? Also from what I know of PHP, language and API seem more unstable and inhomogenous. CMIIW. Regards, Björn -- BOFH excuse #219: Recursivity. Call back if it happens again.

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Stephen Eilert
Carl Banks escreveu: > Steve Holden wrote: > > In fact most Python doesn't use such constructs, though I'll admit the > > occasional __init__ is more or less inevitable once you start using the > > object-oriented features more than casually. > > Occasional? I don't know about you, but I use __i

BaseHTTPServer - getting POST parameters

2006-11-14 Thread Vlad Dogaru
Hello, After experimenting for a while, I am still not able to find where the POST data is in the BaseHTTPRequestHandler class. I am trying to write a very simple HTTP server for a project of mine and I need to get the POST data. Certainly I am missing something, as it is a comon task. Thanks in

Re: wxpython - wxtoolbar font size

2006-11-14 Thread Frank Niessink
Ghido: Hi all i want to set wx.toolbar font size and i use this code: self.tb1 = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL| wx.TB_TEXT) self.tb1.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL,0)) self.SetToolBar(self.tb1) but i obtain nothing. Is possibile? where

Re: BaseHTTPServer - getting POST parameters

2006-11-14 Thread Paul Boddie
Vlad Dogaru wrote: > > After experimenting for a while, I am still not able to find where the > POST data is in the BaseHTTPRequestHandler class. I am trying to write > a very simple HTTP server for a project of mine and I need to get the > POST data. Certainly I am missing something, as it is a co

PyWin32-winxptheme and py2exe

2006-11-14 Thread Andrea Gavana
Hi all, I am having some troubles mixing py2exe and winxptheme. Basically, I am using wxPython 2.7.2.0 with Python 2.5, and painting some window background using the UxTheme via winxptheme. This is what I am doing: hwnd = MyWindow.GetHandle() self.hTheme = winxptheme.OpenThemeData(hwnd, "Windo

Re: BaseHTTPServer - getting POST parameters

2006-11-14 Thread Fredrik Lundh
Vlad Dogaru wrote: > After experimenting for a while, I am still not able to find where the > POST data is in the BaseHTTPRequestHandler class. I am trying to write > a very simple HTTP server for a project of mine and I need to get the > POST data. Certainly I am missing something, as it is a com

Re: refactoring so that multiple changes can be made with one variable?

2006-11-14 Thread John Salerno
Paddy wrote: > You could keep a handle on all object instances created then go through > the objects making appropriate changes, e.g: > > > class Character(object): > instances = [] > def __init__(self, name, strength, dexterity, intelligence): > instances.append(self) >

mark lutz interview?

2006-11-14 Thread John Salerno
Does anyone know where I might find the Mark Lutz interview from TechTalk? Their website still doesn't have it yet. I didn't know if it was available elsewhere. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? > > Thanks. > > Martin I resisted my urge to use a regexp and came up with this:

Re: Character Encodings and display of strings

2006-11-14 Thread Martin Miller
It is possible derive your own string class from the built-in one and override what 'repr' does (and make it do whatever you want). Here's an example of what I mean: # Sample # # -*- coding: iso-8859-1 -*- # Special string class to override the default # representation method. Main purpo

Re: how to create a multicolor "font-string" in pygame??

2006-11-14 Thread Iacopo . Marmo
> Of course you can just create an equally dimensioned image for each > character and each color (cached or not, however you like it), and just > blit these one after another, offsetting them with the character width. > > Diez thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python v PHP: fair comparison?

2006-11-14 Thread Larry Bates
walterbyrd wrote: > I don't know if this is a fair comparison or not. Any comments > appreciated. > > - Python is more readable, and more general purpose > - PHP has awful backward compatibility > - PHP has a lower barrier to entry > - Most inexpensive web-hosters support PHP, but not Python > - P

Re: __cmp__ between dissimilar objects

2006-11-14 Thread [EMAIL PROTECTED]
> >Can you point me to a description of this algorithm? It doesn't seem > >to be described in the documentation for the rich comparison or __cmp__ > >methods... > > PEP 207 > http://www.python.org/dev/peps/pep-0207/ So since I implemented __cmp__ instead of the rich comparison operators, Python f

Re: Python v PHP: fair comparison?

2006-11-14 Thread martdi
> I'd be surprised if there was more demand for PHP developers > than Python developers. Google lists 51 PHP jobs and 168 > Python jobs in their internal jobs database (I just did a > quick search). Yes, but Google is the company that hired Guido, and that does most of it's dev in python. Looki

Re: Python v PHP: fair comparison?

2006-11-14 Thread Olexandr Melnyk
2006/11/15, Larry Bates <[EMAIL PROTECTED]>:> For the most part you wouldn't ever thing about writing data> conversion programs, GUI applications, Windows services, COM+ objects, > Linux daemons, simple scripts, socket server/client applications,> etc. in PHP (but all can be done in Python).  Web a

Re: multi split function taking delimiter list

2006-11-14 Thread Sam Pointon
On Nov 14, 7:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? pyparsing

Re: __cmp__ between dissimilar objects

2006-11-14 Thread Gabriel Genellina
At Tuesday 14/11/2006 19:27, [EMAIL PROTECTED] wrote: > >Can you point me to a description of this algorithm? It doesn't seem > >to be described in the documentation for the rich comparison or __cmp__ > >methods... > > PEP 207 > http://www.python.org/dev/peps/pep-0207/ So since I implemented _

Re: refactoring so that multiple changes can be made with one variable?

2006-11-14 Thread James Stroud
John Salerno wrote: > My code is below. For now I'm focusing on the lines where health (and > armor) are increased in each character class. Let's say I decided to > change the amount of increase in the future. As it is now, I'd have to > go to each character class and change the number so that e

Re: jython's future

2006-11-14 Thread Ed Jensen
??ukasz Langa <[EMAIL PROTECTED]> wrote: > Java was at 1.2 (and compiling Hello World took over 5 minutes) Bullshit. Complete and utter bullshit. -- http://mail.python.org/mailman/listinfo/python-list

Re: jython's future

2006-11-14 Thread Gabriel Genellina
At Tuesday 14/11/2006 21:56, Ed Jensen wrote: ??ukasz Langa <[EMAIL PROTECTED]> wrote: > Java was at 1.2 (and compiling Hello World took over 5 minutes) Bullshit. Complete and utter bullshit. That's the plain truth. Python 1.5.2 final release is of 13 April 1999

Re: Python v PHP: fair comparison?

2006-11-14 Thread Luis M. González
> - Python is more readable, and more general purpose Yes, php is only for web. On the other hand, Python is a general purpose language and it can be used for nearly anything you may want to do. > - PHP has awful backward compatibility Yes. And it's also an ugly language to work with. > - PHP

Re: reduce to be removed?

2006-11-14 Thread Dustan
George Sakkis wrote: > Dustan wrote: > > > Alright, I can see I'm a bit outvoted here. I tried your suggestions > > and it worked fine. > > > > I'll also try to consider in the future that part of the problem might > > be lack of information conveyed on my part. > > If you insist on one-liners, it

Re: Tkinter: Strange behavior using place() and changing cursors

2006-11-14 Thread John McMonagle
Mudcat wrote: > Is there something I'm supposed to do in order > to prevent this from happening? Yes. Instead of configuring the cursor on the frame, do it on the master: self.master.configure(cursor='sb_h_double_arrow') -- This message has been scanned for viruses and dangerous content by

Re: reduce to be removed?

2006-11-14 Thread Robert Kern
Dustan wrote: > 2. While I haven't taken a good look at NumPy, my intuition tells me it > won't work with complex data types, which wouldn't work for me at all. > > Am I correct on that second one? No. numpy can make arrays of Python objects in addition to arrays of double, unsigned int, etc. -

Re: Python development time is faster.

2006-11-14 Thread Éric Daigneault
"Chris Brat" <[EMAIL PROTECTED]> writes: > I've seen a few posts, columns and articles which state that one of the > advantages of Python is that code can be developed x times faster than > languages such as <>. > > Does anyone have any comments on that statement from personal > experience? Wel

RE: Python development time is faster.

2006-11-14 Thread Delaney, Timothy (Tim)
Éric Daigneault wrote: > This being said after a bit of experience in programming, design > patterns and other marvels of the modern brains, doing bad code in > python requires a conscious effort to do. The bright side is that it > gives all the justification to reviewers to smack the offend

Re: Python v PHP: fair comparison?

2006-11-14 Thread Michael Torrie
On Tue, 2006-11-14 at 18:55 -0800, Luis M. González wrote: > > > - Python is more readable, and more general purpose > > Yes, php is only for web. Absolutely false. Most of my standalone, command-line scripts for manipulating my unix users in LDAP are written in PHP, although we're rewriting th

Re: Python v PHP: fair comparison?

2006-11-14 Thread Luis M. González
>> Yes, php is only for web. > > Absolutely false. Most of my standalone, command-line scripts for > manipulating my unix users in LDAP are written in PHP, although we're > rewriting them in python. > > Although I can't think of a single app written in php that's not web- > based (other than stand

Re: Python speed on Solaris 10

2006-11-14 Thread casevh
Chris Miles wrote: > I have found that the sunfreeware.com build of Python 2.4.3 for Solaris > 10 is faster than one I can build myself, on the same system. > sunfreeware.com doesn't bother showing the options they used to > configure and build the software, so does anyone know what the optimal >

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Hendrik van Rooyen
"Dan Lenski" <[EMAIL PROTECTED]> wrote: > I think part of learning to think like a computer is learning to stop > associating computer logic too strongly with the natural language > meanings of "and", "or", and "not". This is true - and you have left out "but" - Hendrik -- http://mail.p

reading csv problem

2006-11-14 Thread [EMAIL PROTECTED]
Hello, I use csv to take information from file. import csv reader = csv.reader(open('t.csv')) for row in reader: print row # it is perfectly OK - But If I use this code I have problem import csv reader = csv.reader(open('t.c

Re: reading csv problem

2006-11-14 Thread Cameron Walsh
[EMAIL PROTECTED] wrote: > Hello, > > I use csv to take information from file. > import csv > reader = csv.reader(open('t.csv')) > > for row in reader: > print row # it is perfectly OK > > - > But If I use this code I have p

Re: Python v PHP: fair comparison?

2006-11-14 Thread Hendrik van Rooyen
Olexandr Melnyk wrote: > PHP has a lower barrier to entry I don't think so. Python has more intuitive syntax for beginners and is one of the best choices for the first programming language to pick up. I second this - before discovering Python (in a GSM module's guts) - I was being steered in t

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
Paddy wrote: > [EMAIL PROTECTED] wrote: > > > Hi, I'm looking for something like: > > > > multi_split( 'a:=b+c' , [':=','+'] ) > > > > returning: > > ['a', ':=', 'b', '+', 'c'] > > > > whats the python way to achieve this, preferably without regexp? > > > > Thanks. > > > > Martin > > I resisted m

Re: wxpython - wxtoolbar font size

2006-11-14 Thread Ghido
Thanks for your reply but i can't change the font of 'New' label. but it is a linux problem or is a wxpython problem? Ghido -- http://mail.python.org/mailman/listinfo/python-list

Re: refactoring so that multiple changes can be made with one variable?

2006-11-14 Thread Paddy
John Salerno wrote: > Paddy wrote: > > > You could keep a handle on all object instances created then go through > > the objects making appropriate changes, e.g: > > > > > > class Character(object): > > instances = [] > > def __init__(self, name, strength, dexterity, intelligence): > >

Re: Py3K idea: why not drop the colon?

2006-11-14 Thread Steven D'Aprano
On Tue, 14 Nov 2006 12:01:05 +, Antoon Pardon wrote: > On 2006-11-13, Ben Finney <[EMAIL PROTECTED]> wrote: >> Michael Hobbs <[EMAIL PROTECTED]> writes: >> >>> To be clear, this is the actual thrust of my argument. It seems >>> redundant to have *both* line continuations and colons in compound

Re: reduce to be removed?

2006-11-14 Thread Antoon Pardon
On 2006-11-15, Robert Kern <[EMAIL PROTECTED]> wrote: > Dustan wrote: > >> 2. While I haven't taken a good look at NumPy, my intuition tells me it >> won't work with complex data types, which wouldn't work for me at all. >> >> Am I correct on that second one? > > No. numpy can make arrays of Pytho

<    1   2