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
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
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
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
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
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
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
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,
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):
...
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):
...
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
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.
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
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
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
[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
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
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
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
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
Sorry IDLE's source ...;P
[snip]
--
cheers,
Ishwor Gurung
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
--
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
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
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
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
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,
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
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
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
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
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
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
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
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
[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
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
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
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
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.
--
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
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
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
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
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
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
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:
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 -
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
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:
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
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
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
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
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
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
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
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
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
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
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:
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
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.
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 =
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) :)
69 matches
Mail list logo