Re: How can i do this in Python?

2007-01-24 Thread NoName
Thanks;) On 25 Янв., 17:47, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Thursday 25/1/2007 01:25, NoName wrote: > > >perl -ane "print join(qq(\t),@F[0,1,20,21,2,10,12,14,11,4,5,6]).qq(\n)"Must > >be done on a single line? > I'm not sure if I've got right the behavior - it's been some time

Re: Python does not play well with others

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 03:39, Dennis Lee Bieber wrote: On Wed, 24 Jan 2007 19:04:39 +0100, egbert <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > On Wed, Jan 24, 2007 at 06:24:37AM +, Harry George wrote: > > > > Perl - excellent modules and bindings for just about everythi

Re: Python does not play well with others

2007-01-24 Thread Stephan Kuhagen
Dennis Lee Bieber wrote: > Uhm... Unless something has happened that I don't know about, isn't > C# a M$ specific product? Mono? Regards Stephan -- http://mail.python.org/mailman/listinfo/python-list

Re: selective logger disable/enable

2007-01-24 Thread Gary Jefferson
So maybe I don't have all this figured out quite as well as I thought. What I really want to do is set an environment variable, MYDEBUG, which contains a list of wildcarded logger names, such as "a.*.c a.d" (which becomes ['a.*.c', 'a.d'], and then selectively crank the loglevel up to DEBUG for tho

Re: Python does not play well with others

2007-01-24 Thread Stephan Kuhagen
Harry George wrote: > Perl - excellent modules and bindings for just about everything you ... > Java - a world of its own. They reinvent the wheel instead of linking ... > PHP - are we talking web scripts or serious programs? Are you doing ... > C - the portable assembler. Solid, trusted, tunab

Fast Imaging for Webserver

2007-01-24 Thread Prateek
Hi. I'm creating a web-application using CherryPy 2.2.1. My application needs to process images (JPG/PNG files) to 1) create thumbnails (resize them) 2) overlay them on a custom background (a simple frame) 3) Overlay 'badges' (small 16x16 images) on top of the final thumbnail I am using PIL 1.1.5

Re: How can i do this in Python?

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 01:25, NoName wrote: perl -ane "print join(qq(\t),@F[0,1,20,21,2,10,12,14,11,4,5,6]).qq(\n)" Must be done on a single line? I'm not sure if I've got right the behavior - it's been some time since I quit writing Perl code. The script iterates over all lines contained on

Re: sys.path issue in cygwin

2007-01-24 Thread Wang Shuhao
This is not a problem of Cygwin itself. The root cause of the problem is that I installed both in Win32 version and Cygwin version on my machine. The PYTHONHOME environment variable in Windows point to c:\python24. After remove this environment variable, the Cygwin version python's sys.path bec

Re: raise UnicodeError, "label too long"

2007-01-24 Thread Martin v. Löwis
Flavio schrieb: > something like this, for instance: > http://.wikipedia.org/wiki/Copper%28II%29_hydroxide > > but even url with any non-ascii characters such as this > > http://.wikipedia.org/wiki/Ammonia > > also fail when passed to urlopen : > File "/usr/lib/python2.4/encodings/idna.py", line

Re: ftplib and retrbinary or retrlines (losing newline characters in my log files)

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 03:05, aus stuff wrote: Hi am successfully downloading my text files and writing them to local files with either ftp.retrlines('RETR ' + fl, fileObj.write)" ftp.retrbinary('RETR ' + fl, fileObj.write) However all

Re: Catching floating point errors from linked C code

2007-01-24 Thread John Nagle
John Pye wrote: > Hi John, > > On Jan 25, 3:43 pm, John Nagle <[EMAIL PROTECTED]> wrote: > >>Python is probably running with floating point exceptions disabled, >>but you can enable them in your C code, and restoring the floating >>point mode when you leave, if you want. This is probably >>only

ftplib and retrbinary or retrlines (losing newline characters in my log files)

2007-01-24 Thread aus stuff
Hi am successfully downloading my text files and writing them to local files with either ftp.retrlines('RETR ' + fl, fileObj.write)" ftp.retrbinary('RETR ' + fl, fileObj.write) However all my recieved (log) files have lost thier newline characters? Can anyone stee

