asincero wrote:
Is there anyway to catch the following type of bug in Python code:
message = 'This is a message'
if some_obscure_condition:
nessage = 'Some obscure condition occured.'
print message
In the above example, message should be set to 'Some obscure condition
occured.' if
Steven D'Aprano wrote:
I came across an interesting (as in the Chinese curse) problem today. I
had to modify a piece of code using generator expressions written with
Python 2.4 in mind to run under version 2.3, but I wanted the code to
continue to use the generator expression if possible.
Steven Bethard wrote:
David Rasmussen wrote:
Harald Armin Massa wrote:
Dr. Armin Rigo has some mathematical proof, that High Level Languages
like esp. Python are able to be faster than low level code like
Fortran, C or assembly.
Faster than assembly? LOL... :)
I think the claim goes
Tuvas wrote:
I am trying to write a thread that will execute a function every 2
seconds until the program is close, in which case it will stop. I can
write the program easy enough to execute the command every 2 seconds,
the problem comes when I try to close the program. It won't close the
Mike Pippin wrote:
How would I have an app run with just a system tray Icon??? any help
would be greatly appreciated. I have no clue where to start.
Choose a GUI toolkit, e.g. wxPython.
--
http://mail.python.org/mailman/listinfo/python-list
Tuvas wrote:
I am in the process of writing an extention module, and am coming up
with lots of problems.
This isn't a direct answer to your question, but what sort of extension is it?
Do you need to actually write a Python extension?
I ask because I've all but stopped writing Python extension
KraftDiner wrote:
if I create an object like...
obj = None
...
obj = anObject()
can obj set itself to none in some method of the class?
No - Python doesn't work that way.
What are you trying to accomplish? There's probably a way to do what you need
to
do, but this isn't it.
-Dave
--
KraftDiner wrote:
Well I guess what I'm trying to achive is the invalidate the instance
of the object.
I have been using None to denote an invalide or uninitialized instance
of an object.
There is a degenerate case in my code where a polygon has less than 3
points and
I want to class to
Steve M wrote:
Here is an article discussing the coding style of BitTorrent.
http://www.onlamp.com/pub/a/python/2003/7/17/pythonnews.html
Maybe that code is worth looking at.
[didn't read this thread or that article until I saw the summary in Dr.
Dobb's Python-URL]
FWIW, the BitTorrent code
Stefano Masini wrote:
I wonder how many people (including myself) have implemented their own
versions of such modules, at least once in their pythonic life. I
indeed have my own odict (even same name! :). My own pathutils
(different name, but same stuff). My own validate... and so forth.
Alex Le Dain wrote:
What is the best way to access a Pervasive database on another machine?
Hi Alex,
You can use ODBC / ADO to access Pervasive DBs. I found this page helpful:
http://www.mayukhbose.com/python/ado/index.php
-Dave
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
Ruby just doesn't interest me that much though (maybe I'm missing
something).
I don't think you are. My impression is that if you've never used Python or
Ruby, you'll generally end up liking whichever of the two you really discover
first (since the common case is that you're
Daniel Bickett wrote:
He would read the documentation of Nevow, Zope, and Quixote, and would
find none of them to his liking because:
* They had a learning curve, and he was not at all interested, being
eager to fulfill his new idea for the web app. It was his opinion that
web programming
[EMAIL PROTECTED] wrote:
I've been reading the beloved Paul Graham's Hackers and Painters.
He claims he developed a web app at light speed using Lisp and lots
of macros.
It got me curious if Lisp
is inherently faster to develop complex apps in. It would seem if you
could create your own
D H wrote:
Peter Hansen wrote:
D H wrote:
Peter Hansen wrote:
Bo Peng wrote:
Actually that's just one possible answer. Whether it's _the_ answer is
obviously again a matter of opinion, and as usual we differ.
Quit being such an idiot and refuting everything I say. The answer is
simply no,
[EMAIL PROTECTED] wrote:
Hi All
I'm busy writing a python p2p program and would like some advice.
I'm pushing about 300k/s and would like to know if there are any python
tricks I could pull to speed things up. I'm thinking about unrolling
some of the loops and recuding calls to my custom
Michael wrote:
sorry, I'm used to working in c++ :-p
if i do
a=2
b=a
b=0
then a is still 2!?
so when do = mean a reference to the same object
Always.
and when does it mean make a copy of the object??
Never.
-Dave
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
Dave Brueck [EMAIL PROTECTED] writes:
What do you use for HTTPS?
m2crypto (plus some patches to make asynchronous SSL do what we needed).
That seems to be a nice piece of code, but it's still at version 0.13;
Version numbers are fairly relative, though. In another
Paul Rubin wrote:
Dave Brueck [EMAIL PROTECTED] writes:
One thing from your experience that did resonate with me is that,
except for ftplib and occasionally urllib (for basic, one-shot GETs),
we don't use any of the standard library's protocol modules - partly
because we had to implement our
Paul Rubin wrote:
Kay Schluehr [EMAIL PROTECTED] writes:
To answer Your initial question: there is probably no technical reason
against Python as a language or the CPython runtime. Both are very
stable and mature.
I'd like to agree with this but I just can't. Python is a great
language for
john67 wrote:
The company I work for is about to embark on developing a commercial
application that will cost us tens-of-millions to develop.
[snip]
Right now it looks like Java is the language of choice that the app
will be developed in. However, I have been looking and reading a lot
about
EHP wrote:
Python has good database support, it works well on a wide range of
platforms, and it's great at tying together different processes, machines,
etc. - for example, it's fairly easy to get Python to access C code,
dynamic libraries, system APIs, and external programs. It's easier to test
George Sakkis wrote:
Personally, although I find nothing comes close to the clarity and
flexibility that python offers, in this case I would go with java, if
for nothing else, to be on the safe side. Think about it: if the
project fails (and that's quite likely for huge projects, not dark
One tip: make sure your three top-level scripts are as empty as
possible: just import some other module and call a function. All
your active code is then in some library.zip shared between the
three, and you need never change alice.exe, bob.exe, and carol.exe
I think I understand what you're
Will McGugan wrote:
I'm writing an app that downloads images. It rejects images that are
under a certain size - whithout downloading them completely. I've
implemented this using PIL, by downloading the first K and trying to
create a PIL image with it. PIL raises an exception because the
Grant Edwards wrote:
On 2005-05-17, Jonas Melian [EMAIL PROTECTED] wrote:
I'm going to say a suggestion, why don't you create a forum
like the one of Ruby (http://www.rubyforums.com/)? for the
novices this is a great help, better than a mail list
[snip]
But I think that a forum is great for the
Luis P. Mendes wrote:
I have a 1000 line python script that takes many hours to finish. It is
running with six inside 'for' loops.
Hi Luis,
Before going too much into optimizing your current code, you might want to take
a step back and see if another approach to your problem might work
[EMAIL PROTECTED] wrote:
I'm busy with a large application and feel it would eas my work if I
can specify dependencies on the granularity of packages, rather than
modules and classes. Eg:
- By convention I do the one class per file thing. SO in python this
means one class per module -
Eric Nieuwland wrote:
The app I'm working on keeps getting new transforms and I'm tired of
adding them by hand. So here it goes:
Can anyone provide me with clues/examples/references on how to create a
plug-in framework?
The biggest task is defining the interface between your app and the
Roel Schroeven wrote:
Simon Brunning wrote:
...
Not that it really matters, but does anybody know why the weekly Python
news always arrives twice? Does it only happen to me, or does it happen
to others too?
It's not that it irritates me or anything, I'm just being curious.
I just thought it was
Dan wrote:
I have a python script running under Windows XP that I need to
terminate from the keyboard. A control-c works fine under Linux, but
not under Windows. I'm pretty sure that the culprit is 'select' that
I'm using to multiplex socket i/o, which seems to be blocking the
keyboard
Terry Reedy wrote:
I guess I don't understand some people's determination to not have users
install fully useable Python on their Windows machines.
[snip]
To put it another way, needing a Python interpreter to run .py files is no
different from, for instance, needing a movie player to run .mpg
Thomas Heller wrote:
Dave Brueck [EMAIL PROTECTED] writes:
Terry Reedy wrote:
If there is something about the default install of Python on Windows
that makes it less desireable or less easy than other platforms,
then maybe that can be fixed. To make installation easier, maybe
someone could write
Tim Tyler wrote:
Like C, Python seems to insist I declare functions before calling
them - rather than, say, scanning to the end of the current script
when it can't immediately find what function I'm referring to.
Yes and no. Yes, they have to exist before you can use them (that only makes
sense),
Dan wrote:
On Thu, 7 Apr 2005 21:52:11 -0500, [EMAIL PROTECTED] wrote:
Python strings always carry their length, and can have embedded NULs.
s.write(\0\1\2\3)
should write 4 bytes to the socket 's'.
I'm taking binary data from a database, so it's not really a Python
string. Is there an easy
Fuzzyman wrote:
Dave Brueck wrote:
By futile I meant that, if the code ends up running on a user's
machine, then
a sufficiently motivated person could crack it wide open, regardless
of
implementation language - the only way to truly protect the code is
to never let
it out of your hands (i.e. it's
Fuzzyman wrote:
Dave Brueck wrote:
It's certainly something lot's of people are interested in. I guess it
depends who your audience is. If ytour code isn't for *mass*
distribution - the chances of people putting a lot of effort into
breaking it are greatly reduced. I don't htink it's necessarily
Jiri Barton wrote:
I'd like to be able to distribute some python modules of my system (plugins)
without the source. So far, I have done this by including only the *.pyc
files. However, I have recently found they are platform dependent and
python version dependent.
This approach has been very
[EMAIL PROTECTED] wrote:
The following script does not behave as expected. I wanted to terminate
the 'mythread' thread after 5 seconds.
What I see is the threading.Thread call blocking until the 15 second
sleep is done. Suggestions?
[snip]
foo = FooClass()
mythread =
Warren Postma wrote:
1. Downloaded the windows binary for python 1.5.2 from python.org.
Pygame uses Python 1.5.2 still!? :-) Oi.
Nah, must have been a typo, as www.pygame.org lists Windows installers for
Python 2.2, 2.3, and 2.4:
http://www.pygame.org/download.shtml
-Dave
--
Jorgen Grahn wrote:
On Tue, 22 Feb 2005 20:38:28 -0500, Tom Willis [EMAIL PROTECTED] wrote:
How are the expert pythoneers dealing with config files?
...
Any ideas?
How about writing them in Python?
Depending on who will be editing the config files, this can be a great
approach.
At the simplest
Tom Willis wrote:
On Fri, 25 Feb 2005 15:02:04 -0700, Dave Brueck
How about writing them in Python?
Depending on who will be editing the config files, this can be a great approach.
[snip]
I actually thought of this, and I was kind of on the fence due to the
intended audience.
I don't think it's
Artificial Life wrote:
urllib2 does not seem to be able to handle META-REFRESH in an html
document. I just get back the html to the page that is supposed to forward
me to the intended page.
Right - urllib2 is for working with protocols (like HTTP) to transfer data,
whereas META-REFRESH is an
Tor Erik Sønvisen wrote:
From my Python-program I spawn a new process. When using P_NOWAIT spawnl
returns the pid but in windows it returns a process handle.
Later I want to kill this process. How can I do this when I only have the
process handle?
Try ctypes - if it's really a Windows handle,
John Willems wrote:
Interesting GUI developments, it seems. Anyone developed a Ajax
application using Python? Very curious
thx
(Ajax stands for:
XHTML and CSS;
dynamic display and interaction using the Document Object Model;
data interchange and manipulation using XML and XSLT;
asynchronous
Chris Cioffi wrote:
I'd like to second this one...ZODB is *extremely* easy to use. I use
it in projects with anything from a couple dozen simple objects all
the way up to a moderately complex system with several hundred
thousand stored custom objects. (I would use it for very complex
systems as
Donn Cave wrote:
Quoth Dave Brueck [EMAIL PROTECTED]:
...
| Another related benefit is that a lot of application state is implicitly and
| automatically managed by your local variables when the task is running in a
| separate thread, whereas other approaches often end up forcing you to think
Mike Meyer wrote:
[EMAIL PROTECTED] (Aahz) writes:
In article [EMAIL PROTECTED], Mike Meyer [EMAIL PROTECTED] wrote:
Here here. I find that threading typically introduces worse problems
than it purports to solve.
Threads are also good for handling blocking I/O.
Actually, this is one of the
Peter Hansen wrote:
Martin v. Löwis wrote:
Peter Hansen wrote:
For the rest of the computer world, unless I've missed
a changing of the guard or something, kilo is 1024
and mega is 1024*1024 and so forth...
In case this isn't clear yet: you have missed a changing
of the guard or something. kibi is
Steve Holden wrote:
Paul Rubin wrote:
Skip Montanaro [EMAIL PROTECTED] writes:
It's more than a bit unfair to compare Wikipedia with Ebay or
Google. Even though Wikipedia may be running on high-performance
hardware, it's unlikely that they have anything like the underlying
network structure
Fredrik Lundh wrote:
Tim Daneliuk wrote:
THis is why, IMHO, things like SOAP a laughable - RPC is a poor
foundation for reliable, durable, and high-performance TP. It might be
fine for sending an order or invoice now and then, but sustained through-
put of the sort I think of as high performance
Brent W. Hughes wrote:
I'm running Windows XP and I'm using winamp to listen to internet radio
stations. Occasionally, an annoying commercial will come on. I would like
to write a Python program that, when run, will, in essence, push on winamp's
mute button. Then, after say 20 seconds, it
[EMAIL PROTECTED] wrote:
I was trying to write an asyncronous TCP server for win32 using
WSAEventSelect (which lives if win32file). Such events require
WaitForMultipleObjects (which lives if win32event) and
WSAEnumNetworkEvents WHICH IS NOT EXPOSED. This makes WSAEventSelect
useless. Does somebody
Roland Heiber wrote:
i recently migrated from mysql to postgresql and did use severel python
postgres-modules. All do what they are designed for, so which one would
you use? psycopg, pygresql, pypgsql? psycopg seems to be the best
solution for heavy traffic/multiple connections i have no
Peter Hansen wrote:
paritosh mahana wrote:
How can I call python code from my C# code.
[snip]
You could use ctypes or the pywin32 package to provide your
Python code with an ActiveX interface. Then you could just
use it via COM, like any other COM object. Lots of references
available via Google
torment wrote:
[snip]
Have you tried just parsing the output from the command ipconfig?
It's pretty obvious from the output that might give you if a connection
is availible.
It's tempting to use ipconfig's output, but the info it gives you is unreliable
- you can incorrectly infer the presence of
Istvan Albert wrote:
Doug Holton wrote:
application is so important that I expect Python 3000 will have
optional type declarations integrated into the argument list.
I think that *optional* part of the optional type declaration
is a myth.
It may be optional in the sense that the language will
Roman Suzi wrote:
On Tue, 4 Jan 2005, Dave Brueck wrote:
It may be optional in the sense that the language will
accept missing declarations but as soon as the feature
is available it will become mandatory to use it
(peer pressure, workplace practices).
What about generic programming coming
Roman Suzi wrote:
The term generic programming is too... er... generic. :)
Nope. It is not generic. It has it's definition made by the co-author
of STL - A.Stepanov. And the Boost C++ library (many of us know it as
Boost Python) standardise on the approach, AFAIK.
Ok, too broad then; Python
59 matches
Mail list logo