Dr. Dobb's Python-URL! - weekly Python news and links (Dec 25)

2004-12-25 Thread Josiah Carlson
QOTW: Python, the language that wraps tightly around a problem and swallows it whole. -- Raymond Hettinger Because it is so important, this link is re-posted for the future (originally appeared in the December 15 Python-Url! posting by Cameron Laird): Martin Bless summarizes in an

Execute code after death of all child processes - (corrected posting)

2004-12-25 Thread Markus Franz
Hallo! I have a problem with this little script written in Python: import sys, os, time texts = ['this is text1', 'this is text 2'] for current_text in env_sources[0:]: pid = os.fork() if pid == 0: time.sleep(2) print current_text break As you is create some child processes depending

Re: Optional Static Typing - Haskell?

2004-12-25 Thread Alex Martelli
Donn Cave [EMAIL PROTECTED] wrote: ... | making a really modular system work with static typing and inferencing | is probably impossible; in practice, the type inferencer must examine | all code, or a rather copious summary of it... it can't really work | module by module in a nice, fully

Features for a Python package manager?

2004-12-25 Thread Georg Brandl
Hello c.l.py, what features would you expect of a Python package manager, similar to CPAN or rubygems? I am currently planning to write such a thing, at first privately for myself, and if it's proving useful, I think about releasing it. I plan to model it after gentoo's portage, with less

Re: Lambda going out of fashion

2004-12-25 Thread Andrew Dalke
Benji York wrote: They do two different things. I think you have a spurious * in the call to apply. The apply above is equivalent to D'oh! This cold has definitely made me error prone the last couple of days. Yesterday I managed to leave my cell phone in my pants pocket along with a couple

Re: Optional Static Typing

2004-12-25 Thread gabriele renzi
Mike Meyer ha scritto: John Roth [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote in message This may sound a bit cynical, but most real uber-programmers have either Lisp or Smalltalk in their backgrounds, and frequently both one. Neither of those languages have static typing, and they simply

Re: Lambda going out of fashion

2004-12-25 Thread Andrew Dalke
Terry Reedy wrote: Ok, add 'assuming that func and args are a valid callable and sequence respectively.' Error messages are not part of the specs, and may change for the same code from version to version. While true, the difference in error messages suggests that the two approaches use

Re: Features for a Python package manager?

2004-12-25 Thread Nick Coghlan
Georg Brandl wrote: Hello c.l.py, what features would you expect of a Python package manager, similar to CPAN or rubygems? I am currently planning to write such a thing, at first privately for myself, and if it's proving useful, I think about releasing it. I've contemplated such a beast myself,

Re: Lambda going out of fashion

2004-12-25 Thread Nick Coghlan
Python 2.4 interactive session: Py class Blah: ... def __iter__(self): ... yield Test ... Py args = Blah() Py apply(len, args) Traceback (most recent call last): File stdin, line 1, in ? TypeError: apply() arg 2 expected sequence, found instance Py len(*args) 4 Py class Blah(object): ...

Re: Multiple Inheritance __slots__ problem

2004-12-25 Thread Craig Ringer
On Fri, 2004-12-24 at 20:07, Nitin Shukla wrote: Hello, Can anyone tell why am I getting this error and how to work around this problem. class Klass(object): ... __slots__ = ( 'x' ) ... class Klass1(object): ... __slots__ = ( 'y' ) ... class Klass(Klass, Klass1): ...

Re: Clearing the screen

2004-12-25 Thread Craig Ringer
On Sat, 2004-12-25 at 07:43, Ishwor wrote: On 24 Dec 2004 15:33:26 -0800, Lars [EMAIL PROTECTED] wrote: Hi Iswor, If I understand you correctly then your program is writing output to a console/terminal window and you want to clear that window. I don't know of any library methods for

Re: Lambda going out of fashion

2004-12-25 Thread Andrew Dalke
Nick Coghlan wrote: And you're right, there is a behavioural difference - apply() expects a real sequence, whereas the extended function call syntax accepts any iterable. However, there's also a bug in your demo code: I guess I must be getting over this cold -- I'm only 1/2 wrong this time.

Re: Execute code after death of all child processes - (corrected posting)

2004-12-25 Thread Jeff Epler
First, you'll want to exit from each forked copy, or else it will reach the code-after-the-for-loop: import sys, os, time texts = ['this is text1', 'this is text 2'] for current_text in texts[0:]: pid = os.fork() if pid == 0: time.sleep(2) print

Re: Optional Static Typing

2004-12-25 Thread Rahul
I am assuming that optional type checking is being added for easier debugging only. So if 'expects' are turned on , python raises warnings(which do not halt the system) but not when they are turned off. These will enable easier debugging for new people while not affecting masters. Also,perhaps, it

Re: Keyword arguments - strange behaviour?

2004-12-25 Thread Steven Bethard
Fuzzyman wrote: It wasn't that part of the example that I thought was over complex. (although it's not a 'pattern' I use often). You suggested that if we had dynamic evaluation of default values, you would have to replace it with : class foo(object): matcher=re.compile(r'...') def