Re: The reliability of python threads

2007-01-24 Thread Klaas
On Jan 24, 5:18 pm, Paul Rubin wrote: > "Klaas" <[EMAIL PROTECTED]> writes: > > CPython is more that "a particular implementation" of python, > It's precisely a particular implementation of Python. Other > implementations include Jython, PyPy, and IronPython. I did not

ctypes: Setting callback functions in C libraries

2007-01-24 Thread [EMAIL PROTECTED]
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out how to set values to a variable inside the library. This is Python 2.5 on Linux. Here's what I have so far--if you comment out the memmove call (3 lines)

Re: ANN: Dejavu 1.5.0RC1

2007-01-24 Thread Michele Simionato
On Jan 24, 11:57 pm, "Robert Brewer" <[EMAIL PROTECTED]> wrote: > The Dejavu Object-Relational Mapper (version 1.5.0RC1) is now available > and in the public domain. Get it athttp://projects.amor.org/dejavu, > or from PyPI:http://www.python.org/pypi/Dejavu/1.5.0RC1. I am curious ... how this compa

Re: Using Timing function problem.....

2007-01-24 Thread Gabriel Genellina
At Thursday 25/1/2007 01:26, kevin wrote: Hi... I'm having a few problems here... I want to input in my function different values and then time each one to see how long it took to run the function... so right now it doesn't like the "i" inside my function fibonacci(i) but if I put a constant it

logging module and doctest

2007-01-24 Thread Gary Jefferson
I've written a logging.filter and would like to use doctest on it (using a StreamHandler for stdout), but this doesn't seem possible. Output from the logger seems to disappear (running the doctest strings through the interpreter as-is yields expected results). I assume this is because doctest does

Re: numpy or _numpy or Numeric?

