Re: Python is slow?

2008-09-23 Thread Robert Kern
sturlamolden wrote: On Sep 23, 9:17 pm, Robert Kern <[EMAIL PROTECTED]> wrote: You could also drop it on the scipy.org wiki in the Cookbook category. Yes, if I could figure out how to use it... What's confusing? You do have to create a profile: http://www.scipy.org/UserPreferences -- Ro

Re: Python is slow?

2008-09-23 Thread Kay Schluehr
On 23 Sep., 21:23, J Peyret <[EMAIL PROTECTED]> wrote: > On Sep 23, 8:31 am, [EMAIL PROTECTED] wrote: > > Guys, this looks like a great data structure/algo for something I am > working on. > > But... where do I find some definitions of the original BK-tree idea? *geometric data structures*. Just g

Re: curses.setsyx()?

2008-09-23 Thread brad . at . school
On Sep 22, 11:24 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >On Sep 19, 6:42 pm, [EMAIL PROTECTED] wrote: > >> On Sep 19, 1:24 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > > >> > [EMAIL PROTECTED] wrote: > > >> > >I tried curses.setsyx(2,3) in my script and it doesn't m

[Tkinter] how to keep a window above all other OS windows?

2008-09-23 Thread dmitrey
Hi all, how to keep a Tkinter window above all other OS windows (i.e. including those ones from other programs)? Thank you in advance, Dmitrey -- http://mail.python.org/mailman/listinfo/python-list

Python style: exceptions vs. sys.exit()