Re: Python To Send Emails Via Outlook Express

2004-12-25 Thread David Fraser
[EMAIL PROTECTED] wrote: Hey guys, I'm just thankful the answer has been found and hope this helps someone else. To everyone (especially Lenard) that responded to my request for help, thank you!! Merry Christmas everyone!!! God bless Ian Thanks Ian, Why not post this to the python-win32 mailing

Re: Read word tables

2004-12-25 Thread Christian Tismer
Rameshwari wrote: Hi, I would like to read a ms-word document using python. Basically the word document contains number of tables and the rows in each table do not have same number of columns. If you have Office Professional Edition 2003, you can save your Word files in XML format. Then, you can

Dr. Dobb's Python-URL! - weekly Python news and links (Dec 25)

2004-12-25 Thread Josiah Carlson
QOTW: Python, the language that wraps tightly around a problem and swallows it whole. -- Raymond Hettinger Because it is so important, this link is re-posted for the future (originally appeared in the December 15 Python-Url! posting by Cameron Laird): Martin Bless summarizes in an

Re: How about pure virtual methods?

2004-12-25 Thread Noam Raphael
Mike Meyer wrote: That's what DbC languages are for. You write the contracts first, then the code to fullfill them. And get exceptions when the implementation doesn't do what the contract claims it does. mike Can you give me a name of one of them? This is a very interesting thing - I

