Re: newbie question - exception processing

2005-02-20 Thread M.E.Farmer
[EMAIL PROTECTED] wrote: > O/S: Windows XP Service Pack 2 > Python version: 2.4 > > Unable to understand how to build a class to handle an exception. > > Contents of sample01.py: > import exceptions > class SampleMain: > try: > def __init__(self): > print 'in SampleMain cons

Re: newbie question - exception processing

2005-02-20 Thread John Machin
[EMAIL PROTECTED] wrote: > O/S: Windows XP Service Pack 2 > Python version: 2.4 > > Unable to understand how to build a class to handle an exception. > > Contents of sample01.py: > import exceptions > class SampleMain: > try: > def __init__(self): > print 'in SampleMain con

recommended way of generating HTML from Python

2005-02-20 Thread Michele Simionato
What is the recommended way of generating HTML from Python? I know of HTMLGen and of few recipes in the Cookbook, but is there something which is more or less standard? Also, are there plans to include a module for HTML generation in the standard library? I really would like to see some standardiza

[perl-python] exercise: partition a list by equivalence

2005-02-20 Thread Xah Lee
when i try to run the following program, Python complains about some global name frozenset is not defined. Is set some new facility in Python 2.4? ©# from Reinhold Birkenfeld ©def merge(pairings): ©sets = {} ©for x1, x2 in pairings: ©newset = (sets.get(x1, frozenset([x1])) ©

Re: recommended way of generating HTML from Python

2005-02-20 Thread Jarek Zgoda
Michele Simionato napisał(a): What is the recommended way of generating HTML from Python? I know of HTMLGen and of few recipes in the Cookbook, but is there something which is more or less standard? Also, are there plans to include a module for HTML generation in the standard library? I really woul

PyQt Python Bindings for Qt v3.14 Released

2005-02-20 Thread Phil Thompson
Riverbank Computing is pleased to announce the release of PyQt v3.14 available from http://www.riverbankcomputing.co.uk/. Changes since the last release include support for QScintilla v1.5. PyQt is a comprehensive set of Qt bindings for the Python programming language and supports the same plat

Re: recommended way of generating HTML from Python

2005-02-20 Thread Michele Simionato
Just to clarify, before people start pointing out their preferred templating language: I am NOT asking for a template system. I am asking for something on the lines of HTMLGen, where you just use pure Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-20 Thread Paul Boddie
Mike Meyer <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Arich Chanachai <[EMAIL PROTECTED]> writes: > > > When the CLR is integrated, it will allow a wide array of problem > > solving choices for uuu users. > > You've missed the point. Allowing a wide array of problem solvin

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread "Martin v. Löwis"
Ilias Lazaridis wrote: Should a professional developer take python serious? Yes. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode encoding usablilty problem

2005-02-20 Thread "Martin v. Löwis"
Thomas Heller wrote: Is it possible to specify a byte string literal when running with the -U option? Not literally. However, you can specify things like bytes = [0x47, 0x49, 0x4f, 0x50, 0x01, 0x00] bytes = ''.join((chr(x) for x in bytes)) Alternatively, you could rely on the 1:1 feature of Latin-1

Re: unicode encoding usablilty problem

2005-02-20 Thread "Martin v. Löwis"
aurora wrote: Lots of errors. Amount them are gzip (binary?!) and strftime?? For gzip, this is not surprising. It contains things like self.fileobj.write('\037\213') which is not intended to denote characters. How about b'' - 8bit string; '' unicode string and no automatic conversion. This has

Re: exercise: partition a list by equivalence

2005-02-20 Thread John Machin
Xah Lee wrote: > when i try to run the following program, Python complains about some > global name frozenset is not defined. Is set some new facility in > Python 2.4? http://www.python.org/doc/2.3/whatsnew/ http://www.python.org/doc/2.4/whatsnew/whatsnew24.html You must be running 2.3. If you p

Real-Time Fluid Dynamics for Games...

