Re: pipeline encoding

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 14:13:04 -0300, Tomasz Toczyski <[EMAIL PROTECTED]> escribió: > My locale is set to UTF-8. The command: > python -c "print u'\u03A9'" > gives me the desired result and doesn't produce any error. Because in this case stdout is bound to your terminal and Python can ask the O

ANN: Chandler 0.7.3

2007-12-06 Thread Heikki Toivonen
The Chandler Project is pleased to announce the 0.7.3 release of Chandler Desktop! Chandler Desktop is an open source, standards-based personal information manager (PIM) built around small group collaboration and a core set of information management workflows modeled on Inbox usage patterns and Da

Re: Tkinter Newbie Question

2007-12-06 Thread Marc 'BlackJack' Rintsch
On Thu, 06 Dec 2007 23:04:56 -0800, robbie wrote: > This second example doesn't work. The only difference is that I gave > the salutation function a parameter and tried to pass a string as the > parameter from the button. It appears to call the function once for > each window as they're being cre

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread Gabriel Genellina
En Fri, 07 Dec 2007 01:24:57 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: > On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Thu, 06 Dec 2007 23:27:15 -0300, grbgooglefan <[EMAIL PROTECTED]> >> escribió: >> >> > I want to use Python's Windows (python25.dll) version

Tkinter Newbie Question

2007-12-06 Thread robbie
Hello Group, I'm a programmer with many years experience, but am new to Python and to object oriented programming. I'm working my way through a book on Python, and have been tweaking the examples to see what they do. I've run into a situation that I don't understand, though I expect it's pretty si

Is there any way to use python scripts in mainframe environment?

2007-12-06 Thread Kolipaka, Praveen
Is there any way to use python scripts in mainframe environment? Regards, Praveen KK Sr.Software Engineer Hyderabad | India. -- http://mail.python.org/mailman/listinfo/python-list

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Gabriel Genellina
En Fri, 07 Dec 2007 03:01:28 -0300, MonkeeSage <[EMAIL PROTECTED]> escribió: > I've wondered about this myself. Seems to me, to prevent clobbering > subclasses, __iadd__ (and all of the integer and float and whatever) > methods that return new instances, should work like this (obviously I > mean

Re: "Python" is not a good name, should rename to "Athon"