Re: IDLE problem :-(

2004-12-25 Thread Ishwor
On Sat, 25 Dec 2004 17:45:02 GMT, Steven Bethard [EMAIL PROTECTED] wrote: Ishwor wrote: I don't know if this has been a problem with other people using IDLE but when i press the home key then the cursor jumps to the beginning of the line and not after the prompt. If google prints the right

Re: IDLE problem :-(

2004-12-25 Thread Ishwor
Sorry IDLE's source ...;P [snip] -- cheers, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list

Re: Python To Send Emails Via Outlook Express

2004-12-25 Thread ian
Hi David, I'd be happy to post it to python-win32 but don't know how. Ian -- http://mail.python.org/mailman/listinfo/python-list

Tinkering with py2exe

2004-12-25 Thread Ishwor
Having coded 1.72kb python test file, i decided to convert it to .exe file using py2exe. Having succeded doing it, i found the need to distribute the whole directory including these files ?!!!??? 26/12/2004 09:16 AM 203,096 library.zip 26/11/2004 09:16 AM 1,867,776 python24.dll

Non blocking read from stdin on windows.

2004-12-25 Thread barr
Hi Can any one help. I am trying to write a python scipt that takes input as args and/or as piped input ( possibly the output of another program). I want to read stdin ( the piped in stuuff ) whcih might be empty without the script blocking if it is empty. I understand it is possible to do

Re: How about pure virtual methods?

2004-12-25 Thread Noam Raphael
Thank you very much for this answer! I learned from you about unit tests, and you convinced me that testing oriented programming is a great way to program. You made me understand that indeed, proper unit testing solves my practical problem - how to make sure that all the methods which should

Re: Non blocking read from stdin on windows.

2004-12-25 Thread Noam Raphael
You can always have a thread which continually reads stdin and stores it in a string, or better, in a cStringIO.StringIO object. Then in the main thread, you can check whether something new has arrived. This, of course will work on all platforms. I hope this helped a bit, Noam --

Re: Improving Python (was: Lambda going out of fashion)

2004-12-25 Thread Aahz
In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: (I've said it before, and I'll say it again: native unicode and generators are the only essential additions I've seen since 1.5.2, with properties and sub-classable C types sharing a distant third place. the rest of the stuff

Re: Tinkering with py2exe

2004-12-25 Thread John Machin
Ishwor wrote: Having coded 1.72kb python test file, i decided to convert it to .exe file using py2exe. Having succeded doing it, i found the need to distribute the whole directory including these files ?!!!??? 26/12/2004 09:16 AM 203,096 library.zip 26/11/2004 09:16 AM

Re: Clearing the screen

2004-12-25 Thread Scott David Daniels
Nick Coghlan wrote: Jeff Epler wrote: I don't know about idle, but the real python supports the PYTHONSTARTUP environment variable. I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just started using PYTHONSTARTUP to switch the standard prompt from '' to Py'). I believe

Complementary language?

2004-12-25 Thread HackingYodel
Hello all! I'm learning to program at home. I can't imagine a better language than Python for this. The ideal situation, for me, would be to study two languages at the same time. Probably sounds crazy, but it works out better for me. Being a newbie, I find almost all languages

Re: Clearing the screen

2004-12-25 Thread Ishwor
On Sun, 26 Dec 2004 01:47:42 GMT, Steven Bethard [EMAIL PROTECTED] wrote: Scott David Daniels wrote: Nick Coghlan wrote: Jeff Epler wrote: I don't know about idle, but the real python supports the PYTHONSTARTUP environment variable. I just tried it - IDLE ignores PYTHONSTARTUP,

Re: Clearing the screen

2004-12-25 Thread Ishwor
heres the shell i forgot to show PythonWin 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) - see 'Help/About PythonWin' for further copyright information. clear.cls() [40 more lines of \n] -- cheers, Ishwor

Re: Mutable objects which define __hash__ (was Re: Why are tuples immutable?)

2004-12-25 Thread Nick Coghlan
Bengt Richter wrote: I take it you are referring to regular python dictionaries, Correct. So I'll skip over the sections talking about alternate lookup strategies in my reply. Anyway, what are the consequences of a type which has a 'variable hash'? The only real bad consequence is that the

WxListBox

2004-12-25 Thread LutherRevisited
wxpython.org's onlinedocs are down right now so bear with me. Here's my problem, currently I'm using a wxtextctrl to enter output in, I'm running out of rows with the wxtextctrl so I thought to use a listbox like I would in another language. I'm unsure how it is constructed or how to add items

Re: Complementary language?

2004-12-25 Thread Nick Coghlan
HackingYodel wrote: Hello all! I'm learning to program at home. I can't imagine a better language than Python for this. The ideal situation, for me, would be to study two languages at the same time. Probably sounds crazy, but it works out better for me. Being a newbie, I find almost all

Re: Clearing the screen

2004-12-25 Thread John Machin
Ishwor wrote: i was just tinkering with it actually. ;-) In your command prompt just do Pythonwin.exe /run C:\Python24\file\PyFiles\clear.py It's not a very good idea to store your own scripts in the PythonXY directory -- other than tested working modules which you install in

Re: Complementary language?

2004-12-25 Thread LutherRevisited
I'm a big fan of C# myself, it kinda takes the good from C++ and Java and combines them in a way. -- http://mail.python.org/mailman/listinfo/python-list

Re: Clearing the screen

2004-12-25 Thread Ishwor
On 25 Dec 2004 18:20:39 -0800, John Machin [EMAIL PROTECTED] wrote: Ishwor wrote: i was just tinkering with it actually. ;-) In your command prompt just do Pythonwin.exe /run C:\Python24\file\PyFiles\clear.py It's not a very good idea to store your own scripts in the PythonXY

Re: Clearing the screen

2004-12-25 Thread Ishwor
On Sun, 26 Dec 2004 13:07:56 +1030, Ishwor [EMAIL PROTECTED] wrote: On 25 Dec 2004 18:20:39 -0800, John Machin [EMAIL PROTECTED] wrote: Ishwor wrote: i was just tinkering with it actually. ;-) In your command prompt just do Pythonwin.exe /run C:\Python24\file\PyFiles\clear.py

Re: Optional Static Typing - Haskell?