2005-02-20 Thread Alberto Santini
I ported a Jos Stam's demo about Fluid mech to check the difference of speed between C implementation and Python. I think I achieved good results with Python and there is space to improve, without to extend the program with C routine, I mean. -- Good hack, Alberto Santini (http://www.albertosanti

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
A.B., Khalid wrote: [...] - (comments) I've just overflown your comments for a few seconds. And I got my confirmations. Thank you for your time. -- pyMinGW: http://jove.prohosting.com/iwave/ipython/pyMinGW.html . -- http://lazaridis.com -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Fredrik Lundh wrote: Ilias Lazaridis wrote: Should a professional developer take python serious? yes. Should I take answers serious? Answer from people which do not respect coherence of writings? " Should a professional developer take python serious? I mean, if the team does not manage at least the

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Martin v. Löwis wrote: Ilias Lazaridis wrote: Should a professional developer take python serious? Yes. Should I take answers serious? Answer from people which do not respect coherence of writings? " Should a professional developer take python serious? I mean, if the team does not manage at least t

Re: exercise: partition a list by equivalence

2005-02-20 Thread bearophileHUGS
John Machin: >Perhaps I'm missing a posting of yours -- what are merge2 and merge4? What is "this random pairs test"? What is xMax (nPairs isn't hard to guess), and how are you generating your input data?< merge2 and this random pairs test comes from the post by Brian Beck. merge4 is the first in

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Fredrik Lundh
Ilias Lazaridis wrote: > Should a professional developer take python serious? yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: exercise: partition a list by equivalence

2005-02-20 Thread Eric Pederson
> From: "Xah Lee" <[EMAIL PROTECTED]> > > The GOTO statement from Perl has been messed up. hey, I didn't do it! > > This block: > Âfor group in interm: what do the funny little "Â"s stand for? Eric Pederson http://www.songzilla.blogspot.com ::: domai

Re: unicode encoding usablilty problem

2005-02-20 Thread Nick Coghlan
Martin v. Löwis wrote: How about b'' - 8bit string; '' unicode string and no automatic conversion. This has been proposed before, see PEP 332. The problem is that people often want byte strings to be mutable as well, so it is still unclear whether it is better to make the b prefix denote the cur

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Fredrik Lundh
Ilias Lazaridis wrote: >>>Should a professional developer take python serious? >> >> yes. > > Should I take answers serious? yes. > Answer from people which do not respect coherence of writings? coherence of writings? -- http://mail.python.org/mailman/listinfo/python-list

Re: exercise: partition a list by equivalence

2005-02-20 Thread John Machin
On 20 Feb 2005 03:31:33 -0800, [EMAIL PROTECTED] wrote: >John Machin: >>FWIW, my offering is attached. < > >I'm sorry, I don't see the attach... (just the different title). > Here it is. I'll reply to the rest tomorrow. It's way past sleep-time here. ! !class _Stopper: !pass ! !def merge_JM

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Robert Kern
Fredrik Lundh wrote: Ilias Lazaridis wrote: Should a professional developer take python serious? yes. Should I take answers serious? yes. Answer from people which do not respect coherence of writings? coherence of writings? Ironic, is it not? I think he's referring to the fact that you snipped

Re: lambda closure question