2007-12-06 Thread Patrick Mullen
Monty Python pioneered (or at least pioneered the organized televising of) a form of humor where there is no punchline or reason something is funny, it just is (or isn't). I find about half of it very funny, and the rest very unfunny. I used to find it more hilarious than I do now. It's an extre

Re: Class destructor -- strange behaviour

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 18:51:08 -0300, Spes <[EMAIL PROTECTED]> escribió: > I have this simple code: > | #!/usr/bin/python > | import codecs > | import re > | from copy import deepcopy > | > | class MyClass(object): > | def __del__(self): > | deepcopy(1) > | > | x=MyClass() > > but I get an e

Re: Erros when compiling a CPP program which uses CPython API functions

2007-12-06 Thread grbgooglefan
On Dec 7, 12:32 pm, grbgooglefan <[EMAIL PROTECTED]> wrote: > I am compiling CPP program which uses CPython API functions from > Python 2.5.1 source code > > First I compiled with this commanline, that time I got "pyconfig.h" > not found. > g++ -Os -I../../Include ../../libpython2.5.a -lm -ldl -lpt

Re: "Python" is not a good name, should rename to "Athon"

2007-12-06 Thread James Stroud
Terry Reedy wrote: > "Tóth Csaba" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | > | >> Python name is not funny for me. Even the Monty Python, because its > hard > | >> to translate their jokes, and in my country they are not so popular. The jokes translate just fine in my co

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread MonkeeSage
On Dec 6, 3:02 pm, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > samwyse schrieb: > > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > > just subclass int: > > > class test(int): > > >pass > > > >

weird embedding problem

2007-12-06 Thread DavidM
Hi all, I'm embedding python in a C prog which is built as a linux shared lib. The prog is linked against libpython, and on startup, it calls Py_Initialize(). The prog imports a pure-python script. The script starts up ok, but when it imports the 'math' module, the import fails with: Traceback

Erros when compiling a CPP program which uses CPython API functions

2007-12-06 Thread grbgooglefan
I am compiling CPP program which uses CPython API functions from Python 2.5.1 source code First I compiled with this commanline, that time I got "pyconfig.h" not found. g++ -Os -I../../Include ../../libpython2.5.a -lm -ldl -lpthread -lutil testeval.cpp In file included from testeval.cpp:1: ../../I

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread grbgooglefan
On Dec 7, 12:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 06 Dec 2007 23:27:15 -0300, grbgooglefan <[EMAIL PROTECTED]> > escribió: > > > I want to use Python's Windows (python25.dll) version to embed in my > > C# (or atleast VC++) program for performing syntax checks on the > >

Re: Can I embed Windows Python in C# or VC++?

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 23:27:15 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: > I want to use Python's Windows (python25.dll) version to embed in my > C# (or atleast VC++) program for performing syntax checks on the > Python expressions which are later supposed to be evaluated at runtime > by a

Re: YOU MUST KNOW THIS MAN

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 06:07:26 -0300, Deltantor <[EMAIL PROTECTED]> escribió: > Piet van Oostrum wrote: >>> Deltantor <[EMAIL PROTECTED]> (D) wrote: >> >>> D> Does c.l.python get religious spam that much? Of all of the places >>> to be >>> D> spammed the least likely I expected would be here

Re: Timeout test hangs IDLE

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 08:03:49 -0300, Andreas Tawn <[EMAIL PROTECTED]> escribió: >> There was a strange error when using 'print' & threads. When >> what I printed filled the entire screen, instead of moving >> all the text up, IDLE just hanged. Try running your code from >> the shell instead, to s

Re: Capturing global input?

2007-12-06 Thread MonkeeSage
On Dec 6, 9:16 pm, MonkeeSage <[EMAIL PROTECTED]> wrote: > On Dec 6, 3:51 pm, nomihn0 <[EMAIL PROTECTED]> wrote: > > > I'd like to accept mouse gestures and keyboard shortcuts as input to a > > program. The nature of this program requires that these commands be > > issued regardless of the currentl

Re: Capturing global input?

2007-12-06 Thread MonkeeSage
On Dec 6, 3:51 pm, nomihn0 <[EMAIL PROTECTED]> wrote: > I'd like to accept mouse gestures and keyboard shortcuts as input to a > program. The nature of this program requires that these commands be > issued regardless of the currently active window. Here's the rub: I > need a platform-independent so

Re: Class destructor -- strange behaviour

2007-12-06 Thread MonkeeSage
On Dec 6, 3:51 pm, Spes <[EMAIL PROTECTED]> wrote: > Hi, > > I have this simple code: > | #!/usr/bin/python > | import codecs > | import re > | from copy import deepcopy > | > | class MyClass(object): > | def __del__(self): > | deepcopy(1) > | > | x=MyClass() > > but I get an error: > | Excep

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Terry Reedy
"Aaron Watters" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | While trying to optimize some NUCULAR libraries I discovered | that the best way to merge 2 sorted lists together | into a new sorted list is to just append | them and re-sort. The current version of list.sort (timsort

Thought you would enjoy some funny math cartoons!!!

2007-12-06 Thread craig . snodgrass
I just wanted to share some math cartoons (mathtoons) I put together at http://notsohumblepi.com. I thought you guys might enjoy. I tried to figure out how to make a mathtoon involving Pi in place of Python (like Pi in the middle of a snake) but couldn't get it to work. Anyways, I hope you enjoy.

Re: SimpleXMLRPCServer interruptable?

2007-12-06 Thread Gabriel Genellina
En Thu, 06 Dec 2007 13:11:09 -0300, Bret <[EMAIL PROTECTED]> escribió: > For completeness, what I ended up doing is this: > > server = SimpleXMLRPCServer((host, port)) > server.socket.settimeout(0.1) > > ServerWrapper became: > > def ServerWrapper(): > while True: >

Can I embed Windows Python in C# or VC++?

2007-12-06 Thread grbgooglefan
I want to use Python's Windows (python25.dll) version to embed in my C# (or atleast VC++) program for performing syntax checks on the Python expressions which are later supposed to be evaluated at runtime by another C++ program For this, I would like to use CPython API functions such as Py_Initial

PyImport_ImportModule("foo.bar")

2007-12-06 Thread sndive
I'm trying to import foo.bar in order not to add every single directory with python files to the search path. i immediately follow the import with the PyModule_AddObject call to put the imported module to __main__ module but later on PyEval_EvalCode on Py_CompileString compiled code "foo.bar.baz()

Re: Capturing global input?

2007-12-06 Thread sturlamolden
On 6 Des, 22:51, nomihn0 <[EMAIL PROTECTED]> wrote: > I'd like to accept mouse gestures and keyboard shortcuts as input to a > program. It depends on which GUI toolkit you use. Look in the wxPython, PyGTK, tkinter or pygame documentation. > The nature of this program requires that these command

Re: JSON

2007-12-06 Thread Marc Christiansen
Joshua Kugler <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> i tried a couple python json libraries. i used simplejson on the >> server and was using cjson on the client, but i ran into this issue. >> i'm now using simplejson on both sides, but i'm still interested in >> this issue. d

Re: Python Profiler GUI like Matlab?

2007-12-06 Thread sturlamolden
On 7 Des, 02:58, Davy <[EMAIL PROTECTED]> wrote: > Is there any Python Profiler GUI like Matlab? I found the Matlab > Profiler is very intuitive and easy to use. There is a Python profiler. But is does not have a GUI. -- http://mail.python.org/mailman/listinfo/python-list

Python Profiler GUI like Matlab?

2007-12-06 Thread Davy
Hi all, Is there any Python Profiler GUI like Matlab? I found the Matlab Profiler is very intuitive and easy to use. Best regards, Davy -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite or xml

2007-12-06 Thread tinkerbarbet
On Dec 7, 12:34 am, Kelie <[EMAIL PROTECTED]> wrote: > Thanks Chris, Tim and Yu-Xi. I'll follow your advice and use database. Hi Kelie If you're happy going with sqlite then stick with it. If on the other hand you were considering XML because you're more comfortable with that (e.g. you find XML

Re: which configparse?

2007-12-06 Thread limodou
On Dec 6, 2007 11:49 PM, Shane Geiger <[EMAIL PROTECTED]> wrote: > Best, is naturally, a somewhat subjective evaluation. That being said, > configparser is well regarded. I have also seen these two options that > you might want to check out: > > http://wiki.woodpecker.org.cn/moin/Dict4Ini > http:

Re: Best ways of managing text encodings in source/regexes?

2007-12-06 Thread tinkerbarbet
OK, for those interested in this sort of thing, this is what I now think is necessary to work with Unicode in python. Thanks to those who gave feedback, and to Cliff in particular (but any remaining misconceptions are my own!) Here are the results of my attempts to come to grips with this. Commen

Re: Calculate an age

2007-12-06 Thread thebjorn
On Dec 6, 11:19 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 7, 8:34 am, Pierre Quentel <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I have searched in the standard distribution if there was a function > > to return the difference between 2 dates expressed like an age : > > number of years

Re: using pdb and catching exception

2007-12-06 Thread R. Bernstein
Just checked to see how Ruby deals with this. Both languages allow one to register a trace functon to catch "events" like call, line, return, exception, etc. Ruby however register an event before the raise takes place. It might be cool for some good person to go through the process of making a for

Re: Calculate an age

2007-12-06 Thread Paul McGuire
On Dec 6, 4:19 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 7, 8:34 am, Pierre Quentel <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I have searched in the standard distribution if there was a function > > to return the difference between 2 dates expressed like an age : > > number of years,

Re: Speed of Nested Functions & Lambda Expressions

2007-12-06 Thread Terry Jones
[Referring to the thread at http://mail.python.org/pipermail/python-list/2007-October/463348.html with apologies for top posting (I don't have the original mail)] Duncan Booth wrote: > You can use Python's bytecode disassembler to see what actually gets > executed here: > > >>> def fn_outer(v

Re: sqlite or xml

2007-12-06 Thread Kelie
Thanks Chris, Tim and Yu-Xi. I'll follow your advice and use database. -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm missing something here with range vs. xrange

2007-12-06 Thread Bjoern Schliessmann
Joe Goldthwaite wrote: > I read that the range function builds a list and that xrange > returns an iterator and is therefore more efficient. This is generally not true. > In my testing, they both come out to almost exactly the same > performance wise. Did something get changed in Python 2.4 to

Re: Calculate an age

2007-12-06 Thread John Machin
On Dec 7, 8:34 am, Pierre Quentel <[EMAIL PROTECTED]> wrote: > Hi all, > > I have searched in the standard distribution if there was a function > to return the difference between 2 dates expressed like an age : > number of years, of months and days. The difference between datetime > instances retur

I'm missing something here with range vs. xrange

2007-12-06 Thread Joe Goldthwaite
I've been playing with Python a bit. Doing little performance benchmarks and working with Psyco. It's been fun and I've been learning a lot. For example, in a previous post, I was looking for a way to dynamically add new runtime function to a class. Martin told me to use a class instance variabl

Re: sqlite or xml

2007-12-06 Thread Yu-Xi Lim
Tim Chase wrote: >> how much data is considered to be "large amount"? > > one record > > Unless you really need XML to communicate with some other app via a > predetermined schema, use a database to store and retrieve data. If you > only need to send data to another app via a predetermined sch

Re: sqlite or xml

2007-12-06 Thread Yu-Xi Lim
Tim Chase wrote: >> how much data is considered to be "large amount"? > > one record > > Unless you really need XML to communicate with some other app via a > predetermined schema, use a database to store and retrieve data. If you > only need to send data to another app via a predetermined sch

Class destructor -- strange behaviour

2007-12-06 Thread Spes
Hi, I have this simple code: | #!/usr/bin/python | import codecs | import re | from copy import deepcopy | | class MyClass(object): | def __del__(self): | deepcopy(1) | | x=MyClass() but I get an error: | Exception exceptions.TypeError: "'NoneType' object is not callable" in > ignored The

Capturing global input?

2007-12-06 Thread nomihn0
I'd like to accept mouse gestures and keyboard shortcuts as input to a program. The nature of this program requires that these commands be issued regardless of the currently active window. Here's the rub: I need a platform-independent solution. Java supports with its MouseInfo class, but I'd like

Calculate an age

2007-12-06 Thread Pierre Quentel
Hi all, I have searched in the standard distribution if there was a function to return the difference between 2 dates expressed like an age : number of years, of months and days. The difference between datetime instances returns a timedelta object that gives a number of days, but not an age So is

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Neil Cerutti
On 2007-12-06, samwyse <[EMAIL PROTECTED]> wrote: > And that's my complaint. The value in is being replaced > by something almost, but not quite, identical to the original > value. Python's internal implementation of __iadd__ for > isn't returning , it's returning a new value belonging to > the

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Chris Mellon
On Dec 6, 2007 3:02 PM, samwyse <[EMAIL PROTECTED]> wrote: > > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > samwyse schrieb: > > > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > > just subclass int: > > > > class test(int): > > >pass >

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread samwyse
On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > samwyse schrieb: > > > For whatever reason, I need an inproved integer. Sounds easy, let's > > just subclass int: > > class test(int): > >pass > > > Now let's test it: > > zed=test(0) > zed.__class__ > > >

Re: splitting a words of a line

2007-12-06 Thread John Machin
On Dec 7, 2:21 am, Sumit <[EMAIL PROTECTED]> wrote: > Hi , >I am trying to splitt a Line whihc is below of format , > > AzAccept PLYSSTM01 [23/Sep/2005:16:14:28 -0500] "162.44.245.32 CN= > cojack (890),OU=1,OU=Customers,OU=ISM-Users,OU=kkk > Secure,DC=customer,DC=rxcorp,DC=com" "pl

Re: sqlite or xml

2007-12-06 Thread Tim Chase
> how much data is considered to be "large amount"? one record Unless you really need XML to communicate with some other app via a predetermined schema, use a database to store and retrieve data. If you only need to send data to another app via a predetermined schema, use a database and then

Re: Distutils help for sub-packages

2007-12-06 Thread kyosohma
On Dec 6, 2:37 pm, Rick Muller <[EMAIL PROTECTED]> wrote: > On Dec 5, 7:20 am, [EMAIL PROTECTED] wrote: > > > > > I recommend asking the distutils guys at their list: > > >http://mail.python.org/mailman/listinfo/distutils-sig > > > Mike > > I did, and no one replied there either. Probably because e

Re: sqlite or xml

2007-12-06 Thread Chris
On Dec 6, 10:21 pm, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > If I need store and use a couple thousand of people's contact info: > first name, last name, phone, fax, email, address, etc. I'm thinking > of using either sqlite or xml. Which one is better? My understanding > is if there is

Re: Distutils help for sub-packages

2007-12-06 Thread Rick Muller
On Dec 5, 7:20 am, [EMAIL PROTECTED] wrote: > > I recommend asking the distutils guys at their list: > > http://mail.python.org/mailman/listinfo/distutils-sig > > Mike I did, and no one replied there either. Probably because everyone, there and here, were too polite to say that I was nutso. Which

Re: How can I create customized classes that have similar properties as 'str'?

2007-12-06 Thread samwyse
On Nov 24, 6:38 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > samwyse <[EMAIL PROTECTED]> writes: > > create a hash that maps your keys to themselves, then use the values > > of that hash as your keys. > > The "atom" function you describe already exists under the name > "intern". D'oh! That's wh

Charging range

2007-12-06 Thread Miguel Galves
I was recently approached with a offer to work on a web related project where I'd use Python as my main tool. I am using Python for the past year, and this would be first project. Also, this is a remote position. The company is located in the US, South Atlantic Region. Considering it is contract w

sqlite or xml

2007-12-06 Thread Kelie
Hello group, If I need store and use a couple thousand of people's contact info: first name, last name, phone, fax, email, address, etc. I'm thinking of using either sqlite or xml. Which one is better? My understanding is if there is large amount of data, sqlite would be better as far as speed is

Re: which configparse?

2007-12-06 Thread Neal Becker
Martin Marcher wrote: > Hi, > > On 12/6/07, Neal Becker <[EMAIL PROTECTED]> wrote: >> configparse looks like what I want, but it seems last commit was >2years >> ago. >> >> What is the best choice? > > that seems like configparse is the best choice. Thanks. I see something right off that shou

Re: Capture DOS error???

2007-12-06 Thread Joshua Kugler
Tangen, Erik wrote: > Did you ever get a solution to this? > I am also in need of this solution. > Thanks, > Erik Can you clarify? What is a DOS error? You mean an error in reading or writing a file? That would be an IOError exception. If a file is not found, or you can't read it, that's an O

Re: JSON

2007-12-06 Thread Joshua Kugler
[EMAIL PROTECTED] wrote: > i tried a couple python json libraries. i used simplejson on the > server and was using cjson on the client, but i ran into this issue. > i'm now using simplejson on both sides, but i'm still interested in > this issue. did i do something wrong? is there a bug in one of

Re: which configparse?

2007-12-06 Thread Joshua Kugler
Shane Geiger wrote: > Best, is naturally, a somewhat subjective evaluation. That being said, > configparser is well regarded. I have also seen these two options that > you might want to check out: > > http://wiki.woodpecker.org.cn/moin/Dict4Ini > http://www.voidspace.org.uk/python/configobj.htm

Re: which configparse?

2007-12-06 Thread Martin Marcher
Hi, On 12/6/07, Neal Becker <[EMAIL PROTECTED]> wrote: > configparse looks like what I want, but it seems last commit was >2years > ago. > > What is the best choice? that seems like configparse is the best choice. I use it quite often and no commit in >2years to me means "Boy that's stable softwa

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Neil Cerutti
On 2007-12-06, Aaron Watters <[EMAIL PROTECTED]> wrote: > On Dec 6, 2:14 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-12-06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: >> > See recipes: >> >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285 >> >http://aspn.activestate.com/AS

Determining Dependencies

2007-12-06 Thread Greg Lindstrom
Hello All- I have a Python routine consisting of 75 or more files (most files house 1 object) and would like to know if there is an automated way to search though the files and determine all of the (non-standard lib) modules required to run the routine. For example, looking in my base class I can

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Aaron Watters
On Dec 6, 2:14 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > > See recipes: > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/491285 > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305269 > > That's fairly awesome. T

Re: pipeline encoding

2007-12-06 Thread Peter Otten
Tomek Toczyski wrote: > Diez B. Roggisch: > >> >> Python tries and guesses the stdout-encoding based on the terminal >> settings. So the first print works. >> >> However, piping to a file means that it can't do so, because it doesn't >> (and shouldn't) make any assumptions on the output encodin

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Neil Cerutti
On 2007-12-06, Neil Cerutti <[EMAIL PROTECTED]> wrote: > It should beat ResortEverything consistently once the lists > become larger than a certain size. Do you get better results at > all with the above function? With psyco, my merge_sorted becamse faster than relying on timsort at roughly 80 ele

Re: pipeline encoding

2007-12-06 Thread Rob Wolfe
Tomek Toczyski <[EMAIL PROTECTED]> writes: > Are there any command line option for telling python what encoding to > use for stdout? > > To be honest I have a more complicated program than the example that I > have presented - there are many print commands inside and it is not > very feasible for

Re: pipeline encoding

2007-12-06 Thread Martin v. Löwis
> Are there any command line option for telling python what encoding to > use for stdout? Not a command line option. However, you can wrap sys.stdout with a stream that automatically performs an encoding. If all your print statements output Unicode strings, you can do sys.stdout = codecs.getwrite

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Neil Cerutti
On 2007-12-06, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Dec 6, 9:30 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > >> While trying to optimize some NUCULAR libraries I discovered >> that the best way to merge 2 sorted lists together >> into a new sorted list is to just append >> them and r

Re: __iadd__ useless in sub-classed int

2007-12-06 Thread Diez B. Roggisch
samwyse schrieb: > For whatever reason, I need an inproved integer. Sounds easy, let's > just subclass int: > class test(int): > pass > > Now let's test it: > zed=test(0) zed.__class__ > zed > 0 > > So far, so good. Now let's try incrementing: > zed+=1 ze

Re: pipeline encoding

2007-12-06 Thread Diez B. Roggisch
Tomek Toczyski schrieb: > Diez B. Roggisch: > >> >> Python tries and guesses the stdout-encoding based on the terminal >> settings. So the first print works. >> >> However, piping to a file means that it can't do so, because it >> doesn't (and shouldn't) make any assumptions on the output encodi

__iadd__ useless in sub-classed int

2007-12-06 Thread samwyse
For whatever reason, I need an inproved integer. Sounds easy, let's just subclass int: >>> class test(int): pass Now let's test it: >>> zed=test(0) >>> zed.__class__ >>> zed 0 So far, so good. Now let's try incrementing: >>> zed+=1 >>> zed 1 >>> zed.__class__ WTF??! Is this a bug

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Raymond Hettinger
On Dec 6, 9:30 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > While trying to optimize some NUCULAR libraries I discovered > that the best way to merge 2 sorted lists together > into a new sorted list is to just append > them and re-sort. . . . > I'm beginning to think > a "sorted list merger" mi

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Neil Cerutti
On 2007-12-06, Aaron Watters <[EMAIL PROTECTED]> wrote: > ...is to forget they are sorted??? > > While trying to optimize some NUCULAR libraries I discovered > that the best way to merge 2 sorted lists together > into a new sorted list is to just append > them and re-sort. The following test case

Re: Best way to merge/sort two sorted lists?...

2007-12-06 Thread Robin Becker
Aaron Watters wrote: > ...is to forget they are sorted??? code snipped Aaron I just flung your python merge code into pyrex and the results show that the iteration overhead can be brought down without much effort. The real deal would presumably be to start using pointers into the result list rat

logging.py: mutiple system users writing to same file getting permission errors.

2007-12-06 Thread evenrik
An a redhat box I have root, apache and other normal users run code that uses the logging module to write to the same log file. Since umasks are set to 2 or 022 this gets permission errors. I have fixed my issue by patching the logging code everywhere there is an open for write with: try: old

Re: An Object's Type

2007-12-06 Thread Bruno Desthuilliers
Hrvoje Niksic a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> > writes: > > >>So ask yourself: in which way will the final result be different >>from would very probably happens without the "typecheking code" ? In >>*both* cases, you end up with a runtime exception. > > The idea behind such

Re: pipeline encoding

2007-12-06 Thread Tomek Toczyski
Diez B. Roggisch: > > Python tries and guesses the stdout-encoding based on the terminal > settings. So the first print works. > > However, piping to a file means that it can't do so, because it doesn't > (and shouldn't) make any assumptions on the output encoding desired - > after all, it migh

ANNOUNCE: Resolver One public Beta now live

2007-12-06 Thread giles . thomas
We're proud to announce that today Resolver One, our flagship application, entered its public Beta phase. It can be downloaded from (free registration required), and we would very much welcome feedback from the Python community. Resolver One is a Rapid A

Capture DOS error???

2007-12-06 Thread Tangen, Erik
Did you ever get a solution to this? I am also in need of this solution. Thanks, Erik -- http://mail.python.org/mailman/listinfo/python-list

Re: pipeline encoding

2007-12-06 Thread Rob Wolfe
Tomasz Toczyski <[EMAIL PROTECTED]> writes: > My locale is set to UTF-8. The command: > python -c "print u'\u03A9'" > gives me the desired result and doesn't produce any error. > > But when I want to redirect the output to a file I invoke: > python -c "print u'\u03A9'" > file.txt > I get an error:

Re: pipeline encoding

2007-12-06 Thread Diez B. Roggisch
Tomasz Toczyski schrieb: > My locale is set to UTF-8. The command: > python -c "print u'\u03A9'" > gives me the desired result and doesn't produce any error. > > But when I want to redirect the output to a file I invoke: > python -c "print u'\u03A9'" > file.txt > I get an error: > > File "", line

Re: New subclass vs option in __init__

2007-12-06 Thread Bruno Desthuilliers
Kurt Smith a écrit : > Hi List: > > Class inheritance noob here. > > For context, I have the following base class and subclass: > > class Base(object): > def __init__(self, val): > self.val = val > > class Derived1(Base): > def __init__(self, val): > super(Derived1, self

Re: "Python" is not a good name, should rename to "Athon"

2007-12-06 Thread Bruno Desthuilliers
Boris Borcic a écrit : > Piet van Oostrum wrote: > >>> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote: >> >> >>> AC> For that matter C# is no better, I thought that # was pronounced >>> AC> hash, I still refer to C# as C-hash. >> >> >> Are you musically illiterate? > > > Note that the notat

Re: An Object's Type

2007-12-06 Thread Chris Mellon
On Dec 6, 2007 5:52 AM, paul <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers schrieb: > > [EMAIL PROTECTED] a écrit : > >> Hi, > >> > >> Is it possible to find out if an object is of a certain type or of a > >> type derived from this type? > >> > > You have the answer, thanks to Diez and Christian

Best way to merge/sort two sorted lists?...

2007-12-06 Thread Aaron Watters
...is to forget they are sorted??? While trying to optimize some NUCULAR libraries I discovered that the best way to merge 2 sorted lists together into a new sorted list is to just append them and re-sort. The following test case demonstrates this. It can be criticized in many ways: it only tests

pipeline encoding

2007-12-06 Thread Tomasz Toczyski
My locale is set to UTF-8. The command: python -c "print u'\u03A9'" gives me the desired result and doesn't produce any error. But when I want to redirect the output to a file I invoke: python -c "print u'\u03A9'" > file.txt I get an error: File "", line 1, in UnicodeEncodeError: 'ascii' codec c

New subclass vs option in __init__

2007-12-06 Thread Kurt Smith
Hi List: Class inheritance noob here. For context, I have the following base class and subclass: class Base(object): def __init__(self, val): self.val = val class Derived1(Base): def __init__(self, val): super(Derived1, self).__init__(val) I'm curious as to other's thou

JSON

2007-12-06 Thread belred
i tried a couple python json libraries. i used simplejson on the server and was using cjson on the client, but i ran into this issue. i'm now using simplejson on both sides, but i'm still interested in this issue. did i do something wrong? is there a bug in one of the libraries? or something i don

Re: "Python" is not a good name, should rename to "Athon"

2007-12-06 Thread Hertha Steck
Boris Borcic wrote: > Piet van Oostrum wrote: >>> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote: >> >>> AC> For that matter C# is no better, I thought that # was pronounced >>> AC> hash, I still refer to C# as C-hash. >> >> Are you musically illiterate? > > Note that the notation for the n

Re: SimpleXMLRPCServer interruptable?

2007-12-06 Thread Bret
On Dec 6, 7:04 am, Bret <[EMAIL PROTECTED]> wrote: > On Dec 5, 10:00 pm, Edward Kozlowski <[EMAIL PROTECTED]> wrote: > > > > > On Dec 5, 10:19 pm, Edward Kozlowski <[EMAIL PROTECTED]> wrote: > > > > On Dec 5, 6:22 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Wed, 05 Dec 2007 18:2

Re: multidimensional "arrays"

2007-12-06 Thread Jeremy Sanders
Horacius ReX wrote: > do you know how to do similar but in two dimensions ? Investigate the numpy module if you are dealing with numbers. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: An Object's Type

2007-12-06 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > So ask yourself: in which way will the final result be different > from would very probably happens without the "typecheking code" ? In > *both* cases, you end up with a runtime exception. The idea behind such type checks is to make sure type erro

Re: which configparse?

2007-12-06 Thread Shane Geiger
Best, is naturally, a somewhat subjective evaluation. That being said, configparser is well regarded. I have also seen these two options that you might want to check out: http://wiki.woodpecker.org.cn/moin/Dict4Ini http://www.voidspace.org.uk/python/configobj.html > I have all my options setup

Re: multidimensional "arrays"

2007-12-06 Thread Remco Gerlich
Hi, DATA = [ [ 0 for i in range(ncolumns) ] for i in range(nrows) ] Is one way. DON'T do it like this: row = [0] * ncolumns data = [ row ] * nrows # WRONG! Since after that, every row is the exact same object; if you set data[0][0] = 1, the first element of _every_ row is 1. But I guess you a

Re: SimpleXMLRPCServer interruptable?

2007-12-06 Thread Bret
On Dec 6, 7:04 am, Bret <[EMAIL PROTECTED]> wrote: > On Dec 5, 10:00 pm, Edward Kozlowski <[EMAIL PROTECTED]> wrote: > > > > > On Dec 5, 10:19 pm, Edward Kozlowski <[EMAIL PROTECTED]> wrote: > > > > On Dec 5, 6:22 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Wed, 05 Dec 2007 18:2

Re: multidimensional "arrays"

2007-12-06 Thread bearophileHUGS
Horacius ReX: > do you know how to do similar but in two dimensions ? >>> nr = 3 >>> nc = 4 >>> [[None] * nc for _ in xrange(nr)] [[None, None, None, None], [None, None, None, None], [None, None, None, None]] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

multidimensional "arrays"

2007-12-06 Thread Horacius ReX
in python, when I want to use arrays, I follow this way; DATA = [0] * nint and when I want to use I do; DATA[i] = do you know how to do similar but in two dimensions ? thanks -- http://mail.python.org/mailman/listinfo/python-list

which configparse?

2007-12-06 Thread Neal Becker
I have all my options setup with optparse. Now, I'd like to be able to parse an ini file to set defaults (that could be overridden by command line switches). I'd like to make minimal change to my working optparse setup (there are lots of options - I don't want to duplicate all the cmdline parsing

  1   2   >