2008-09-23 Thread Drake
I have a general question of Python style, or perhaps just good programming practice. My group is developing a medium-sized library of general-purpose Python functions, some of which do I/O. Therefore it is possible for many of the library functions to raise IOError Exceptions. The question is: sh

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 10:05 pm, Robert Singer <[EMAIL PROTECTED]> wrote: > May I ask what are your main objections to it ? 1. gfortran is not Absoft. 2. If I program the same in C99 and Fortran 95, and compile with gcc and gfortran, the C99 code runs a lot faster (I've only tested with wavelet transforms).

Re: how to keep a window above all other OS windows?

2008-09-23 Thread dmitrey
On Sep 23, 11:21 pm, dmitrey <[EMAIL PROTECTED]> wrote: > Hi all, > how to keep a Tkinter window above all other OS windows (i.e. > including those ones from other programs)? > > Thank you in advance, > Dmitrey I have put [Tkinter] into topic of my message but somehow it has been removed. D. -- ht

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 10:16 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > What's confusing? You do have to create a profile: How do I add a new page to the wiki? I'm only able to edit the front page of the cookbook. But it doesn't help to add link there if I have no page to link. (I may be incredibly stupid

Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 1:23 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Bobby Roberts a écrit : > > > hi group.  I'm new to python and need some help and hope you can > > answer this question.  I have a situation in my code where i need to > > create a file on the server and write to it.  That's not a

Re: curses.setsyx()?

2008-09-23 Thread linkmaster032000
On Sep 23, 4:16 pm, [EMAIL PROTECTED] wrote: > On Sep 22, 11:24 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > >On Sep 19, 6:42 pm, [EMAIL PROTECTED] wrote: > > >> On Sep 19, 1:24 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > >> > [EMAIL PROTECTED] wrote: > > >

Re: Why no tailcall-optimization?

2008-09-23 Thread Rhamphoryncus
On Sep 22, 7:13 pm, process <[EMAIL PROTECTED]> wrote: > Why doesn't Python optimize tailcalls? Are there plans for it? > > I know GvR dislikes some of the functional additions like reduce and > Python is supposedly about "one preferrable way of doing things" but > not being able to use recursion p

Re: Not fully OO ?

2008-09-23 Thread Craig Allen
> if they want to, but it is *fully* OO in that it includes everything > required to do OO. But maybe the original blogger meant by "fully OO" > what I mean by "Pure OO"? it seems to me this is what was meant... pure OO, AND forced to use it. My personal feeling is that python is multiparadigmed

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Larry Bates
Drake wrote: I have a general question of Python style, or perhaps just good programming practice. My group is developing a medium-sized library of general-purpose Python functions, some of which do I/O. Therefore it is possible for many of the library functions to raise IOError Exceptions. The

Re: What do you call a class not intended to be instantiated

2008-09-23 Thread Craig Allen
> > > Usegrammers? > usegrammers are just those that use grammars, but misspell it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Grant Edwards
On 2008-09-23, Drake <[EMAIL PROTECTED]> wrote: > My group is developing a medium-sized library of general-purpose > Python functions, some of which do I/O. Therefore it is possible for > many of the library functions to raise IOError Exceptions. The > question is: should the library function be a

Re: Why are "broken iterators" broken?

2008-09-23 Thread Craig Allen
I'm interested what others think of this because at first I couldn't get it... I have an object which can iterate over its parts... and at first I thought, what? I'm supposed to create a new object every time the user needs to iterate the contents? In the end I interpreted that statement as if "un

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Craig Allen
> The > question is: should the library function be able to just dump to > sys.exit() with a message about the error (like "couldn't open this > file"), or should the exception propagate to the calling program which > handles the issue? > my view is that the exceptions are there precisely to tell

Re: Python is slow?

2008-09-23 Thread Robert Kern
sturlamolden wrote: On Sep 23, 10:16 pm, Robert Kern <[EMAIL PROTECTED]> wrote: What's confusing? You do have to create a profile: How do I add a new page to the wiki? I'm only able to edit the front page of the cookbook. But it doesn't help to add link there if I have no page to link. (I may

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I have a simulation that runs many times with different parameters, and I want to aggregate the output into a single file with one rub: I want a header to be written only the first time. My program looks a bit like this: def main(): for param in range(10): s

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Terry Reedy
Drake wrote: I have a general question of Python style, or perhaps just good programming practice. My group is developing a medium-sized library of general-purpose Python functions, some of which do I/O. Therefore it is possible for many of the library functions to raise IOError Exceptions. The

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Christian Heimes
Drake wrote: I have a general question of Python style, or perhaps just good programming practice. My group is developing a medium-sized library of general-purpose Python functions, some of which do I/O. Therefore it is possible for many of the library functions to raise IOError Exceptions. The

Re: a short-cut command for globals().clear() ??

2008-09-23 Thread Ricardo Aráoz
Terry Reedy wrote: > MRAB wrote: >> >> How about something like this: >> >> def clear_workspace(): >> keep_set = set(['__builtins__', '__doc__', '__name__', >> 'clear_workspace']) > > For 2.6/3.0, add __package__ to the list to be kept. > >> for x in globals().keys(): >> if x not

Re: Python is slow?

2008-09-23 Thread Robert Singer
On Tue, 23 Sep 2008 13:34:10 -0700 (PDT), sturlamolden <[EMAIL PROTECTED]> wrote: >1. gfortran is not Absoft. I find this comment absurd. What did you mean by it ? Yes, gfortran is not Absoft, just as red is not blue (?!). I also don't understand whether you're looking for a free or a commercial

Visualize class inheritance hierarchy

2008-09-23 Thread Rob Kirkpatrick
Hi All, I just finished debugging some code where I needed to determine why one subclass had a bound method and another did not. They had different pedigree's but I didn't know immediately what the differences were. I ended up walking the hierarchy, going back one class at a time through the cod

Re: Python is slow?

2008-09-23 Thread sturlamolden
On Sep 23, 8:52 pm, [EMAIL PROTECTED] wrote: > Is this a good or bad thing? ;-) It seems we have been implementing different algorithms. kd-trees are not BK-trees. http://www.scipy.org/Cookbook/KDTree -- http://mail.python.org/mailman/listinfo/python-list

Re: Docstrings for class attributes