2005-02-20 Thread Carl Banks
jfj wrote: > Yes, but according to the python philosophy one could pass locals() > to the nested function and grab the values from there. Seems practical > for the rareness of this... First of all, I really don't agree that it's a rare need. I use it pretty often. Second of all, the whole point

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread Michael Hoffman
David M. Cooke wrote: """ The file() constructor is new in Python 2.2 and is an alias for open(). Both spellings are equivalent. The intent is for open() to continue to be preferred for use as a factory function which returns a new file object. The spelling, file is more suited to type testing (for

Re: lambda closure question

2005-02-20 Thread Carl Banks
Carl Banks wrote: > Say you have a suite of functions, all of which are called by some main > function and each other, and all of which need to access a lot of the > same data. The best, most straightforward way to do it is to have the > common data be a local variable of the main function, and n

ANN: eric3 3.6.2 released

2005-02-20 Thread Detlev Offenbach
Hi, this is to inform all of you about the release of eric3 3.6.2. It is a bug fix release and will work with the latest QScintilla/sip/PyQt. It is available via http://www.die-offenbachs.de/detlev/eric3.html What is eric3? -- Eric3 is a Python IDE written using PyQt and QScintilla.

Re: How to wrap a class's methods?

2005-02-20 Thread rbt
Jeff Shannon wrote: You could probably also do this as a factory function, rather than as a class (also untested!): def Wrapper(func): def wrapped(self, *args, **kwargs): s, r = func(self, *args, **kwargs) if s != 'OK': raise NotOK((s,r)) return r retur

Re: [perl-python] exercise: partition a list by equivalence

2005-02-20 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: > My solution (which may not be the fastest or most effective, but till > now is the shortest and it works): > > def merge(pairings): > sets = {} > for x1, x2 in pairings: > newset = (sets.get(x1, frozenset([x1])) > | sets.get(x2, froz

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread "Martin v. Löwis"
Ilias Lazaridis wrote: Should I take answers serious? If not, why are you asking questions in the first place? Answer from people which do not respect coherence of writings? Coherence of writings? Should a professional developer take python serious? Yes. I mean, if the team does not manage at least

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Nick Coghlan
Pat wrote: On Windows, most users are used to installing precompiled binary packages, rather than compiling from source. When you do have to compile from source, it often requires you to fiddle with nitty gritty details about which you'd rather remain ignorant. The less fiddling required, the hap

Re: unicode encoding usablilty problem

2005-02-20 Thread "Martin v. Löwis"
Nick Coghlan wrote: Having "", u"", and r"" be immutable, while b"" was mutable would seem rather inconsistent. Yes. However, this inconsistency might be desirable. It would, of course, mean that the literal cannot be a singleton. Instead, it has to be a display (?), similar to list or dict displ

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread Nick Coghlan
George Sakkis wrote: Still the word "open" sounds too general if the meaning is "open a file-like object"; OTOH this could be a good thing if in some future version "open('http://www.python.org')" was e.g. an alias to urllib2.urlopen. Exactly the reason the BDFL gave for preferring 'open' - it ma

Re: unicode encoding usablilty problem

2005-02-20 Thread Nick Coghlan
Martin v. Löwis wrote: People also argue that with such an approach, we could as well tell users to use array.array for the mutable type. But then, people complain that it doesn't have all the library support that strings have. Indeed - I've got a data manipulating program that I figured I could ma

Re: pyWrath project

2005-02-20 Thread [EMAIL PROTECTED]
As Felix pointed out, of course link should read http://sourceforge.net/projects/pywrath Sorry to everyone who tried to follow crappy link :) -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread François Pinard
[Nick Coghlan] > George Sakkis wrote: > > >Still the word "open" sounds too general if the meaning is "open > >a file-like object"; OTOH this could be a good thing if in some > >future version "open('http://www.python.org')" was e.g. an alias to > >urllib2.urlopen. > Exactly the reason the BDFL g

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Diez B. Roggisch
> If you put yourself into the shoes of someone who decides to use a > Python product that requires compiling, and that product contains C > extensions that also need compiling, you'll see that it doesn't matter > whether or not that individual has actually written a single line of > Python themsel

introspection inquiry

2005-02-20 Thread mirandacascade
Where in the language would one find the intropsection capability to answer the question: what class am I in? Example: class ExistentialCrisis: def __init__(self, text): self.spam = text print 'In the constructor of the %s class' % When the constructor method is invoked, wou

BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Tortelini
I am making custom web server using HTTPServer and want to be able to access it simultaneously from different computers. To achieve multithreading, I have been experimenting with ThreadingMixIn from SocketServer, but it doesn't seem to work, when I freeze code in one instance it seems to be frozen

Re: introspection inquiry

2005-02-20 Thread Robin Becker
[EMAIL PROTECTED] wrote: ... My question is this: what can be substituted for that will make the example above work? self.__class__.__name__ -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread Michael Hoffman
François Pinard wrote: [Nick Coghlan] George Sakkis wrote: Still the word "open" sounds too general if the meaning is "open a file-like object"; OTOH this could be a good thing if in some future version "open('http://www.python.org')" was e.g. an alias to urllib2.urlopen. Exactly the reason the

Re: segfault when calling Python from C thread

2005-02-20 Thread Greg Chapman
Travis Berg wrote: > > I'm running into a problem when trying to perform a callback to a > Python function from a C extension. Specifically, the callback is > being made by a pthread that seems to cause the problem. If I call > the callback from the parent process, it works fine. The PyObject

Re: BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Paul Rubin
"Tortelini" <[EMAIL PROTECTED]> writes: > I am making custom web server using HTTPServer and want to be able to > access it simultaneously from different computers. To achieve > multithreading, I have been experimenting with ThreadingMixIn from > SocketServer, but it doesn't seem to work, One com

Re: segfault when calling Python from C thread

2005-02-20 Thread Fredrik Lundh
Greg Chapman wrote: > Your callback function needs to hold the Python GIL (and have a vaild > threadstate) before it calls any Python C-API functions. Change the > last part of it to: > >PyGILState_STATE state; > >/* ... */ > >/* Time to call the callback */ > >state = PyGILState_

Re: introspection inquiry

2005-02-20 Thread Michael Hoffman
Robin Becker wrote: self.__class__.__name__ Unless I misunderstood the question, that won't work. That will give you the name of the class the object is an instance is of. I think he wants the name of the class the method was defined in. Here's a way to do that using metaclasses and Python's magic

Re: introspection inquiry

2005-02-20 Thread Diez B. Roggisch
> Unless I misunderstood the question, that won't work. That will > give you the name of the class the object is an instance is of. > I think he wants the name of the class the method was defined in. Where is the difference? The method is defined in a class - and an instance is created from that c

Re: introspection inquiry

2005-02-20 Thread John Roth
"Michael Hoffman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Robin Becker wrote: self.__class__.__name__ Unless I misunderstood the question, that won't work. That will give you the name of the class the object is an instance is of. I think he wants the name of the class the metho

Re: introspection inquiry

2005-02-20 Thread Michael Hoffman
Diez B. Roggisch wrote: >[Michael Hoffman]: Unless I misunderstood the question, that won't work. That will give you the name of the class the object is an instance is of. I think he wants the name of the class the method was defined in. Where is the difference? The method is defined in a class - a

Re: introspection inquiry

2005-02-20 Thread Michael Hoffman
John Roth wrote: If that's the case, then the inspect module should give the tools to do it without a great deal of angst. Unfortunately, it doesn't give you the class that defined the method, just the class that invoked it. Are you saying that the inspect module *should* give you the tools to do i

Re: Real-Time Fluid Dynamics for Games...

2005-02-20 Thread bearophileHUGS
Your two email addresses bouce emails back, so I post a shortened version of my comment here. I haven't installed: PyOpenGL-2.0.2.01.py2.4-numpy23 glut-3.7.6 Therefore at the moment I cannot try your interesting code. What's the speed of this Python code on your computer? I'd like to see a screensh

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Martin v. Löwis wrote: Ilias Lazaridis wrote: Should I take answers serious? If not, why are you asking questions in the first place? simply read the next question, which limits the scope of the first one. Answer from people which do not respect coherence of writings? Coherence of writings? An exam

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread BrainDead
[snip, Ilias would not understand it] > P.S. if Ilias volunteers, or offers to pay someone to do this, instead of just > complaining, will hell freeze over?) Nick, There is about as much chance of hell freezing over as there is of England beating Australia in the cricket this summer. [I'am a hal

questions concerning cgi.FieldStorage(keep_blank_values=1)

2005-02-20 Thread Jonas Meurer
hello, i'm quite new to python. currently i try to write a web application with python cgi scripts. in this application, i need keys to be delivered with the url, some with and some without value (for example 'script.py?key1&key2=foo'. i've searched the internet, and already figured out that i n

Re: [Fwd: Re: [Uuu-devel] languages] <-- Why Python

2005-02-20 Thread Ville Vainio
> "Donn" == Donn Cave <[EMAIL PROTECTED]> writes: Donn> I don't know what the Windows version is like, but for all Donn> the UNIX shell's weaknesses, it's very well suited to its Donn> role. The Plan 9 I don't know about that - I don't see anything in shell that couldn't be done

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Jan Dries
Ilias Lazaridis wrote: they above 2 questions are coherent, thus answering isolated [as you've done] makes not much sense. " >> Should I take answers serious? >> Answer from people which do not respect coherence of writings? " Except that the quote here above is NOT what was in your original p

Re: questions concerning cgi.FieldStorage(keep_blank_values=1)

2005-02-20 Thread Daniel Lichtenberger
Hi, Jonas Meurer wrote: > if i request the script with script.py?key1&key2=foo, it will output: > list keys with form.keys(): > key2 > > any suggestions about how to make form.keys() contain the blank keys > as well? "key1" isn't a valid parameter, to supply an empty key you would write script.

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Jan Dries wrote: Ilias Lazaridis wrote: [...] - (things which justify inability of coherence-detection) If you would have written: """ Should I take answers serious? Answer from people which do not respect coherence of writings? """ it would have been much more coherent. I understand. Let's see:

Re: questions concerning cgi.FieldStorage(keep_blank_values=1)

2005-02-20 Thread Jonas Meurer
On 20/02/2005 Daniel Lichtenberger wrote: > > any suggestions about how to make form.keys() contain the blank keys > > as well? > > "key1" isn't a valid parameter, to supply an empty key you would write > script.py?key1=&key2=foo > > Then cgi.FieldStorage also includes key1. great, it works. but

intersection of 2 list of pairs

2005-02-20 Thread les_ander
Hi, I have 2 lists of tuples that look like: E1=[('a','g'),('r','s')] and E2=[('g','a'),('r','q'),('f','h')]. In this tuple, the ordering does not matter, i.e. (u,v) is the same as (v,u). What I want to do is the following: given 2 list of tuples, E1 and E2, I want to create another list with tupl

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Fredrik Lundh
Ilias Lazaridis wrote: > I understand. no. -- http://mail.python.org/mailman/listinfo/python-list

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread "Martin v. Löwis"
Ilias Lazaridis wrote: Should I take answers serious? . . . . Answer from people which do not respect coherence of writings? - - - I still detect the coherence. As most people in this group will detect the coherence. I don't. The second fragment is not even correct English (it does not have a verb

Re: help please

2005-02-20 Thread gargonx
I think there's a problem with the code: py> decode_replacements.update([(std[key], key) for key in std]) py> decode_replacements.update([(ext[key], key) for key in ext]) when i run this i get an error: AttributeError: keys I can't get that figured out -- http://mail.python.org/mailman/list

Re: intersection of 2 list of pairs

2005-02-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I have 2 lists of tuples that look like: > E1=[('a','g'),('r','s')] and > E2=[('g','a'),('r','q'),('f','h')]. > In this tuple, the ordering does not > matter, i.e. (u,v) is the same as (v,u). > > What I want to do is the following: > given 2 list of tuples, E1 and E2, I

Re: lambda closure question

2005-02-20 Thread jfj
Carl Banks wrote: Say you want to calculate a list of points of an iterated fractal. Here's the idea: you have a set of linear transformations. You take the origin (0,0) as the first point, and then apply each transformation in turn to get a new point. You recursively apply each transformation at

Re: introspection inquiry

2005-02-20 Thread Robin Becker
Michael Hoffman wrote: Robin Becker wrote: self.__class__.__name__ Unless I misunderstood the question, that won't work. That will give you the name of the class the object is an instance is of. I think he wants the name of the class the method was defined in. Here's a way to do that using metacla

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Grant Edwards
On 2005-02-20, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: >> If you would have written: >> >> """ >> Should I take answers serious? Answer from people which do not respect >> coherence of writings? >> """ >> >> it would have been much more coherent. > > I understand. I doubt it. > I still det

help wanted: poser to ogre 3d python script

2005-02-20 Thread verizon account
a community of online 3d developers is looking for a python script writer to write a script to export from poser to ogre3d .mesh/.skeleton formats, using the poser python script interpretor. please reply to [EMAIL PROTECTED]thanks!!   -- http://mail.python.org/mailman/listinfo/python-list

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Pat
Nick Coghlan wrote: > Pat wrote: > > On Windows, most users are used to installing precompiled binary > > packages, rather than compiling from source. When you do have to > > compile from source, it often requires you to fiddle with nitty gritty > > details about which you'd rather remain ignorant

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread BrainDead
[Snip] Martin, I believe that you are wasting your time. Looking at your email address, this may well be relevant. http://groups-beta.google.com/group/de.admin.net-abuse.news/browse_frm/thread/8914399857641c05/4163a4fb8a624349?q=Ilias&_done=%2Fgroup%2Fde.admin.net-abuse.news%2Fsearch%3Fgroup%3D

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Martin v. Löwis wrote: Ilias Lazaridis wrote: Should I take answers serious? [...] Answer from people which do not respect coherence of writings? [...] I still detect the coherence. As most people in this group will detect the coherence. I don't. The second fragment is not even correct English [...

Re: intersection of 2 list of pairs

2005-02-20 Thread John Machin
[EMAIL PROTECTED] wrote: > Hi, > I have 2 lists of tuples that look like: > E1=[('a','g'),('r','s')] and > E2=[('g','a'),('r','q'),('f','h')]. > In this tuple, the ordering does not > matter, i.e. (u,v) is the same as (v,u). > > What I want to do is the following: > given 2 list of tuples, E1 and

Re: [ANN] Python 2.4 Quick Reference available

2005-02-20 Thread François Pinard
[Michael Hoffman] > To be honest I doubt open will be extended in this manner. I did not read Guido's arguments for a while, so I may remember them wrongly. So, take me with a grain of salt. I would not think Guido is arguing for the sole sake of arguing. Maybe his plans or visions will change

Re: introspection inquiry

2005-02-20 Thread Michael Hoffman
Robin Becker wrote: import inspect class A: _class_name=inspect.currentframe().f_code.co_name def __init__(self,text,_defining_class_name=_class_name): print 'text=',text,'_defining_class_name=',_defining_class_name class B(A): pass b=B('aaa') That won't work, if you, say, wanted to print

Re: Trouble with mysql-python 1.2.0 on Solaris 8 sparc

2005-02-20 Thread Andy Dustman
Did you build your own MySQL, or did you use a pre-built version? And what version? It's not clear if you're using 4.0 or 4.1. If mysql_config is returning the wrong flags, then that's a bug with MySQL. You should be able to work around this by doing this in setup.py before the call to setup(): e

Re: BaseHTTPServer threading using SocketServer.ThreadingMixIn

2005-02-20 Thread Tortelini
It's not that, here is definition that I use: class myWebServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): pass code that runs server: server = myWebServer(('', 80), myWebHTTPHandler) LOG("Web Server starting") server.serve_forever() and here is shortened version of myWebHTTPHandl

Re: lambda closure question

2005-02-20 Thread Dirk Thierbach
Ted Lilley <[EMAIL PROTECTED]> wrote: > As a side note, I'm familiar with the term currying from a friend who > learned ML and Scheme quite some time ago. Not sure if that's the true > origin, but it was a sufficiently different context from Python (or at > least I thought) that I didn't want to r

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Ilias Lazaridis
Summarized Suggestions for the Python Team, PSF, Community): - - - An automated-build-process-system should allow community-members to add their targets (e.g. MinGW) into an special "incubation section", which does not in any way affect the "main section" (which contains the official production

Re: help please

2005-02-20 Thread Steven Bethard
gargonx wrote: I think there's a problem with the code: py> decode_replacements.update([(std[key], key) for key in std]) py> decode_replacements.update([(ext[key], key) for key in ext]) when i run this i get an error: AttributeError: keys I can't get that figured out Can you show the part of you

Re: How to wrap a class's methods?

2005-02-20 Thread Steven Bethard
rbt wrote: Jeff Shannon wrote: You could probably also do this as a factory function, rather than as a class (also untested!): def Wrapper(func): def wrapped(self, *args, **kwargs): s, r = func(self, *args, **kwargs) if s != 'OK': raise NotOK((s,r)) return

Re: recommended way of generating HTML from Python

2005-02-20 Thread Fernando Perez
Michele Simionato wrote: > What is the recommended way of generating HTML from Python? I know of > HTMLGen and of > few recipes in the Cookbook, but is there something which is more or > less standard? I'm also an htmlgen user, but it's getting a bit long in the tooth, and the installation is not

Re: exercise: partition a list by equivalence

2005-02-20 Thread John Machin
Reinhold Birkenfeld wrote: > Reinhold Birkenfeld wrote: > > > My solution (which may not be the fastest or most effective, but till > > now is the shortest and it works): [snip RB] > > A recursive solution (around twice as fast as the above, though very > slow still...) > [snip RB2] > > Another

Moving to Python from PHP - 3 questions

2005-02-20 Thread Michal Migurski
Hi everyone, I've been planning to move to Python from PHP for some time now. I use PHP extensively for web scripting, with mod_php, Apache, and a DB (I would characterize my knowledge of PHP as advanced). Here are three stumbling blocks I've experienced, for which I couldn't seem to find any h

Re: exercise: partition a list by equivalence

2005-02-20 Thread John Machin
Eric Pederson wrote: > > From: "Xah Lee" <[EMAIL PROTECTED]> > > ©for group in interm: > what do the funny little "©"s stand for? ...>>> import unicodedata as ucd; ucd.name('©'.decode('cp1252')) 'COPYRIGHT SIGN' Xah is asserting his right to be recognised as the author of his artistic creati

Re: recommended way of generating HTML from Python

2005-02-20 Thread Pierre Quentel
Here are a couple of pointers. I agree with Michele that it would be nice to have some kind of standardization. Maybe this would be worth a post to the Web-SIG ? - I posted a 70-line recipe on the Python Cookbook, a sort of poor man's HTMLGen called HTMLTags http://aspn.activestate.com/ASPN/Coo

Re: PyQt Python Bindings for Qt v3.14 Released

2005-02-20 Thread Simon John
All looks like good news, especially PyQt4 - one question, if it's statically linked with Qt4, will it still work with things like py2exe? I guess it just won't need qt-mt4.dll? I'm getting a 404 on the new SIP: http://www.river-bank.demon.co.uk/download/QScintilla/qscintilla-1.61-gpl-1.5.tar.gz

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
Hi, > 2) Session management. Cookie-based sessions in PHP are pretty > transparent, with a small library of basic functions that do 95% of > what anyone may need to store session data in serialized files and > associate them with cookies. I've seen python code that accomplishes > this, but so far

Re: PyQt Python Bindings for Qt v3.14 Released

2005-02-20 Thread Phil Thompson
On Sunday 20 February 2005 8:42 pm, Simon John wrote: > All looks like good news, especially PyQt4 - one question, if it's > statically linked with Qt4, will it still work with things like py2exe? Should do. > I guess it just won't need qt-mt4.dll? The binary will be provided for the Windows GPL

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Michal Migurski
The python-based zope application server has session management. Togther with a built-in user and access rights management. ... This can be done in zope if you name a variable :list. That then will give you the variable as list regardless of the number of occurences. Thank you. My impression of Z

Re: recommended way of generating HTML from Python

2005-02-20 Thread xtian
Stan (part of nevow, which is part of twisted) is a nice python syntax for building HTML - I like the use of () and [] to separate attributes from sub-elements. For example: class Greeter(rend.Page): def greet(self, context, data): return random.choice(["Hello", "Greetings", "Hi"]), "

Article on Hi-Fi Myths

2005-02-20 Thread Al Christians
I learned Friday night that the hi-fi talk is our most popular tape. This page: http://www.belt.demon.co.uk/product/Cable_Controversy/Cable_Controversy.htm Gives a somewhat different take on the controversy, almost certainly bizarre. It's a long page and the interesting part is near the end. The

Bug in email package?

2005-02-20 Thread Roman Suzi
I was playing with email package and discovrered this strange kind of behaviour: import email.Message m = email.Message.Message() m['a'] = '123' print m From nobody Mon Feb 21 00:12:27 2005 a: 123 for i in m: print i ... Traceback (most recent call last): File "", line 1, in ? File "/usr/loc

Re: - E02 - Support for MinGW Open Source Compiler

2005-02-20 Thread Nick Vargish
"BrainDead" <[EMAIL PROTECTED]> writes: > I believe that you are wasting your time. Looking at your email > address, this may well be relevant. [ 4-line URL snipped ] Thanks for the historical reference. Please consider a visit to tinyurl.com before posting a monster like that... :^) Nick --

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
> Thank you. My impression of Zope in the past has been that it does what > I need, along with 10,000 other things I don't (built in WebDAV > server?!), but clearly I owe it another chance. I've been initially The apache has a built in webdav server too - is that a reason _not_ to use it? If you d

Re: [long] nested lists as arrays

2005-02-20 Thread [EMAIL PROTECTED]
great thanks -- http://mail.python.org/mailman/listinfo/python-list

ANNOUNCE: KirbyBase 1.8

2005-02-20 Thread Jamey Cribbs
KirbyBase is a simple, plain-text, database management system written in Python. It can be used either embedded in a python script or in a client/server, multi-user mode. You use python code to express your queries instead of having to use another language such as SQL. KirbyBase is disk-base

Re: Test for structure

2005-02-20 Thread Martin Miller
I don't believe you can use the test for a __iter__ attribute in this case, for the following reason: >>> c1 = 'abc' >>> c2 = ['de', 'fgh', 'ijkl'] >>> hasattr(c1, '__iter__') False >>> hasattr(c2, '__iter__') True >>> for i in c1: print "i=%s is an element of c1" % repr(i) ... i='a' is an element

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Brian Beck
Michal Migurski wrote: Thank you. My impression of Zope in the past has been that it does what I need, along with 10,000 other things I don't (built in WebDAV server?!), but clearly I owe it another chance. I've been initially attracted to mod_python because of its raw simplicity and its apparen

Re: Newbie CGI problem

2005-02-20 Thread Rory Campbell-Lange
On 18/02/05, Peter Otten ([EMAIL PROTECTED]) wrote: > Rory Campbell-Lange wrote: > > > #!/usr/bin/python > > import cgi > > print "Content-type: text/html\n\n" > > print "hi" > > > > Gives me the following in my browser: > > > > ''' > > hi > > Content-type: text/html > > > > > > hi > > ''' > >

Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Brian Beck
Maybe this can help you get it working on OS X: http://thread.gmane.org/gmane.comp.python.mod-python/4039 But as stated in my other post, you may want to take a look at your other options first. Web development with Python is really nothing like PHP, unless you really want it to be. -- Brian Bec

Re: Test for structure

2005-02-20 Thread Steven Bethard
Terry Hancock wrote: > But you probably shouldn't do that. You should probably just test to > see if the object is iterable --- does it have an __iter__ method? > > Which might look like this: > > if hasattr(a, '__iter__'): > print "'a' quacks like a duck" Martin Miller top-posted: I don't beli

  1   2   >