On 31 Jan 2007 08:23:57 -0800, Frank Potter <[EMAIL PROTECTED]> wrote:
>I want to find a multithreaded downloading lib in python,
>can someone recommend one for me, please?
>Thanks~
There are no threads, but perhaps http://jcalderone.livejournal.com/24285.html
would be interestin
x27;t just leave the space blank after if statement because there will be
>error message.
>
>Does anybody know what to insert there?
http://python.org/doc/tut/node6.html#SECTION00650
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
end one for me, please?
>> > Thanks~
>>
>> Why do you want to use threads for that? Twisted is the
>> obvious solution for your problem,
>
>Overkill? Just to download a few web pages? You've got to be
>kidding.
Better "overkill" (whatever that
On Wed, 31 Jan 2007 13:52:35 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>> On 31 Jan 2007 12:24:21 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
>>
>>> Michele Simionato wrote:
>>>
>>&g
On Wed, 31 Jan 2007 15:13:59 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>> [snip]
>>>
>>>
>>
>> You're right. Learning new things is bad. My mistake.
>>
>> Jean-Paul
>>
On Wed, 31 Jan 2007 17:19:07 -0800, "Carl J. Van Arsdall" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>> On Wed, 31 Jan 2007 15:13:59 -0800, "Carl J. Van Arsdall" <[EMAIL
>> PROTECTED]> wrote:
>>
>>> Jean-Paul Calderone
On 31 Jan 2007 19:12:59 -0800, Aahz <[EMAIL PROTECTED]> wrote:
>In article <[EMAIL PROTECTED]>,
>Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>>
>>You misunderstand. I wasn't expressing a lack of confidence in Python
>>threads, but in the faci
ress bar in Tkinter using threads is
>definitely less obvious than running
>an iterator in the main loop, as I discovered the hard way. Writing a
>facility to run iterators in Twisted
>is a three-liner, but it is not already there, nor standard :-(
>
Have you seen the recently introd
On 1 Feb 2007 06:14:40 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
>On Jan 31, 3:37 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On 31 Jan 2007 12:24:21 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
>>
>> >Michele Simionato wrote:
>> >>
On 1 Feb 2007 06:41:56 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
>On Feb 1, 9:20 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On 1 Feb 2007 06:14:40 -0800, Carl Banks <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> >On Jan 31, 3:37 pm, Jean
every asyncore-based server can be shut down more
or less at the whim of the public internet. Doesn't that problem merit some
attention (maybe it doesn't, I don't know - that's why I'm asking)?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
estion asked, it
isn't really a correct answer overall. I hope no one actually
goes off and does this. Doing so will result in completely
unportable code with very difficult to track down bugs.
Instead, use the str and unicode methods "encode" and "decode".
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
m "ascii" to "utf-8"?
You don't need to change the default encoding. You just need to encode
the unicode string you are sending to the child process. Try:
tokenized_text, errs = tokenize.communicate(t.encode('utf-8'))
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 05 Feb 2007 10:19:26 +0100, Laurent Pointal <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] a écrit :
>> When they have to ...
>>
>> One of the big things about Python is that its penetration slows it
>> down. There's more legacy code and interdependant systems around now
>> that Python is mo
ses which haven't happened yet, but that
remains to be seen. And 3.0 won't be "largely compatible" with any _existing_
2.x release, but hopefully a future 2.x release will add a usable transition
path.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 05 Feb 2007 17:07:15 +0100, Laurent Pointal <[EMAIL PROTECTED]> wrote:
>Jean-Paul Calderone a écrit :
>> On Mon, 05 Feb 2007 10:19:26 +0100, Laurent Pointal
>> <[EMAIL PROTECTED]> wrote:
>>> [EMAIL PROTECTED] a écrit :
>>>> When they have to
On 6 Feb 2007 04:45:35 -0800, Ben Sizer <[EMAIL PROTECTED]> wrote:
>On Feb 5, 4:15 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> It's very easy to maintain compatibility in the C API. I'm much more
>> interested in compatibility at the Python layer,
On Tue, 06 Feb 2007 08:40:40 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote:
>Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> > Huge amounts of my pure Python code was broken by Python 2.5.
>
>Interesting. Could you give a few illustrations of this? (I didn't r
on-send-region
Command: Send the region to the inferior Python process.
python-send-region-and-go
Command: Send the region to the inferior Python process.
python-send-string
Command: Evaluate STRING in inferior Python process.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ke this, instead..
struct.pack('!IIL', len(buffer), count, offset) + buffer
Then it is a simple matter to unpack it once the receiving side, by waiting
for struct.calcsize('!IIL') bytes, using struct to get len(buffer), count,
and offset:
length, count, offset = str
ts for a password. It thought i
>> > could solve this by using popen2.
>>
>> Use pexpect:http://pexpect.sourceforge.net/
>
>pexpect could work. But a better way would be to supply the password
>on the command line.
So that it shows up in `ps' output to anyone on the system? :)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On 8 Feb 2007 09:18:26 -0800, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>On 8 feb, 13:29, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On 8 Feb 2007 08:23:49 -0800, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>> >On 8 feb, 10:27, Maël Benjam
ven some existing Python applications which deal with
sound and manage to work with ~20ms samples.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ode' with value 'print "${rc}".'
print rc
print dir(rc)
print type(rc)
help(rc)
http://python.org/doc/tut/
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
by that
attribute does not exist, then the finally suite will execute before
f has been bound, and the UnboundLocalError will mask the real error.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
uot; or "AUX.csv", but
it requires special spelling. I don't remember the details at present,
but presumably if you are interested you can dig it up on MSDN.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
on't.
I think some people are confused that the language "Python 3.x" has "Python"
in its name, since there is already a language with "Python" in its name,
with which it is not compatible.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 17 Feb 2007 02:17:23 +1100, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>On Fri, 16 Feb 2007 09:49:03 -0500, Jean-Paul Calderone wrote:
>
>> On Sat, 17 Feb 2007 01:32:21 +1100, Steven D'Aprano
>>> [snip]
>>>
>>>I don't think that f
On Fri, 16 Feb 2007 16:49:05 +0100, BJörn Lindqvist <[EMAIL PROTECTED]> wrote:
>On 2/16/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>>I was just pointing out that some people might be confused. I didn't make
>>any judgement about that fact. You seem to be
colorIndex = 0
def test():
print colorIndex
test()
[EMAIL PROTECTED]:~$ python foo.py
0
[EMAIL PROTECTED]:~$
The global keyword lets you rebind a variable from the module scope. It
doesn't have much to do wi
On Tue, 20 Feb 2007 18:12:42 -0600, alf <[EMAIL PROTECTED]> wrote:
>Hi,
>is there a more elegant way to do that:
>
>''.join([chr(ord(i)) for i in u'11\xa022' ])
>
u'11\xa022'.encode('charmap')
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ere are quite a
few available already. Most likely, at least one of them is suitable for your
application.
Here are a couple starting points:
http://twistedmatrix.com/projects/core/documentation/howto/plugin.html
http://peak.telecommunity.com/DevCenter/setuptools#dynamic-discovery-of-service
mation.
>>> import someplugins
>>> dir(someplugins)
['__builtins__', '__doc__', '__file__', '__name__', '__path__']
>>>
Hey, where's my plugin?
This most trivial test would have demonstrated the
ing logic. I'd never seen it before
in a deamonizer either, but it caught my eye in this one. I haven't had time
to investigate further though. I hope Eirikur will explain. :)
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ng
like what's being done here:
http://twistedmatrix.com/trac/browser/trunk/twisted/conch/scripts/conch.py#L361
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
to specify which DNS server
software needs to be reconfigured. You might also want to include an example
of what kind of change you want to make. For example, do you want to add
and delete records? Do you want to change the address of associated with
an existing A record? Are all your chan
;ffile = open('c:/test/wuppnt.shp', 'r')
Perhaps the problem is that you did not open the file in binary mode here?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
idle.
The T1000 isn't a very good machine for general server purposes. It has
advantages when running software with a lot of hardware-level parallelism,
but Zope isn't such a piece of software.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
t;, maybe even some of the PostgreSQL-specific features
>(such as e.g. composite types)?
storm supports composite primary keys. I'm not sure if it supports
composite foreign keys, but I suspect it does. It's also pretty good
overall.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
)
> self.context.set_source_rgb(1, 0, 0)
> self.context.rectangle(0, 00, 50, 50)
> self.context.fill()
>
>Box.draw() draws a red box, all fine. But, I *also* want it to output the
>actual commands within the draw def to the console (or a file).
See inspect.getsource().
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
me. This problem appeared deep inside a
>complicated code and it took me almost two days to track down what was going
>on...
Lots of people ask about this. The behavior you observed is the expected
(by the implementors, anyway) behavior.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
run()
This doesn't have the bug your version has (where it randomly drops some
data on the floor) and handles multiple clients.
Check it out: http://twistedmatrix.com/
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ch:
>>> def f():
... x = 10
... def g():
... a = x
... return g
...
>>> f().func_closure
(,)
>>>
I don't know what your use-case is, so I have no idea if this is the
kind of solution you're looking for.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
le blocks (those to which a pointer was found) are not shown.
>==27082== To see them, rerun with: --show-reachable=yes
>
>A lot of those 713 errors occur in the various deallocation functions.
>
Did you use the suppression file?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
d habits they aquired.
>
+1 QOTW
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ogram ends immediately after the call to
>connect()--even though my server program does not call accept():
>
Your platform's TCP implementation acknowledges the connection attempt
before your application calls accept(). This is fairly usual.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ally get the local address which will be used for traffic
to a particular host by getting ready to send traffic to it with a UDP
socket:
>>> from socket import socket, SOCK_DGRAM, AF_INET
>>> s = socket(AF_INET, SOCK_DGRAM)
>>> s.connect(('google.com
x.com/trac/report
And drop by #twisted on irc.freenode.net to chat about some tasks you
might be able to tackle.
Twisted development involves code review for all changes, so this would
be a guaranteed way to get feedback on your work.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
print(buf.readLine());
Here, you tried you read a line from the socket. The peer never sent a
whole line though, so readLine will never succeed.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
n extending Python?
You misunderstand how parameters are passed in Python:
>>> x = 10
>>> def foo(y):
... y = y + 1
...
>>> foo(x)
>>> x
10
>>>
So there's no behavior here to attempt to emulate when embedding or extending.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
w
>where in all the world I keep references to that class? Thus it would
>essentially have to scan all references to anything, all list contents,
>all class-properties, all everything. Which is not feasible.
Who says it isn't feasible?
http://twistedmatrix.com/trac/browser/trunk/twisted/python/rebuild.py
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e geared towards special cases,
>not a general-purpose "now reloading really works" implementation.
>
What special cases? I won't argue that it works for every case, but the
failure modes are really defined by special cases in Python, not the
other way around. Maybe that
itions. It has other bugs as well, such as not
checking the return value of socket.send().
Here's a different echo example:
http://twistedmatrix.com/projects/core/documentation/examples/#auto0
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ly on everything always going right all the time.
Even if you stick with the socket module, you should make sure to handle
exceptions from socket calls and always check the return value of the
send method.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
gestions?
>
There's Twisted Names. I wrote a custom DNS server with it just last week.
The documentation is a bit sparse, but it's not particularly complicated.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
;t say if the Linux server was local or not. If local, you could use
>SAMBA to create a SMB share and have the XP PC get to it that way. There are
>other ways, but these should get you started.
>
>-Larry
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ld.so.conf, and they
>won't be. Our IT dept. controls this, and won't make them normally
>accessible for me.
>
>So, how do i steer ctypes towards these libs? Let's say this is one of
>them:
>
>/home/me/otherLibs/libgaak.so.6
>
This generally work
d of this is the behavior above. I'm guessing its a bug.
>
__builtins__ is "a CPython implementation detail". In other words, unless
you are doing really funny stuff, you shouldn't use it.
What you're probably looking for is the __builtin__ module (difference in
spell
If
you have a proxy which requires authentication, you must authenticate
after you have established the connection by sending bytes over the socket.
I don't know what kind of proxy you have, so I don't know what bytes you
have to send.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
classes).
You don't need metaclasses. You do need a wrapper around the list
so that you can intercept calls to __setitem__ (and whatever else)
which are made onto it.
You might also consider making Body new-style (subclass object) and
using a property instead of a __setattr__ implementation. You still
need a wrapper, but the implementation of the rest of the feature
should be simpler.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 21 Dec 2007 09:49:51 -0800 (PST), Mangabasi <[EMAIL PROTECTED]> wrote:
> [snip]
>
>Hi Jean-Paul,
>
>Sorry, I should have spelled this out in my post but I did not. For
>several reasons I do not wish to couple the pos object with the Body
>instances. In my case,
On Fri, 21 Dec 2007 10:30:31 -0800 (PST), Mangabasi <[EMAIL PROTECTED]> wrote:
>On Dec 21, 1:11 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On Fri, 21 Dec 2007 09:49:51 -0800 (PST), Mangabasi <[EMAIL PROTECTED]>
>> wrote:
>> > [snip]
>&g
developed with Twisted in my blog:
http://jcalderone.livejournal.com/10572.html
http://jcalderone.livejournal.com/10988.html
You can find examples of using these APIs in Twisted Conch's examples:
http://twistedmatrix.com/projects/conch/documentation/examples/
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
hich will probably be rendered as
"sword" on their terminal, which would be pretty confusing).
>> >
>> > buf += self.read()
>> >
>> > I'm suspecting that Gmud doesn't send '\x08', since from looking at some
>> > old DIKU code,
>> > I see that the if '\n' || '\r' are there as well, but there is no check
>> > for '\x08'. If this is indeed
>> > the cause of my problem, how would I go about doing it?
It sounds to me as though the cause of the problem lies elsewhere.
Twisted includes a rather complete telnet implementation (as well as an SSH
implementation and a VT102 implementation). You may want to take a look at it,
either to use for your server, or at least to see the correct way to gather
input from your clients.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
far as security goes, no obvious problems jump out at me, either
from the API for from skimming the code. I think early-binding
__new__, __getstate__, and __setstate__ may be going further than
is necessary. If someone can find code to set attributes on classes
in your process space, they can probably already do anything they
want to your program and don't need to exploit security problems in
your serializer. On the other hand, early-binding may lead to
confusing bugs, albeit only in nasty cases where people are expecting
changes they make to class objects to have an effect on every part
of the system.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ated :)
>
This depends on platform details. For example, some Linux distros include
/etc/network/if-up.d/ which can contain arbitrary programs which will be
run after an interface is brought up.
Other platforms may have other ways to get notification of this event, or
they may require you to poll
sn't exist in main() line 1. If I 'import
>driver' from the command line, then getattr(driver, ...) works, but
>it's not bound here.
>
>Is there any way around this? Can I somehow scope the 'current
>module' and give getattr(...) an object that will (at run time) have
>the appropriate bindings?
How about doing "import driver" and then using "getattr(driver, ...)"?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
y, you'll be able to do the
imports you want to do and they'll work just how you expected them to
work.
This isn't a complete description of Python's import system, but it should
be enough to solve this problem you're having, and provide a good grounding
for further learning.
Hope this helps,
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
cial case for generators? If you just pass the
object in question to iter(), instead, then you'll either get back
something that you can iterate over, or you'll get an exception for
things that aren't iterable.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 22 Jan 2008 15:15:43 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>
>> On Tue, 22 Jan 2008 14:20:35 +0100, "Diez B. Roggisch"
>> <[EMAIL PROTECTED]> wrote:
>>>For a simple greenlet/tasklet/mic
On Tue, 22 Jan 2008 15:52:02 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]>
wrote:
>Jean-Paul Calderone wrote:
>
> [snip]
>>
>> Sorry, I still don't understand. Why is a generator different from any
>> other iterator?
>
>Because you can u
d.addCallback(self._cbReadFile, files, directory)
>d.addErrback(self._ebRaeadFile, files, directory)
You typo'd the errback method name above. This doesn't cause the problem
you're having, though.
There appears to be a bug in FX_EOF handling in filetransfer.py
Hello,
I'm a student at UCL Belgium and I have to write a paper about reflection
and introspection in Python.
It is somewhat difficult to find advanced information about reflection in
Python, not only introspection but also the other sides of reflection.
I'm using the book: "Programming Python, T
close to a perfect language...
That'd be pretty great, certainly. Work on the JIT is continuing and
some PyPy developers have expressed some optimism about having something
which is faster than CPython by the end of this year.
Still, I'd be using PyPy for things today if it had the extension m
a request for a piece of syntax.
>
>Besides, it's butt-ugly IMHO. But taste comes after proper definition...
It's properly defined. Not that I'm endorsing this or anything. I'd
rather not see half-assed syntax proposals at all, even if they're super
great (and some of the syntax that's made it into Python is much worse
than this).
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
gt;
>http://cython.org/
>
It's a not-quite-Python-to-C compiler. I don't think it is an optimizing
compiler either. Can you provide a reference for this?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
an object
and an attribute name.
@contextmanager
def redirect(fileholder, filename, newfile):
orig = getattr(fileholder, filename)
setattr(fileholder, filename, newfile)
yield
setattr(fileholder, filename, orig)
with redirect(sys, 'stdout', open('st
On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker <[EMAIL PROTECTED]> wrote:
>Is there a simple way to use a 'with' statement to redirect stdout in a
>block?
Do you mean "without writing a context manager to do the redirection"?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 11 Feb 2008 09:38:34 -0500, Neal Becker <[EMAIL PROTECTED]> wrote:
>Jean-Paul Calderone wrote:
>
>> On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker <[EMAIL PROTECTED]>
>> wrote:
>>>Is there a simple way to use a 'with' statement to redirect
fer, and I'm not sure how they ever would...
>
> [snip]
>
/: 27723000K free, 15817232K available
It's common for some space to be reserved and only usable by the superuser.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
in h:
>print >>stdout, k,'=',`v`
>k=start_response("200 OK", [('Content-Type','text/plain')])
>for x in range(1, 100):
>k(str(x))
>time.sleep(1)
>return [stdout.getvalue()]
You can do this, but notice that you use up a thread (or a process) for
each client by doing so. This means you'll be limited to a fairly small
number of concurrent clients.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
ould almost do full-dulex HTTP
>communications, and ready-to-use server & client event-based code
>library?
There are a number. Two based on Twisted:
Athena - http://divmod.org/trac/wiki/DivmodNevow/Athena
python-cometd - http://svn.xantus.org/shortbus/trunk/cometd-twisted/
(I
On Thu, 21 Feb 2008 14:50:50 +0800, hawk gao <[EMAIL PROTECTED]> wrote:
>Is there any python lib for NAT transversal?
Divmod Vertex is such a library (it does a few other things as well), but
it is not nearly complete and has little documentation.
http://divmod.org/trac/wiki/DivmodVer
n, then all of the telnet
command sequences will be handled separately from the application data.
It might help if you share some of your code.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
use Windows'
asynchronous I/O APIs is with threads. Actually, it is possible (and Twisted
allows you) to use these as well without writing a threaded application.
Perhaps you think it would be better to use them with threads, but that's
certainly not the _only_ way to use them as you implied.
'connection from',addr
>cSocketlock=thread.allocate_lock()
>thread.start_new_thread(sendData,(cSocket,))
>thread.start_new_thread(getData,(cSocket,))
>if p==0:
>sSocket.close()
>
>
>
>In the above program, why there is an unhandeled exception ???
Just a guess. You should really include the traceback when you ask a
question like this.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t
>tell for sure. It would be nice if someone more knowledgeable can
>compare and contrast these two appraches.
Another difference is that when you import a module, its code is (usually)
only executed once. Each import after the first just returns a reference
to the already-created module object. When you use execfile, the code is
re-evaluated each time.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
which isn't so much of a difference. A
bigger obstacle is the availability of third-party extension modules
which currently must be re-implemented in order to be available on PyPy.
This could easily take half a decade without a full-time or otherwise
concerted effort.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
nge(20) if i % 2)
>print sum(nums)
>
Sure, it can be. That doesn't mean it will be. Someone has to do it. :)
One reason attention is going to PyPy instead of Psyco is that PyPy's JIT
doesn't require as much careful attention to support and maintain support
for features l
d the output. Otherwise, the process's stdout fills up
and its write attempt eventually blocks, preventing it from continuing.
If you use Twisted's process API instead, the reading will be done for
you (without any of the race conditions that are likely when using the
subprocess module), and things will probably "just work".
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
might be to put two-tuples
of the thread identifier and some other object. eg
queue.put((threadID, obj))
Perhaps you can accomplish your goal that way, or perhaps a minor
variation would be more suitable.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
mk wrote:
Hello everyone,
I looked for it I swear, but just can't find it.
Most Python books seem to focus on examples of how to call functions
from standard library. I don't need that, I have online Python
documentation for that.
IMHO, you don't need an advanced *python* book. If you kno
Feature? the output of below Hello program he0.py started from command
line looks as follows:
F:\prompt>he0.py
Hello
F:\prompt>
'Hello' was sent with sys.stdout.write, so "without newline".
But why cannot be output (more logically):
F:\prompt>he0.py
HelloF:\prompt>
Is it normal? Is there any mean
true, Windows automatically adds a newline after the program output.
But maybe there is a workaround?
When you launch x.bat containing no char, windows adds a newline after
the program output.
But when you launch x.bat finishing with at least one CRLF, windows does
not add a newline after the progr
a piece of software. The specification isn't
swallowing the error, some piece of software is. What WSGI container are
you using?
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
e crazy accident, another exception gets
raised, Python will take care of reporting it to the user, and it will
do so with far more information - information that will make your job of
debugging the problem vastly easier.
values = MovingAvg(fname)
values.extrfromfile()
values.calc_sma(smalen = 10)
(reslist, smalist, maxval) = values.return_results()
gp = GnuplotWrapper(smalist, maxval)
gp.plot()
The most significant thing missing from this code is unit tests. Developing
automated tests for your code will help you learn a lot.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 23 Jan 2009 16:57:16 +0100, mk wrote:
Jean-Paul Calderone wrote:
The most significant thing missing from this code is unit tests.
Developing automated tests for your code will help you learn a lot.
Thanks for all the remarks, I'll restructure my code. Probably the biggest
mi
ne of them might find it that not everything is
defined in the module exists when it tries to use it.
What makes you say this? There is an import lock (beyond the GIL) which
should prevent a thread from ever seeing a partially initialized module.
Jean-Paul
--
http://mail.python.org/mailman/lis
On Fri, 23 Jan 2009 22:49:34 +0100, Christian Heimes wrote:
Jean-Paul Calderone schrieb:
BTW, if you ever find you are starting to write multi-threaded
applications
then you'll really regret it if you reuse code which does imports from
inside functions. If two or more threads try to imp
ge the code page
active in the console
(<http://technet.microsoft.com/en-us/library/bb490874.aspx>). I've never tried
this myself, though.
Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list
1001 - 1100 of 1970 matches
Mail list logo