2007-01-24 Thread Travis E. Oliphant
auditory wrote: >>> While trying to install numpy accroding to its homepage. >>> (http://numpy.scipy.org/numpydoc/numdoc.htm). >>> i am quite confused. >> You are reading old documentation for Numeric and so any installation >> description is how to install the Numeric module (not its newer >> re

Re: Catching floating point errors from linked C code

2007-01-24 Thread John Pye
Hi John, On Jan 25, 3:43 pm, John Nagle <[EMAIL PROTECTED]> wrote: > Python is probably running with floating point exceptions disabled, > but you can enable them in your C code, and restoring the floating > point mode when you leave, if you want. This is probably > only worth doing under a debug

Re: How can i do this in Python?

2007-01-24 Thread Jerry
Well, the python interpreter has no equivalent to -n or -a in the perl interpreter. You'd have to implement it using an actual while loop and because of the indention sensitivity in Python, I don't believe you can do it on the command line. (I may be very wrong here, but I've not gotten it to wor

Re: Catching floating point errors from linked C code

2007-01-24 Thread John Nagle
John Pye wrote: > Hi all > > I have some C code that is giving me some 'nan' values in some > calculations. The C code is wrapped using SWIG to give me a Python > module that I am then exercising through a unittest suite. > > It seems that I should expect the C code to throw floating point > exc

Re: newbie - returned values from cscript.exe

2007-01-24 Thread Jerry
I would probably start with a look at popen. With it you can make your call to cscript and capture the output. Then, you don't need to set any environment variables. On Jan 24, 1:26 pm, "Rich" <[EMAIL PROTECTED]> wrote: > I am writing my first python script and I'm guessing this is something > o

Using Timing function problem.....

2007-01-24 Thread kevin
Hi... I'm having a few problems here... I want to input in my function different values and then time each one to see how long it took to run the function... so right now it doesn't like the "i" inside my function fibonacci(i) but if I put a constant it's fine any idea on how to approach this?

How can i do this in Python?

2007-01-24 Thread NoName
perl -ane "print join(qq(\t),@F[0,1,20,21,2,10,12,14,11,4,5,6]).qq(\n)" file.txt -a autosplit mode with -n or -p (splits $_ into @F) -n assume "while (<>) { ... }" loop around program -- http://mail.python.org/mailman/listinfo/python-list

Catching floating point errors from linked C code

2007-01-24 Thread John Pye
Hi all I have some C code that is giving me some 'nan' values in some calculations. The C code is wrapped using SWIG to give me a Python module that I am then exercising through a unittest suite. It seems that I should expect the C code to throw floating point exceptions (SIGFPE) and either the

Re: My Tkinter Threading nightmare

2007-01-24 Thread Paul Rubin
Paul Rubin writes: > def idle(self): > # read and execute any commands waiting on the queue > while True: > try: >func, args, kw = self.cmd_queue.get(block=False) > except QueueEmpty: >return

Subclassing cElementTree.XMLTreeBuilder

2007-01-24 Thread mukappa
I found an earlier post about subclassing cElementTree.Element which can't be done because it is a factory method. I am trying to subclass XMLTreeBuilder with success using the python implementation, but not with cElementTree. [1013]$ python Python 2.3.4 (#1, Feb 22 2005, 04:09:37) [GCC 3.4.3 200

Re: My Tkinter Threading nightmare

2007-01-24 Thread Paul Rubin
[EMAIL PROTECTED] writes: > and setup the callback to kill the operation and then the window when > the user clicks on the X of the progress window. I've implemented this > in my code, but clicking on the X does nothing until I kill the main > thread (i think), and then my callback is run. I've a

My Tkinter Threading nightmare

2007-01-24 Thread half . italian
Hi all, I don't really understand how to properly use threading in my programs, however I have managed to get by so far using them improperly. Once again I have come up to what I think is something that won't work because of the way the program is set up. I have a long running process running un

Re: difflib qualm

2007-01-24 Thread Gabriel Genellina
At Wednesday 24/1/2007 23:05, Sick Monkey wrote: I am trying to write a python script that will compare 2 files which contains names (millions of them). More specifically, I have 2 files (Files1.txt and Files2.txt). Files1.txt contains 180 thousand names and Files2.txt contains 34 million n

difflib qualm

2007-01-24 Thread Sick Monkey
I am trying to write a python script that will compare 2 files which contains names (millions of them). More specifically, I have 2 files (Files1.txt and Files2.txt). Files1.txtcontains 180 thousand names and Files2.txt contains 34 million names. I have a script which will analyze these two file

Re: Python Windows Editors

2007-01-24 Thread redawgts
Yes, pywin32 installs PythonWin. On Jan 24, 4:07 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > W. Watson wrote: > > I downloaded python-2.5.msi and installed it. I believe its editor is > > [corrected]IDLE. I understand there's a Win editor called pythonwin. I > > believe it's > > in the download

Re: The reliability of python threads

2007-01-24 Thread Damjan
>> and the GIL is more than an "artifact". It is a central tenet of >> threaded python programming. > > If it's a central tenet of threaded python programming, why is it not > mentioned at all in the language or library manual? The threading > module documentation describes the right way to han

Re: The reliability of python threads

2007-01-24 Thread Paul Rubin
"Klaas" <[EMAIL PROTECTED]> writes: > CPython is more that "a particular implementation" of python, It's precisely a particular implementation of Python. Other implementations include Jython, PyPy, and IronPython. > and the GIL is more than an "artifact". It is a central tenet of > threaded py

Re: Static variables

2007-01-24 Thread Paul Rubin
[EMAIL PROTECTED] writes: > An interesting solution, I have never created such grouped closures. I > don't know if this solution is better than a class with some class > attributes plus some class methods... It's a Scheme idiom but I think once the object gets this complicated, it's probably more

Re: The reliability of python threads

2007-01-24 Thread Klaas
On Jan 24, 4:11 pm, Paul Rubin wrote: > "Klaas" <[EMAIL PROTECTED]> writes: > > POSIX issues aside, Python's threading model should be less susceptible > > to memory-barrier problems that are possible in other languages (this > > is due to the GIL). > But the GIL is not

Re: Beginners Tutorial in PDF Format?

2007-01-24 Thread Gabriel Genellina
At Wednesday 24/1/2007 17:57, W. Watson wrote: >Gabriel Genellina wrote: > > "W. Watson" <[EMAIL PROTECTED]> escribió en el mensaje > > news:[EMAIL PROTECTED] > > Robert Hicks wrote: > >> W. Watson wrote: > >>> I'd like to print a tutorial in one fell swoop, but it seems most on the > >>> various

Re: Static variables

2007-01-24 Thread bearophileHUGS
Bruno Desthuilliers: > And this let you share state between functions: > > def make_counter(start_at=0, step=1): >count = [start_at] >def inc(): > count[0] += step > return count[0] >def reset(): > count[0] = [start_at] > return count[0] >def peek(): > retur

Re: Question about docutils

2007-01-24 Thread Ben Finney
Damjan <[EMAIL PROTECTED]> writes: > I'm using docutils 0.4. The specific mailing lists for docutils: http://docutils.sourceforge.net/docs/user/mailing-lists.html> Also available via GMane, which is how I read them. -- \ "Here is a test to see if your mission on earth is finished. If

Re: Question about docutils

2007-01-24 Thread alex23
On Jan 25, 10:40 am, Damjan <[EMAIL PROTECTED]> wrote: > I'm using docutils 0.4. > Is it possible to define special custom 'tags' (or something) that will > invoke my own function? The function would then return the real content in > the ReST document. I -think- this is what you're looking for: ht

Question about docutils

2007-01-24 Thread Damjan
I'm using docutils 0.4. Is it possible to define special custom 'tags' (or something) that will invoke my own function? The function would then return the real content in the ReST document. -- damjan -- http://mail.python.org/mailman/listinfo/python-list

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Robert Kern
Sean Schertell wrote: > Not to totally hijack the thread -- but since you're all talking > about best GUI frameworks. Any thoughts on the best looking framework > for OS X only? Is there any way to write little Python apps that will > launch in OS X using OS X widgets? Use PyObjC. You have f

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread Sean Schertell
Not to totally hijack the thread -- but since you're all talking about best GUI frameworks. Any thoughts on the best looking framework for OS X only? Is there any way to write little Python apps that will launch in OS X using OS X widgets? Thanks, Sean On Jan 25, 2007, at 8:33 AM, dimitri

Re: raise UnicodeError, "label too long"

2007-01-24 Thread Flavio
something like this, for instance: http://.wikipedia.org/wiki/Copper%28II%29_hydroxide but even url with any non-ascii characters such as this http://.wikipedia.org/wiki/Ammonia also fail when passed to urlopen : File "/usr/lib/python2.4/encodings/idna.py", line 72, in ToASCII raise Unicode

Re: matplotlib button problem

2007-01-24 Thread dimitri pater
Hi, post your question on matplotlib-users@lists.sourceforge.net regards, Dimitri On 24 Jan 2007 13:37:22 -0800, Zielinski <[EMAIL PROTECTED]> wrote: Hi, Recently I started to use matplotlib with python. Now I would like to have interaction with my plots. Here is the problem: I have a long v

Re: The reliability of python threads

2007-01-24 Thread Paul Rubin
"Klaas" <[EMAIL PROTECTED]> writes: > POSIX issues aside, Python's threading model should be less susceptible > to memory-barrier problems that are possible in other languages (this > is due to the GIL). But the GIL is not part of Python's threading model; it's just a particular implementation ar

Re: The reliability of python threads

2007-01-24 Thread Klaas
On Jan 24, 10:43 am, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > Yea, typically I would think that. The problem I am seeing is > incredibly intermittent. Like a simple pyro server that gives me a > problem maybe every three or four months. Just something funky will > happen to the state

Re: The reliability of python threads

2007-01-24 Thread Klaas
On Jan 24, 10:43 am, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > On 24 Jan 2007 18:21:38 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > >> [snip] > > > I'm aware of the issues with the POSIX threading model. I still stand > > by my statement - bringing up the pro

Re: The reliability of python threads

2007-01-24 Thread Klaas
On Jan 24, 10:43 am, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > On 24 Jan 2007 18:21:38 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > >> [snip] > > > I'm aware of the issues with the POSIX threading model. I still stand > > by my statement - bringing up the pro

Re: Python does not play well with others

2007-01-24 Thread dimitri pater
On 1/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: John> MySQLdb has version and platform compatibility problems. Got specific examples? I've successfully used MySQLdb on Linux, Mac and Solaris with no compatibility problems at all. I have been using MySLQdb also on Linux, Mac *an

Re: The reliability of python threads

2007-01-24 Thread John Nagle
Carl J. Van Arsdall wrote: > Chris Mellon wrote: > >> On 24 Jan 2007 18:21:38 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: >> >> >>> [snip] >>> >>> >> >> >> I'm aware of the issues with the POSIX threading model. I still stand >> by my statement - bringing up the problems with the provabil

ogl example question

2007-01-24 Thread [EMAIL PROTECTED]
I know this might be the wrong place to ask but I recently modified the ogl example from wxpython and it works fine in spe but when I call it from other programs it wierds out because of the run.py thing they have set it up with doesn't work when I call it from an external program (including .b

Re: Python does not play well with others

2007-01-24 Thread hg
egbert wrote: > On Wed, Jan 24, 2007 at 06:24:37AM +, Harry George wrote: >> >> Perl - excellent modules and bindings for just about everything ... >> Java - a world of its own. They reinvent the wheel instead of ... >> PHP - are we talking web scripts or serious programs? Are you ... >> C

Re: ANN: Dejavu 1.5.0RC1

2007-01-24 Thread Cliff Wells
On Wed, 2007-01-24 at 14:57 -0800, Robert Brewer wrote: > 1. Expressions: pure Python lambda querying. This is perhaps the most >appealing feature of Dejavu. Actually I just went and looked and personally I find the documentation the most appealing feature. Regards, Cliff -- http://mail.p

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread dimitri pater
On 1/24/07, Laurent Rahuel <[EMAIL PROTECTED]> wrote: Hi, I known this can be impossible but what about an "HTML" GUI ? Yep, I think you should consider a HTML GUI. I have just finished a project using CherryPy running on localhost. The big advantage is that the app runs on Linux, Mac and Win

Re: New os.path.exists() behavior - bug or feature?

2007-01-24 Thread Martin Miller
FWIW, your code works correctly for me in all respects with Python 2.5 on Windows XP Pro. I no longer have Python 2.4.x installed, so can't easily do a comparison. Perhaps the problem has something to do with Python 2.5 with Windows 2K. -Martin On Dec 17 2006, 4:29 pm, "klappnase" <[EMAIL PROTE

ANN: Dejavu 1.5.0RC1

2007-01-24 Thread Robert Brewer
The Dejavu Object-Relational Mapper (version 1.5.0RC1) is now available and in the public domain. Get it at http://projects.amor.org/dejavu, or from PyPI: http://www.python.org/pypi/Dejavu/1.5.0RC1. Dejavu is an Object-Relational Mapper for Python applications. It is designed to provide the "Mode

Re: Beginners Tutorial in PDF Format?

2007-01-24 Thread Joshua J. Kugler
W. Watson wrote: >>> http://docs.python.org/download.html >> >> Try again. The first url goes to this page: >> Download Python 2.5 Documentation (19 September 2006): To download an >> archive containing all the documents for this version of Python in one >> of various formats [pdf included, you c

file -> open in stdlib patch

2007-01-24 Thread Daniel Nogradi
Hi list, AFAIK using file( ) to open a file is deprecated in favor of open( ) and while grepping through the stdlib I noticed a couple of occurences of file( ) in the latest revision. I made a patch for getting rid of them; it passes all the tests. Although the change is almost trivial, since this

Re: Python does not play well with others

2007-01-24 Thread Kay Schluehr
On 25 Jan., 04:46, "Paul Boddie" <[EMAIL PROTECTED]> wrote: > > That's because, in those worlds, either the > > development team for the language or the development team > > for the subsystem takes responsibility for making them work. > > Only Python doesn't do that.And this is where I'd almost

Re: Best way to document Python code...

2007-01-24 Thread Nick Vatamaniuc
Epydoc is the way to go. You can even choose between various formating standards (including javadoc ) and customize the output using CSS. On Jan 22, 7:51 pm, "Stuart D. Gathman" <[EMAIL PROTECTED]> wrote: > On Mon, 22 Jan 2007 17:35:18 -0500, Stuart D. Gathman wrote: > > The HTML generated by py

Re: wxPython: panel not fully painted

2007-01-24 Thread Chris Mellon
On 24 Jan 2007 13:35:51 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new to wxpython, and the following code is my first serious > attempt: > > > #~ start code > import wx > > class MyPanel(wx.Panel): > def __init__(self, parent, id): > wx.Panel.__init__(self, paren

Re: The reliability of python threads

2007-01-24 Thread Paddy
On Jan 24, 6:43 pm, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > On 24 Jan 2007 18:21:38 GMT, Nick Maclaren <[EMAIL PROTECTED]> wrote: > > >> [snip] > > > I'm aware of the issues with the POSIX threading model. I still stand > > by my statement - bringing up the prob

Re: raise UnicodeError, "label too long"

2007-01-24 Thread Martin v. Löwis
Flavio schrieb: > What I am doing is very simple: > > I fetch an url (html page) parse it using BeautifulSoup, extract the > links and try to open each of the links, repeating the cycle. > > Beautiful soup converts the html to unicode. That's why when I try to > open the links extracted from the

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Steven D'Aprano
On Wed, 24 Jan 2007 11:51:27 -0800, metaperl wrote: > Ok, I have a module called textgen.py. The point of this module is to > generate a csv file from an array of dictionaries. You probably should use the csv module to do the grunt work, leaving your module just to massage the dicts into a form t

Re: My python programs need a GUI, wxPython or PyQt4?

2007-01-24 Thread David Boddie
On Jan 24, 11:54 am, Harry George <[EMAIL PROTECTED]> wrote: > It is all interpretation -- even after some cases have wandered > through the courts. Mostly the trolltech statements indicate their > intent to sue. That right there tells me I want to go elsewhere. Well, one could alternatively re

Re: raise UnicodeError, "label too long"

2007-01-24 Thread Flavio
What I am doing is very simple: I fetch an url (html page) parse it using BeautifulSoup, extract the links and try to open each of the links, repeating the cycle. Beautiful soup converts the html to unicode. That's why when I try to open the links extracted from the page I get this error. This i

matplotlib button problem

2007-01-24 Thread Zielinski
Hi, Recently I started to use matplotlib with python. Now I would like to have interaction with my plots. Here is the problem: I have a long vector of data, to long to display it on one picture, because of, well you know to much data to big mess... so I decided to extract some data from long_vect

wxPython: panel not fully painted

2007-01-24 Thread citronelu
Hi, I'm new to wxpython, and the following code is my first serious attempt: #~ start code import wx class MyPanel(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) self.parent = parent button = wx.Button(self, -1, "Refresh") butt

Re: Static variables

2007-01-24 Thread Gary Herron
Florian Lindner wrote: > Hello, > does python have static variables? I mean function-local variables that keep > their state between invocations of the function. > > Thanks, > > Florian > Nope. Not really. In new versions of Python, functions and methods can have attributes that can be used l

Re: Static variables

2007-01-24 Thread Gary Herron
Florian Lindner wrote: > Hello, > does python have static variables? I mean function-local variables that keep > their state between invocations of the function. > > Thanks, > > Florian > Nope. Not really. In new versions of Python, functions and methods can have attributes that can be used l

Re: Simple Matrix class

2007-01-24 Thread Robert Kern
Paul Rubin wrote: > You might look at the Numerical Recipes books for clear descriptions > of how to do this stuff in the real world. Maybe the experts here > will jump on me for recommending those books since I think the serious > numerics crowd scoffs at them (they were written by scientists ra

Re: Static variables

2007-01-24 Thread Steven D'Aprano
On Wed, 24 Jan 2007 21:48:38 +0100, Florian Lindner wrote: > Hello, > does python have static variables? I mean function-local variables that keep > their state between invocations of the function. There are two ways of doing that (that I know of). The simplest method is by having a mutable defa

Re: Static variables

2007-01-24 Thread Bruno Desthuilliers
Neil Cerutti a écrit : > On 2007-01-24, Florian Lindner <[EMAIL PROTECTED]> wrote: > >>does python have static variables? I mean function-local >>variables that keep their state between invocations of the >>function. > > > Yup. Here's a nice way. I don't how recent your Python must be > to supp

Re: raise UnicodeError, "label too long"

2007-01-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Flavio wrote: > Hi I am havin a problem with urllib2.urlopen. > > I get this error when I try to pass a unicode to it. > > raise UnicodeError, "label too long" > > is this problem avoidable? no browser or programs such as wget seem to > have a problem with these strings.

Re: The reliability of python threads

2007-01-24 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Aahz) writes: |> |> My response is that you're asking the wrong questions here. Our database |> server locked up hard Sunday morning, and we still have no idea why (the |> machine itself, not just the database app). I think it's more important

Re: module email

2007-01-24 Thread Rob Wolfe
"Sergey Dorofeev" <[EMAIL PROTECTED]> writes: > Hello. > > Why does not work? [...] > m=email.message.Message() [...] > p2=email.message.Message() > p2.set_type("message/rfc822") > p2.set_payload(m) Payload is a _list_ of Message objects (is_multipart() == True) or a _string_ object (is_multi

Re: Static variables

2007-01-24 Thread Bruno Desthuilliers
Florian Lindner a écrit : > Hello, > does python have static variables? I mean function-local variables that keep > their state between invocations of the function. Not directly. But there are ways to have similar behaviour: 1/ the mutable default argument hack: def fun(arg, _hidden_state=[0]):

Re: Simple Matrix class

2007-01-24 Thread Robert Kern
Paul McGuire wrote: > On Jan 24, 1:47 pm, Robert Kern <[EMAIL PROTECTED]> wrote: >> Paul McGuire wrote: >>> And the purpose/motivation for "reimplementing it better" would be >>> what, exactly? So I can charge double for it? >> So you can have accurate results, and you get a good linear solver out

Re: Python does not play well with others

2007-01-24 Thread skip
John> Python is the only major open source project I've encountered John> where there's so much hostility to bug reports. You're misinterpreting lack of time (or itches that need scratching by the people willing to do the work) for hostility. Lest you think that there is no activity on b

Re: Static variables

2007-01-24 Thread Neil Cerutti
On 2007-01-24, Florian Lindner <[EMAIL PROTECTED]> wrote: > does python have static variables? I mean function-local > variables that keep their state between invocations of the > function. Yup. Here's a nice way. I don't how recent your Python must be to support this, though. >>> def foo(x): ..

Re: Python Windows Editors

2007-01-24 Thread W. Watson
W. Watson wrote: > I downloaded python-2.5.msi and installed it. I believe its editor is > [corrected]IDLE. I understand there's a Win editor called pythonwin. I > believe it's > in the download pywin32-210.win32-py2.5.exe, but I'm not sure if this > exe file has just the editor or all of Pytho

Re: Simple Matrix class

2007-01-24 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > Dang, I thought I was testing the results sufficiently! What is the > accuracy problem? In my test cases, I've randomly created test > matrices, inverted, then multiplied, then compared to the identity > matrix, with the only failures being when I star

Re: Python Windows Editors

2007-01-24 Thread W. Watson
Stef Mientki wrote: > Any text editor is only as good as the >> programmer who uses it. ;) >> > Yes but an IDE is different ;-) > > cheers, > Stef Mientki Correct. Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. t

Re: Python Windows Editors

2007-01-24 Thread W. Watson
Hertha Steck wrote: > Am Mon, 22 Jan 2007 00:33:12 + schrieb W. Watson: > >> [EMAIL PROTECTED] wrote: >>> W. Watson wrote: I downloaded python-2.5.msi and installed it. I believe its editor is IDE. I understand there's a Win editor called pythonwin. I believe it's in the d

Re: Beginners Tutorial in PDF Format?

2007-01-24 Thread W. Watson
Gabriel Genellina wrote: > "W. Watson" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > Robert Hicks wrote: >> W. Watson wrote: >>> I'd like to print a tutorial in one fell swoop, but it seems most on the >>> various sites are page by page embedded descriptions in the page. An

raise UnicodeError, "label too long"

2007-01-24 Thread Flavio
Hi I am havin a problem with urllib2.urlopen. I get this error when I try to pass a unicode to it. raise UnicodeError, "label too long" is this problem avoidable? no browser or programs such as wget seem to have a problem with these strings. -- http://mail.python.org/mailman/listinfo/python-li

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Neil Cerutti
On 2007-01-24, metaperl <[EMAIL PROTECTED]> wrote: > if dict_key == 'PCN': > fields = dict_val.split("/") > mo = re.match( '(\w{2})(\d{2})(\d{2})' , fields[1] ) > if mo: > dict_val = "%s/%s%s/%s" % (fields[0], mo.group(1), >

Re: The reliability of python threads

2007-01-24 Thread Aahz
In article <[EMAIL PROTECTED]>, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > >Hey everyone, I have a question about python threads. Before anyone >goes further, this is not a debate about threads vs. processes, just a >question. > >With that, are python threads reliable? Or rather, are they

RE: Python does not play well with others

2007-01-24 Thread George, Harry G
As always, IMHO... P-code begat JVM, which begat .NET/Mono-CLI, wherein lives C#. Thus it is a deliberately isolated world, much given to reinventing wheels (or rather recoding them) instead of binding to existing libraries. So C# might be a useful tool for anyone forced to live inside that wor

Static variables

2007-01-24 Thread Florian Lindner
Hello, does python have static variables? I mean function-local variables that keep their state between invocations of the function. Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

Re: Re-thinking my if-thens - a software engineering question

2007-01-24 Thread Bruno Desthuilliers
metaperl a écrit : > Ok, I have a module called textgen.py. The point of this module is to > generate a csv file from an array of dictionaries. Err... You know there's a csv module in the stdlib, don't you ? > As I iterate through > each dictionary, I "massage" the dictionary values before writin

Re: Simple Matrix class

2007-01-24 Thread Paul McGuire
On Jan 24, 1:47 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Paul McGuire wrote: > > And the purpose/motivation for "reimplementing it better" would be > > what, exactly? So I can charge double for it? > > So you can have accurate results, and you get a good linear solver out of the > process. The

Re: The reliability of python threads

2007-01-24 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, "Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: |> Chris Mellon wrote: |> > |> > Logic and programming errors in user code are far more likely to be |> > the cause of random errors in a threaded program than theoretical |> > (I've never come across a case in pract

Re: Python does not play well with others

2007-01-24 Thread Chris Mellon
On 1/24/07, John Nagle <[EMAIL PROTECTED]> wrote: > Chris Mellon wrote: > > On 1/24/07, John Nagle <[EMAIL PROTECTED]> wrote: > > > >> Harry George wrote: > >> > John Nagle <[EMAIL PROTECTED]> writes: > > > Just to be clear: The problem here is "my personal itch is not being > > scratched by other

Re: Regex for URL extracting

2007-01-24 Thread Chris Mellon
On 24 Jan 2007 11:07:49 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jan 24, 10:20 am, "Johny" <[EMAIL PROTECTED]> wrote: > > Does anyone know about a good regular expression for URL extracting? > > > > J. > Google turns this up: > > http://geekswithblogs.net/casualjim/archive/2005/12/01/61

Re: Python does not play well with others

2007-01-24 Thread John Nagle
Chris Mellon wrote: > On 1/24/07, John Nagle <[EMAIL PROTECTED]> wrote: > >> Harry George wrote: >> > John Nagle <[EMAIL PROTECTED]> writes: > Just to be clear: The problem here is "my personal itch is not being > scratched by other people for me", not "Python doesn't play well with > others". Yo

Re: Type casting a base class to a derived one?

2007-01-24 Thread Chris Mellon
On 1/24/07, Cliff Wells <[EMAIL PROTECTED]> wrote: > On Wed, 2007-01-24 at 12:57 -0600, Chris Mellon wrote: > > > > > In Python, you can do this simply by re-assigning the __class__. I'm > > not convinced that your type system makes sense, here though. Any > > reasonable ORM should be able to persi

Re: Email attachments

2007-01-24 Thread Max M
Steve Holden skrev: > I'm having some trouble getting attachments right for all recipients, > and it seems like Apple's mail.app is the pickiest client at the moment. > It doesn't handle attachments that both Thunderbird and Outlook find > perfectly acceptable. > > Since the code I'm using is c

Re-thinking my if-thens - a software engineering question

2007-01-24 Thread metaperl
Ok, I have a module called textgen.py. The point of this module is to generate a csv file from an array of dictionaries. As I iterate through each dictionary, I "massage" the dictionary values before writing them out to csv. Now, for one dictionary entry, I have the following code: if

  1   2   3   >