2008-09-23 Thread George Sakkis
On Sep 23, 3:55 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Sep 23, 1:23 am, "Tom Harris" <[EMAIL PROTECTED]> wrote: > > >> Greetings, > > >> I want to have a class as a container for a bunch of symbolic names > >> for integers, eg: > > >> class Constants: > >>

detektei info detektei hessen in Gunzenhausen

2008-09-23 Thread somenewguy61
http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET http://WWW.DETEKTEI-DETEKTIV.NET ht

Re: appending * to glob returns files with '*' !!

2008-09-23 Thread John [H2O]
No bug indeed, Erik was correct, in fact I had files with the * in the name... Thanks all for your replies! Erik Max Francis wrote: > > John [H2O] wrote: > >> I have a glob.glob search: >> >> searchstring = os.path.join('path'+'EN*') >> files = glob.glob(searchstring) >> for f in files: >>

python syntax for conditional is unfortunate

2008-09-23 Thread Neal Becker
In hindsight, I am disappointed with the choice of conditional syntax. I know it's too late to change. The problem is y = some thing or other if x else something_else When scanning this my eye tends to see the first phrase and only later notice that it's conditioned on x (or maybe not notice

Re: Regex Help

2008-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Support Desk wrote: > Anybody know of a good regex to parse html links from html code? The one I > am currently using seems to be cutting off the last letter of some links, > and returning links like > > http://somesite.co > > or http://somesite.ph > > the code I

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Christian Heimes
Rob Kirkpatrick wrote: I'm assuming this has been discussed before, but I'm lacking any Google keywords that bring up the appropriate discussion. You are looking for "mro" aka method resolution order. The inspect module contains several helper functions to inspect a class hierarchy. The foll

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: Python is slow?

2008-09-23 Thread Robert Kern
Robert Kern wrote: J Peyret wrote: On Sep 23, 8:31 am, [EMAIL PROTECTED] wrote: Guys, this looks like a great data structure/algo for something I am working on. But... where do I find some definitions of the original BK-tree idea? Uh, actually we're talking about kd-trees, not BK-trees. kd-t

Re: finding domain name

2008-09-23 Thread Gabriel Genellina
En Tue, 23 Sep 2008 09:37:44 -0300, Bobby Roberts <[EMAIL PROTECTED]> escribió: hi group. I'm new to python and need some help and hope you can answer this question. I have a situation in my code where i need to create a file on the server and write to it. That's not a problem if i hard cod

Re: Python is slow?

2008-09-23 Thread bearophileHUGS
sturlamolden: > It seems we have been implementing different algorithms. kd-trees are > not BK-trees. > http://www.scipy.org/Cookbook/KDTree Sorry for my silly mistake :-) Note: in your code I don't know if the collections.deque data structure may help (it's faster than list for appending), but I

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Cameron Simpson
On 23Sep2008 19:52, Neal Becker <[EMAIL PROTECTED]> wrote: | In hindsight, I am disappointed with the choice of conditional syntax. | I know it's too late to change. The problem is | | y = some thing or other if x else something_else | | When scanning this my eye tends to see the first phrase an

How can I use a PyObject in C++?

2008-09-23 Thread lixinyi . 23
for example: #include void exec_python_code(int arg, char** argv) { Py_Initialize(); Py_Main(argc,argv); Py_Finalize(); } What I would like to know is: after Py_Main(argc,argv); How do I get every variable in python space, say a=[1,2,3,'Hello World',[2,3]] b=['xx','xxx','',0.12

How do I use python object in C++

2008-09-23 Thread lixinyi . 23
for example I have the following code: #include void exec_pythoncode( int arg, char**argv ) { Py_Initialize(); Py_Main(argc,argv); Py_Finalize(); } What I would like to know is how can I get the variables I want after Py_Main(argc,argv) say I have a=[1,2,'Hello World',0.1234] in th

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Ben Finney
Cameron Simpson <[EMAIL PROTECTED]> writes: > A good coder will present things clearly. For trivial stuff the one > line form may be fine, and for longer stuff then this: > > y = some thing or other \ > if x \ > else something_else Parentheses are usually more robust for multi-line

Property Function

2008-09-23 Thread AON LAZIO
Hi, In python code, class A: get(self): do something set(self): do something g=property(get,set) what is the good use of "property" function?, I do not understand clearly.. Thanks in advance -- http://mail.python.org/mailman/listinfo/py

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 6:52 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > In hindsight, I am disappointed with the choice of conditional syntax.  I > know it's too late to change.  The problem is > > y = some thing or other if x else something_else > > When scanning this my eye tends to see the first phrase an

Re: How do I use python object in C++

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 7:50 pm, [EMAIL PROTECTED] wrote: > for example I have the following code: > > #include > > void exec_pythoncode( int arg, char**argv ) > { >     Py_Initialize(); >     Py_Main(argc,argv); >     Py_Finalize(); > > } > > What I would like to know is how can I get the variables I want > a

Re: python syntax for conditional is unfortunate

2008-09-23 Thread namekuseijin
On 23 set, 20:52, Neal Becker <[EMAIL PROTECTED]> wrote: > In hindsight, I am disappointed with the choice of conditional syntax.  I > know it's too late to change.  The problem is > > y = some thing or other if x else something_else > > When scanning this my eye tends to see the first phrase and

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Neal Becker
Aaron "Castironpi" Brady wrote: > On Sep 23, 6:52 pm, Neal Becker <[EMAIL PROTECTED]> wrote: >> In hindsight, I am disappointed with the choice of conditional syntax. I >> know it's too late to change. The problem is >> >> y = some thing or other if x else something_else >> >> When scanning this

Re: how to keep a window above all other OS windows?

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 3:34 pm, dmitrey <[EMAIL PROTECTED]> wrote: > On Sep 23, 11:21 pm, dmitrey <[EMAIL PROTECTED]> wrote: > > > Hi all, > > how to keep a Tkinter window above all other OS windows (i.e. > > including those ones from other programs)? > > > Thank you in advance, > > Dmitrey > > I have put [Tki

Twisted vs. CherryPy vs. ??? for light-weight web servers

2008-09-23 Thread Michael Mabin
Is there any consensus on what the best lightweight web-server is? Or rather would Twisted be a better choice to choose as a framework that allows me to serve html or xml data for light webservices. Or is CherryPy just as good? -- | _ | * | _ | | _ | _ | * | | * | * | * | -- http://mail.python.o

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 8:50 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > On Sep 23, 6:52 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > >> In hindsight, I am disappointed with the choice of conditional syntax.  I > >> know it's too late to change.  The problem is > > >> y = so

Re: How do I use python object in C++

2008-09-23 Thread lixinyi . 23
If the PyObject is a PyList, and all list items are strings, say a=['aaa','bbb','ccc'] How can I have a myArray[0] = "aaa" myArray[1] = "bbb" myArray[2] = "ccc" in C++? Do I have to use PyModule_GetDict() to get the dict first? what about the next? > > What do you know about the contents of 'ar

Re: python syntax for conditional is unfortunate

2008-09-23 Thread namekuseijin
On 23 set, 22:50, Neal Becker <[EMAIL PROTECTED]> wrote: > I find I'm often tripped up by: > > x = Y (lots of  constructor arguments) if something ... > > on first glance, I don't notice the if. Nobody does. This peculiar syntax has much better usage in short expressions. dothis if this else

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Roy Smith
"Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > You're out of options. You have to express it somehow. How about: Assignith z the value of x if the value of b is such that it is true, else assignith it the value of y. Assignith z not the value of w, nor the value of v, lest you ra

Re: Detecting the first time I open/append to a file

2008-09-23 Thread Scott David Daniels
Terry Reedy wrote: [EMAIL PROTECTED] wrote: ...If I can sense that the file is being created in the first iteration, I can then use an if statement to decide whether or not I need to write the header. Question: how can I tell if the file is being created or if this its the first iteration? ...

Re: How do I use python object in C++

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > If the PyObject is a PyList, and all list items are strings, > say a=['aaa','bbb','ccc'] > > How can I have a > myArray[0] = "aaa" > myArray[1] = "bbb" > myArray[2] = "ccc" > in C++? > > Do I have to > use PyModule_GetDict() to get the dict first? > wh

Re: How do I use python object in C++

2008-09-23 Thread Aaron "Castironpi" Brady
On Sep 23, 11:06 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > > > > > If the PyObject is a PyList, and all list items are strings, > > say a=['aaa','bbb','ccc'] > > > How can I have a > > myArray[0] = "aaa" > > myArray[1] = "bbb" > > m

Re: Comparing float and decimal

2008-09-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Sep 2008 07:08:07 -0700, Michael Palmer wrote: >> > This seems to break the rule that if A is equal to B and B is equal >> > to C then A is equal to C. >> >> I don't see why transitivity should apply to Python objects in general. > > Well, for numbers it surely would be a nice touch, w

Re: How do I use python object in C++

2008-09-23 Thread lixinyi . 23
On 9月24日, 午後1:15, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 23, 11:06 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > > > > If the PyObject is a PyList, and all list items are strings, > > > say a=['aaa','

Re: Docstrings for class attributes

2008-09-23 Thread Steven D'Aprano
On Tue, 23 Sep 2008 15:23:35 +1000, Tom Harris wrote: > Greetings, > > I want to have a class as a container for a bunch of symbolic names for > integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, so > that hel

python 3.x third party modules

2008-09-23 Thread km
Hi all, I would like to look at third party modules which are python 3.0 ready. could some one point me to such a resource ? If its not available, it would be useful to host a page regarding this on python.org ? any comments ? KM -- http://mail.python.org/mailman/listinfo/python-list

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Rob Kirkpatrick
On Sep 23, 4:58 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Rob Kirkpatrick wrote: > > I'm assuming this has been discussed before, but I'm lacking any > > Google keywords that bring up the appropriate discussion. > > You are looking for "mro" aka method resolution order. The inspect > module

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Steven D'Aprano
On Tue, 23 Sep 2008 13:25:26 -0700, Drake wrote: > I have a general question of Python style, or perhaps just good > programming practice. > > My group is developing a medium-sized library of general-purpose Python > functions, some of which do I/O. Therefore it is possible for many of > the libr

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Asun Friere
On Sep 24, 8:10 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Side note: > > sys.exit() is just another way to write raise SystemExit. The function > is defined as: > As can be seen if you were ever silly enough to call sys.exit() in IDLE. ;) -- http://mail.python.org/mailman/listinfo/python-

Re: python freeze help

2008-09-23 Thread Gabriel Rossetti
Mike Driscoll wrote: On Sep 23, 5:01 am, Gabriel Rossetti <[EMAIL PROTECTED]> wrote: Hello everyone, I'm trying to use python's freeze utility but I'm running into problems. I called it like this : python /usr/share/doc/python2.5/examples/Tools/freeze/freeze.py ~/Documents/Code/Python/src/j

PyRun_SimpleFile() crashes

2008-09-23 Thread lixinyi . 23
my code: main.cpp #include int main(int argc, char **argv) { Py_Initialize(); FILE *file_1 = fopen("a2l_reader.py","r+"); PyRun_SimpleFile(file_1,"a2l_reader.py"); Py_Finalize(); } compile under windows using MinGW: g++ main.cpp libpython25.a -o a no error was found. But when I run a.exe the

Re: matrix algebra

2008-09-23 Thread alain
On Sep 22, 11:32 am, "Tim Leslie" <[EMAIL PROTECTED]> wrote: > There is no need for a wrapper. Both numarray and Numeric have been > deprecated in favour of numpy, so numpy is the only one you need to > use. Numpy should have all the tools you need. If you find something > missing, there's a good c

<    1   2