2004-12-25 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: Mind you, I personally _like_ the concept of describing an interface separately, even in a different language (Corba's IDL, say) that's specialized for the task. But it doesn't seem to be all that popular... without such separation, modularity plus

Re: Best GUI for small-scale accounting app?

2004-12-25 Thread McBooCzech
Sorry to bother, but I didn't find the final answer to the question what is the Best GUI for small-scale accounting app? I am the newbie in Python, so I am trying to find some usable GUI as well. But it looks to me there is a lot developers, beta-versions, tools etc. I have spent a lot of time

Re: Features for a Python package manager?

2004-12-25 Thread Mike Meyer
Nick Coghlan [EMAIL PROTECTED] writes: I don't know enough about Portage to answer that question. I do know any package manager which made it into the standard distribution would need to work for at least the big three platforms (Windows/Mac/*nix) :) Being written in python - and hopefully

Re: Best GUI for small-scale accounting app?

2004-12-25 Thread Paul Rubin
McBooCzech [EMAIL PROTECTED] writes: I am the newbie in Python, so I am trying to find some usable GUI as well. But it looks to me there is a lot developers, beta-versions, tools etc. I have spent a lot of time trying to find which is the best one tool. But now it looks more confusing to me

Re: Complementary language?

2004-12-25 Thread Haibao Tang
At home I almost use python exclusively, the other two languages I can be productive is C# and C++, I chose C# because I am a Windows programmer (don't throw tomato at me, I am no troll..) and I choose C++ because the algorithm was implemented in this dialect in school. --

Re: How about pure virtual methods?

2004-12-25 Thread Mike Meyer
Noam Raphael [EMAIL PROTECTED] writes: Mike Meyer wrote: That's what DbC languages are for. You write the contracts first, then the code to fullfill them. And get exceptions when the implementation doesn't do what the contract claims it does. mike Can you give me a name of one of

Re: How about pure virtual methods?

2004-12-25 Thread Mike Meyer
Noam Raphael [EMAIL PROTECTED] writes: The current Python doesn't really support this concept. You can write in the __new__ of such a class something like if cls == MyAbstractClass: raise TypeError, but I consider this as a patch - for example, if you have a subclass of this class which is

Re: Complementary language?

2004-12-25 Thread Robert Kern
HackingYodel wrote: Hello all! I'm learning to program at home. I can't imagine a better language than Python for this. The ideal situation, for me, would be to study two languages at the same time. Probably sounds crazy, but it works out better for me. Being a newbie, I find almost all

Jython IronPython Under Active Development?

2004-12-25 Thread Haibao Tang
This question may be a bit weird but I really want to know if these two hybrid projects are still active. -- http://mail.python.org/mailman/listinfo/python-list

Re: Optional Static Typing

2004-12-25 Thread Robert Kern
Luis M. Gonzalez wrote: I don't understand why this discussion on optional static typing came up right at this moment. As far as I know, it has been discussed many times in the past, and there even was a SIG that simply died... but it seems that it never was something of much interest to python

Re: gridbaglayout

2004-12-25 Thread Grant Edwards
On 2004-12-24, Ishwor [EMAIL PROTECTED] wrote: heh? whats this gridbaglayout in Python-list?? Is this what my grandpa calls christmas fever?? ;-) heh? what's this top-posting in comp.lang.python? gridbagsizer is a wxPython/wxWidgets sizer class. Why shouldn't it be discussed here? -- Grant

list addition methods compared.

2004-12-25 Thread Ishwor
Hi all I have just wrote a small script to compare the speed of list addition methods. heres what it looks like. #listadditioncompare.py #compare the speeds of 3 different type of list element addition import time def method(TYPE): l1 = []; l2 = []; l3 = []; if TYPE == 1:

Re: Features for a Python package manager?

2004-12-25 Thread Robert Kern
Mike Meyer wrote: Nick Coghlan [EMAIL PROTECTED] writes: I don't know enough about Portage to answer that question. I do know any package manager which made it into the standard distribution would need to work for at least the big three platforms (Windows/Mac/*nix) :) Being written in python -

WxListBox

2004-12-25 Thread LutherRevisited
I'm wanting to put a listbox in the place of a textctrl I'm using in my application because I'm running out of space in my textctrl. The online documentation is down at wxpython.org so I have no idea how to construct this control or anything. Can someone help me out. Here's what I'm doing with

A Revised Rational Proposal

2004-12-25 Thread Mike Meyer
This version includes the input from various and sundry people. Thanks to everyone who contributed. mike PEP: XXX Title: A rational number module for Python Version: $Revision: 1.4 $ Last-Modified: $Date: 2003/09/22 04:51:50 $ Author: Mike Meyer [EMAIL PROTECTED] Status: Draft Type:

methods of addition in Python

2004-12-25 Thread Ishwor
As my earlier mail didn't make it c.l.py because it had the heading LIST Addition compared, probably it was blocked by the mail server. ;-) anyway heres it again.. Sorry for people reading it again. Its the same post. Hi all I have just wrote a small script to compare the speed of list addition

Twisted Non-Admin Installation

2004-12-25 Thread Kartic
Hello, I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. The installer, when executed under my login, fails as it requires administrator rights to install (why they have it as a requirement, I don't understand). So I started the installer as the admin user. That too failed because

Re: Twisted Non-Admin Installation

2004-12-25 Thread Kartic
BTW, I googled using some keywords and found nothing that would solve my problem. I could also not find a searchable version of the twisted mailing list. -- http://mail.python.org/mailman/listinfo/python-list

Re: Twisted Non-Admin Installation

2004-12-25 Thread Mike Meyer
Kartic [EMAIL PROTECTED] writes: Hello, I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. The installer, when executed under my login, fails as it requires administrator rights to install (why they have it as a requirement, I don't understand). So I started the installer as

Re: Twisted Non-Admin Installation

2004-12-25 Thread Kartic
Thanks. Does this mean I have to upgrade python 2.3.3 to python 2.4 in order to get this working? -- http://mail.python.org/mailman/listinfo/python-list

Re: Complementary language?

2004-12-25 Thread Hal Rosser
HackingYodel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all! I'm learning to program at home. I can't imagine a better language than Python for this. The ideal situation, for me, would be to study two languages at the same time. Probably sounds crazy, but it works out

Configuration Files

2004-12-25 Thread Aaron
Hi, I'm interested in creating a large number of configuration files which I have no experience doing in python. The fields will be static for the most part. But design changes and I might want to add new fields in the future.. My question is - whats the best module for creating, reading, and

Re: Jython IronPython Under Active Development?

2004-12-25 Thread Robert Kern
Simon John wrote: Haibao Tang wrote: This question may be a bit weird but I really want to know if these two hybrid projects are still active. they're both by the same guy, and i think jython just had a new release, although i expect ironpython will turn into microsoft visual python.net instead

WxButton

2004-12-25 Thread LutherRevisited
I have a simple application in a Frame, in it I have a button that I want to press when I hit enter. How can I do this? I know with textctrl's you have the EVT_TEXT_ENTER event to do things for you when enter is pressed, can I do the same with a button. I know in WxWidgets for C++ you can put

double post

2004-12-25 Thread LutherRevisited
I think I did a double post on WxListBox, my apologies, I wasn't seeing it show up and I didn't take into account the holidays...sorry. -- http://mail.python.org/mailman/listinfo/python-list

Please Donate to the PSF

2004-12-25 Thread Stephan Deibel
Hi, As the holiday season ends and a new year approaches, I would like to take this opportunity to thank everyone that donated to the Python Software Foundation (PSF) in the past. Everyone's support is greatly appreciated. We now have well over 400 donors, many of whom donate regularly:

Re: Configuration Files

2004-12-25 Thread M.E.Farmer
Aaron wrote: Hi, I'm interested in creating a large number of configuration files which I have no experience doing in python. The fields will be static for the most part. But design changes and I might want to add new fields in the future.. My question is - whats the best module for

Re: Twisted Non-Admin Installation

2004-12-25 Thread Mike Meyer
Kartic [EMAIL PROTECTED] writes: Thanks. Does this mean I have to upgrade python 2.3.3 to python 2.4 in order to get this working? Whoops. Yeah, the instruction are for using MSVC 7.1, which is what 2.4 is build with. 2.3.x is built with MSVC 6.x. That's no longer even commercially available.

Re: Configuration Files

2004-12-25 Thread M.E.Farmer
Here are two functions that show how to use ConfigParser. pydef ConfigWrite(key, value, section, cfgpath): ... import ConfigParser, pprint ... parser=ConfigParser.ConfigParser() ... cfg = open(cfgpath,'w') ... parser.add_section(section) ... Pretty =

Re: Features for a Python package manager?

2004-12-25 Thread Georg Brandl
Robert Kern wrote: Mike Meyer wrote: Nick Coghlan [EMAIL PROTECTED] writes: I don't know enough about Portage to answer that question. I do know any package manager which made it into the standard distribution would need to work for at least the big three platforms (Windows/Mac/*nix) :)