Re: Problem with writing fast UDP server

2008-11-20 Thread Jean-Paul Calderone
On Fri, 21 Nov 2008 00:20:49 -0200, Gabriel Genellina <[EMAIL PROTECTED]> wrote: En Thu, 20 Nov 2008 14:24:20 -0200, Krzysztof Retel <[EMAIL PROTECTED]> escribió: On Nov 20, 4:00 pm, [EMAIL PROTECTED] wrote: On 20 Nov, 16:03, Krzysztof Retel <[EMAIL PROTECTED]> wrote: > I am struggling writing

Re: Extract CDATA Node

2009-02-24 Thread Jean-Paul Calderone
simpler ways, though, based on other XML libraries. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: "Battleship" style game

2009-02-25 Thread Jean-Paul Calderone
the `unittest´ module in the standard library and take things to the next level. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: EOL for sys.stdin.readline() and raw_input()

2009-02-26 Thread Jean-Paul Calderone
ch an implementation would deal with the fact that telnet encodes \r as \r\0 for you. Twisted includes a telnet implementation, as well as facilities for reading stdin asynchronously (which will let you avoid indefinite hangs). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I know when a sub-process is effectively initialized?

2009-02-26 Thread Jean-Paul Calderone
dy. The parent then just waits for those bytes. It looks like you entirely control the child in this case, so that should be possible here. Alternatively, maybe by "properly initialized" you mean something very specific about how subprocess.Popen creates processes. If so

Re: EOL for sys.stdin.readline() and raw_input()

2009-02-26 Thread Jean-Paul Calderone
On Thu, 26 Feb 2009 23:32:13 +0100, jkv wrote: Jean-Paul Calderone wrote: sys.stdout.write('Password: '); #IAC DO ECHO sys.stdout.write('\xFF\xFB\x01') password = raw_input() If the client sends 'qwerty\r\n' everything is fine and the password ge

Re: socket problem

2009-03-02 Thread Jean-Paul Calderone
ng which would cause a correctly written server (in C or any other language with BSD socket APIs) to fail. I suggest investigating how telnet and your Python client differ, then looking into the C code to find out how that difference can trigger a bug in it. Jean-Paul -- http://mail.python.org/ma

Re: Python3 on the Web

2009-03-05 Thread Jean-Paul Calderone
ython isn't available, cgi is said to be slow, mod_wsgi looks complicated... What would you suggest? Try Python 2.x instead. If you go with Python 3, you're going to run into the same limited library selection over and over. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Unusual Python interpreter problem with os.fork()

2009-03-06 Thread Jean-Paul Calderone
yright", "credits" or "license" for more information. import os pid = os.fork() As soon as this returns, you have two CPython processes reading from stdin and writing to stdout. They fight over your input and their output gets interleaved in non-deterministic ways. Basical

Re: Should I use stackless python or threads?

2009-03-06 Thread Jean-Paul Calderone
On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel wrote: I am trying to figure out the best approach to solve this problem: I want to poll various directories(can be run in the main thread). Once I notice a file has been added to any directory, I grab a lock, spawn a thread to go perform the nece

Re: download x bytes at a time over network

2009-03-16 Thread Jean-Paul Calderone
en you can probably see the behavior you were expecting. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Jean-Paul Calderone
is to work around a bug in CPython on Windows where a process in a blocking read cannot be interrupted by C-c in the console? If that's the case, there may be other approaches to solving the problem (like fixing the bug in CPython which causes this). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: download x bytes at a time over network

2009-03-17 Thread Jean-Paul Calderone
ntrol (you might have something like 32kb or 64kb level control). What abt in Python3 ? It seems to have some header like the one below : b'b495 - binary mode with 46229 bytes ? Or is it something else ? That's just a bug in urllib in Python 3.0. Jean-Paul -- http://mail.python.org/mai

Re: ValueError: filedescriptor out of range in select()

2009-03-17 Thread Jean-Paul Calderone
etter choice for me, except that Python is much more elegant. :-) I'm sure people will tell you that this is a good use of threads and that Python is up to the task. I think it's a bad use of threads, but with a different approach, I still think Python is up to the task. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: download x bytes at a time over network

2009-03-17 Thread Jean-Paul Calderone
On Tue, 17 Mar 2009 15:17:56 + (UTC), "R. David Murray" wrote: Jean-Paul Calderone wrote: On Tue, 17 Mar 2009 12:15:23 +0530, Saurabh wrote: >> This isn't exactly how things work.  The server *sends* you bytes.  It can >> send you a lot at once.  To some exte

Re: Threads not Improving Performance in Program

2009-03-19 Thread Jean-Paul Calderone
processes instead, if there really is more hardware that's sitting idle with your single threaded version. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library (was: Writing a well-behaved daemon)

2009-03-20 Thread Jean-Paul Calderone
ust surely fail. For example, uid/gid setting is broken. I'd recommend adding an automated test suite, fixing all the issues that come up during that process, and then asking for scrutiny again. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library

2009-03-20 Thread Jean-Paul Calderone
ed as could be (it's also only 14 lines long). Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-21 Thread Jean-Paul Calderone
t you integrate with a GUI toolkit. Since Twisted encourages you to write programs which deal with things asynchronously in a single thread, if you use it, your concerns about data exchange, locking, and timing should be addressed as a simple consequence of your overall program structure. Je

Re: PEP 3143: Standard daemon process library

2009-03-21 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 10:19:58 +1100, Ben Finney wrote: Jean-Paul Calderone writes: The biggest shortcoming seems to be a complete lack of unit tests. A full unit test suite is in the source distribution's ‘tests/’ directory. You can run it with ‘python ./setup.py test’. Of course th

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 03:13:36 -0700 (PDT), Nick Timkovich wrote: On Mar 21, 9:19 pm, Jean-Paul Calderone wrote: On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich wrote: >I've been working on a program that will talk to an embedded device >over the serial port, using some b

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
ets paused, and when the buffer is empty again, it gets resumed. Hope this helps! Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-23 Thread Jean-Paul Calderone
On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] In the case of a TCP to serial forwarder, you don't actually have to implement either a producer or a consumer, since both the TCP connection and the serial connection are already both prod

Re: pickle.load() extremely slow performance

2009-03-23 Thread Jean-Paul Calderone
onds, an 1875% improvement. Surely you mean a 94.7% improvement? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3143: Standard daemon process library

2009-03-24 Thread Jean-Paul Calderone
On Tue, 24 Mar 2009 15:42:46 +1100, Ben Finney wrote: Jean-Paul Calderone writes: [snip] An additional feature which would be useful for the library to provide, however, would be the setting of euid and egid instead of uid and gid. This is necessary, for example, to write an SSH daemon

Re: Unit testing frameworks

2009-03-24 Thread Jean-Paul Calderone
://twistedmatrix.com/trac/wiki/TwistedTrial Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-25 Thread Jean-Paul Calderone
On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the heavy machinery of Twisted, you're still polling at 10Hz. That's disappointi

Re: Async serial communication/threads sharing data

2009-04-11 Thread Jean-Paul Calderone
On Wed, 25 Mar 2009 22:23:25 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Tue, 24 Mar 2009 22:20:49 -0700, John Nagle wrote: Jean-Paul Calderone wrote: On Mon, 23 Mar 2009 05:30:04 -0500, Nick Craig-Wood wrote: Jean-Paul Calderone wrote: [snip] After bringing in all the

Re: OverflowError while sending large file via socket

2009-04-12 Thread Jean-Paul Calderone
rol of an application using the BSD socket API. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Who is your daddy: Can I find what object instantiates another object?

2009-04-13 Thread Jean-Paul Calderone
ho its Daddy is? Inspecting the call stack or the execution context to decide what to do is a really awful idea. It's complicated to implement, complicated to maintain, complicated to read, and there's no reason to do it. Just do the simple thing - add a parameter or make two separate

Re: Python and GMP.

2009-04-20 Thread Jean-Paul Calderone
ncies is always a tricky and in need of careful weighting thing to do. This has been discussion in detail on python-dev (more than once, I think, even). Here's the top of one such thread: http://mail.python.org/pipermail/python-dev/2008-November/083315.html Jean-Paul -- http://mai

Re: gethostbyname blocking

2009-04-22 Thread Jean-Paul Calderone
rolled by system configuration in various ways, and may do more than just DNS lookups (in fact, it may even be configured not to use DNS at all!). But it's pretty close, and may be close enough for your purposes. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: gethostbyname blocking

2009-04-22 Thread Jean-Paul Calderone
On Wed, 22 Apr 2009 20:50:51 +0200, Christian Heimes wrote: Jean-Paul Calderone wrote: I'm not sure what the easiest way to determine whether Python has found gethostbyname_r or not on your system is. The configure script used to build Python will probably tell, but I doubt you have

Re: gethostbyname blocking

2009-04-23 Thread Jean-Paul Calderone
ill probably produce significantly better results. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: http web fetch question

2009-04-23 Thread Jean-Paul Calderone
On Thu, 23 Apr 2009 15:21:21 -0700 (PDT), grocery_stocker wrote: Say I have a script that fetches data from a website every hour. Is there a general solution or is the solution operating system specific? General solution to what problem? Jean-Paul -- http://mail.python.org/mailman/listinfo

RE: screen scraping with Python?

2009-04-28 Thread Jean-Paul Calderone
nting many (but not all) of the features of the terminal. You can find the API documentation online: http://twistedmatrix.com/documents/current/api/twisted.conch.insults.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

[ANN] pyOpenSSL 0.9

2009-04-28 Thread Jean-Paul Calderone
https://bugs.launchpad.net/pyopenssl Jean-Paul Calderone -- http://mail.python.org/mailman/listinfo/python-list

Re: problem in using sendmail in multi thread

2009-05-06 Thread Jean-Paul Calderone
--- -- Piet van Oostrum URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org Thanks Everyone By your guidance the code worked fine I can send mails in multi threaded environment. Is this only way to send mails concurrently or any other method aviable? Here's another way: from twisted.mail.smtp import sendmail from twisted.internet import reactor from twisted.python.log import err MAILSERVER = ... listTo = [...] FROM = ... MSGBODY = ... done = sendmail(MAILSERVER, FROM, listTo, MSGBODY) done.addErrback(err) done.addCallback(lambda ignored: reactor.stop()) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: issue with twisted and reactor. Can't stop reactor

2009-05-11 Thread Jean-Paul Calderone
table. You can run and stop them once. After you've stopped a reactor, you cannot run it again. This is the cause of your problem. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: issue with twisted and reactor. Can't stop reactor

2009-05-12 Thread Jean-Paul Calderone
On Tue, 12 May 2009 14:30:04 -0500, Nick Craig-Wood wrote: Gabriel wrote: Jean-Paul Calderone escribió: > None of the reactors in Twisted are restartable. You can run and stop them > once. After you've stopped a reactor, you cannot run it again. This is > the > caus

Re: UDP reading on multiple sockets

2009-05-19 Thread Jean-Paul Calderone
/howto/udp.html You can trivially change the first example to handle multiple sockets - just add more reactor.listenUDP calls. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: define "generator" (glossary bug?)

2009-05-22 Thread Jean-Paul Calderone
;. However, I think it was right before. Consider: def foo(): yield Now, is `foo´ a generator? If so, what is `foo()´? With the "generator function"/"generator" terminology, it is unambiguous to say "`foo´ is a generator function and `foo()´ is a generator". Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Project source code layout?

2009-06-04 Thread Jean-Paul Calderone
at's a recipe for failure. Minimizing differences between development and deployment is a *great* thing. There are certainly cases where differences are necessary, but one should strive to make them the exception, not the rule. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Winter Madness - Passing Python objects as Strings

2009-06-04 Thread Jean-Paul Calderone
, and I would be surprised if anybody else on this list has done so in the past, in a context other than debugging. So, do you mind sharing your current problem? Maybe then it'll make more sense why one might want to do this. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: buffering choking sys.stdin.readlines() ?

2008-05-12 Thread Jean-Paul Calderone
print line but when I run $ gzcat bigXMLfile.gz | IOtest.py but it hangs then dies. file.readlines reads the entire file into a list in memory. You may not want to do this. You could try, instead, iterating over "sys.stdin", which should not try to load the entire file into memor

Re: Socket and cycle problem

2008-05-12 Thread Jean-Paul Calderone
rotocol to determine when all data has been received. For example, you might length prefix the data, or you might insert a delimiter (or a terminator) at the end. Or if there is exactly one message to receive, then you should just read until the recv call returns '', indicating EOF. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket and cycle problem

2008-05-12 Thread Jean-Paul Calderone
th prefix the data, or you might insert a delimiter (or a terminator) at the end. Or if there is exactly one message to receive, then you should just read until the recv call returns '', indicating EOF. Jean-Paul ok thanks, but I am true greenhorn, so you think that the best way is

Re: Socket and cycle problem

2008-05-12 Thread Jean-Paul Calderone
received = [] while True: try: bytes = server.recv(1024 * 16) except socket.error, e: if e.errno == EINTR: continue else: break if not by

Re: Popen pipe hang

2008-05-12 Thread Jean-Paul Calderone
he reference dst has to it. You can fix this by having Popen close all file descriptors except 0, 1, and 2 before it execs cat - pass close_fds=True to the 2nd Popen call and you should get the behavior you want. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: asynchat sends data on async_chat.push and .push_with_producer

2008-05-13 Thread Jean-Paul Calderone
h default timeout value. Twisted, for example, uses a default of 0.01 ms for all its reactors. I'm not sure this is right. What timeout are we talking about? Twisted only wakes up when necessary. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: asynchat sends data on async_chat.push and .push_with_producer

2008-05-13 Thread Jean-Paul Calderone
On Tue, 13 May 2008 14:05:43 -0700 (PDT), Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: On 13 Mag, 22:16, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Tue, 13 May 2008 11:50:30 -0700 (PDT), Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: >On 13 Mag, 17:59, J

Re: asynchat sends data on async_chat.push and .push_with_producer

2008-05-13 Thread Jean-Paul Calderone
levant. If someone wants timed events in their loop, asyncore isn't standing in their way. On the other hand, I didn't this thread (or maybe just this part of the thread) start out with a question about asyncore throughput? I have no idea what that might have to do with this. Jean-Paul -

Re: asynchat sends data on async_chat.push and .push_with_producer

2008-05-13 Thread Jean-Paul Calderone
On Tue, 13 May 2008 20:56:03 -0400, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Tue, 13 May 2008 16:44:11 -0700 (PDT), Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: [snip] To support scheduling calls, you just have to know when the next call is going to happen. Then

Re: asynchat sends data on async_chat.push and .push_with_producer

2008-05-14 Thread Jean-Paul Calderone
On Tue, 13 May 2008 18:20:29 -0700 (PDT), Giampaolo Rodola' <[EMAIL PROTECTED]> wrote: On 14 Mag, 02:56, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: Why? Isn't this why subtraction exists? If there is a call scheduled to happen at T1 and the current time is T2, then

Re: Python and Flaming Thunder

2008-05-14 Thread Jean-Paul Calderone
what "single-asset" means, but it gives the impression (and the term somewhat suggests) that this means there's a single executable that does all of this (compare to gcc's design, where support for cross compiling to another arch is provided by a separate executable). "Shotgun" probably just sounds cool. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.excepthack...

2008-05-14 Thread Jean-Paul Calderone
, Take a look at the traceback module. The excepthook gets called with an exception type, instance, and traceback object. The traceback module is good at turning these things into strings. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: waiting on an event blocks all signals

2008-05-17 Thread Jean-Paul Calderone
ooks to me like all signals are masked before entering wait(). Can someone familiar with the internals explain and/or justify this behavior? Thanks, ^C only kills the main thread. Use Control-Break to kill all threads. Look at that program. It's single-threaded. Where do you think the ^C

Re: the pipe reading in Thread dose not work.

2008-06-01 Thread Jean-Paul Calderone
quot;. So, is there and suggestion and explaination about it? file.read() reads the entire contents of the file. Your code never closes the write end of the pipe, so the read can never succeed - there is always more for it to read. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Producer-consumer threading problem

2008-06-11 Thread Jean-Paul Calderone
. Access is synchronized automatically by virtue of the fact that there is no pre-emptive multithreading in operation. This is one of the many advantages of avoiding threads. :) There may be valid arguments against callbacks, but this isn't one of them. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: The best way to package a Python module?

2008-06-15 Thread Jean-Paul Calderone
On Mon, 16 Jun 2008 01:01:47 +0900, js <[EMAIL PROTECTED]> wrote: Hi list, I'm trying to build a package for python modules. When I just wanted to have a package for Python2.5, this is an easy task, but in most cases, it's not enough. Sometimes I need python2.4, 2.5, 2.6 or 3.0 etc. The problem

Re: The best way to package a Python module?

2008-06-15 Thread Jean-Paul Calderone
On Mon, 16 Jun 2008 01:37:47 +0900, js <[EMAIL PROTECTED]> wrote: On Mon, Jun 16, 2008 at 1:16 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: On Mon, 16 Jun 2008 01:01:47 +0900, js <[EMAIL PROTECTED]> wrote: Hi list, I'm trying to build a package for python modules

Re: The best way to package a Python module?

2008-06-15 Thread Jean-Paul Calderone
On Mon, 16 Jun 2008 08:39:52 +1000, Ben Finney <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone <[EMAIL PROTECTED]> writes: On Mon, 16 Jun 2008 01:37:47 +0900, js <[EMAIL PROTECTED]> wrote: >By "package", I meant APT, Ports for BSD, MacPorts, etc. I don't kno

Re: Python GC does not work as it should be

2008-06-16 Thread Jean-Paul Calderone
n = collect(NUM_GENERATIONS - 1); collecting = 0; } return n; } If a system exception raised when executing collect(xxx), collecting state variable would never be reset and python GC will not works forever until the application restarted. A system exception? What's that? C doesn't have e

Re: Python GC does not work as it should be

2008-06-16 Thread Jean-Paul Calderone
On Mon, 16 Jun 2008 18:11:24 +0700, Jaimy Azle <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone wrote: A system exception? What's that? C doesn't have exceptions. How could I determine it? I dont know GCC implementation, and others, but C on MSVC does have it. My appl

Re: String Concatenation O(n^2) (was: Re: Explaining Implementing a Binary Search Tree.)

2008-06-16 Thread Jean-Paul Calderone
nywhere else, it will be re-sized in place. This means you'll probably see sub-quadratic behavior, but only with a version of Python where this optimization exists and only if the code can manage to trigger it. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: String Concatenation O(n^2) (was: Re: Explaining Implementing a Binary Search Tree.)

2008-06-16 Thread Jean-Paul Calderone
On Mon, 16 Jun 2008 11:30:19 -0600, Ian Kelly <[EMAIL PROTECTED]> wrote: On Mon, Jun 16, 2008 at 11:09 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: It will depend what version of Python you're using and the *exact* details of the code in question. An optimization was int

Re: [Twisted-Python] Re-working a synchronous iterator to use Twisted

2008-06-17 Thread Jean-Paul Calderone
imeError. The only slightly more complex one is to create a new Deferred in `processResults´ and return it. Then, fire it inside `cb´ when `deferred´ is None. You also need to be slightly careful to hook up the errback chain in this case, so that if there's some problem with getting an iterator the

Re: Python "is" behavior

2008-06-20 Thread Jean-Paul Calderone
/python-list/2001-November/113994.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "is" behavior

2008-06-20 Thread Jean-Paul Calderone
information. a= 123456; b=123456; a is b True For some reason, stacking multiple statements reuses the same object. This is because using the ";" puts the statements into the same compilation unit as each other. So secretly an integer object is created for 123456 and then a and b are both given a reference to it. This is a different mechanism than the other case, where the builtin integer cache causes the literal 100 to refer to the same object each time it is evaluated. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Way to unblock sys.stdin.readline() call

2008-06-21 Thread Jean-Paul Calderone
py under the Miscellaenous section at http://twistedmatrix.com/projects/core/documentation/examples/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python to run SSH commands on a remote server

2008-06-23 Thread Jean-Paul Calderone
at will automate the process of making all .py files on my web server executable (chmod 755, or something similar). There are several third-party SSH libraries, eg Twisted Conch and Paramiko. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: sending executable data over network..

2008-06-25 Thread Jean-Paul Calderone
believe it does what you are looking for. Twisted PB goes out of its way to *not* allow arbitrary code specified by a peer to be executed, actually. :) It is intended to be used when you cannot trust the network (a common scenario) but still want to perform complex operations and pass complex da

Re: Why is recursion so slow?

2008-06-29 Thread Jean-Paul Calderone
emented and whether it optimizes that case.) CPython doesn't do tail call elimination. And indeed, function calls in Python have a much higher fixed overhead than iteration. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes - swig - pointer

2008-06-30 Thread Jean-Paul Calderone
takes an instance and returns a new object which represents a pointer to that instance. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about optimization

2008-07-24 Thread Jean-Paul Calderone
59 27500 8.98186042757 3 11.8042818095 32500 12.1965593712 35000 13.2735763291 37500 14.0282617344 What is it in the code snippet that slows down as n increases? Is there something about the way low level python functions I don't understand which is slowing me down? Perhaps you need an in

Re: block/lambda

2008-07-29 Thread Jean-Paul Calderone
: ... dotimes(5, block) ... >>> f() Traceback (most recent call last): File "", line 1, in ? File "", line 2, in f File "", line 3, in dotimes File "", line 2, in block NameError: global name 'i' is not defined >>

Re: [unittest] Run setUp only once

2008-07-29 Thread Jean-Paul Calderone
ts into one big function? class TwoTests(unittest.TestCase): setUpResult = None def setUp(self): if self.setUpResult is None: self.setUpResult = computeIt() ... There are plenty of variations on this pattern. Jean-Paul Best, -Nikolaus --

Re: Continuous integration for Python projects

2008-07-29 Thread Jean-Paul Calderone
n do arbitrary things. However, one CIS written in Python (which can also handle arbitrary builds, not just builds of Python software) is buildbot: http://buildbot.net/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: [unittest] Run setUp only once

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone <[EMAIL PROTECTED]> writes: On Tue, 29 Jul 2008 16:35:55 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: Hello, I have a number of conceptually separate tests that neverthe

Re: [unittest] Run setUp only once

2008-07-29 Thread Jean-Paul Calderone
On Tue, 29 Jul 2008 20:12:14 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone <[EMAIL PROTECTED]> writes: On Tue, 29 Jul 2008 19:26:09 +0200, Nikolaus Rath <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone <[EMAIL PROTECTED]> writes: On Tue, 29

Re: Testing for the first few letters of a string

2008-08-07 Thread Jean-Paul Calderone
tead of "incorrect". ;) re.match = match(pattern, string, flags=0) Try to apply the pattern at the *start* of the string, returning a match object, or None if no match was found. Emphasis mine. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Wouldn't it be nice if this worked?

2008-08-10 Thread Jean-Paul Calderone
On Mon, 11 Aug 2008 00:47:14 +0530, "Suresh V." <[EMAIL PROTECTED]> wrote: class A: def add(self, x, y): return x+y class B: pass B.add = A.add print B().add(1, 2) <- gives TypeError: unbound method add() must be called with A instance as first ar

Re: SSH utility

2008-08-11 Thread Jean-Paul Calderone
H with Twisted online: http://twistedmatrix.com/projects/conch/documentation/examples/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Jean-Paul Calderone
nce() class Ticket(Persistence): def __init__(self): self.id = ticketSequence.next() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Jean-Paul Calderone
On Thu, 14 Aug 2008 16:15:11 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone wrote: On Thu, 14 Aug 2008 05:22:35 -0700 (PDT), Phillip B Oldham <[EMAIL PROTECTED]> wrote: [snip] How would one assign a unique ID to the root at that point? Her

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Jean-Paul Calderone
ometimes not work (retry or manually resolve). PostgreSQL is great and makes sequences easier than ZODB does (at least as far as I can tell), but it's hardly _impossible_ to have a working sequence in ZODB, and it's not even difficult, it's just not trivial. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Question - Overloading ==

2008-03-31 Thread Jean-Paul Calderone
ld rewrite every __eq__ function and catch attribute errors, but >that's tedious, and seemingly unpythonic. Also, I don't want an >attribute error thrown whenever two classes are compared that don't >have the same attributes. > >I have a sneaky feeling I'm d

pyOpenSSL 0.7

2008-04-11 Thread Jean-Paul Calderone
access on X509Names pyOpenSSL home page: http://pyopenssl.sourceforge.net/ pyOpenSSL downloads: http://sourceforge.net/project/showfiles.php?group_id=31249 Jean-Paul Calderone -- http://mail.python.org/mailman/listinfo/python-list

pyOpenSSL 0.7

2008-04-14 Thread Jean-Paul Calderone
access on X509Names pyOpenSSL home page: http://pyopenssl.sourceforge.net/ pyOpenSSL downloads: http://sourceforge.net/project/showfiles.php?group_id=31249 Jean-Paul Calderone -- http://mail.python.org/mailman/listinfo/python-list

Re: Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread Jean-Paul Calderone
>the gain is less code? > >are some functions only implementable recursively? > Function calls (recursive or otherwise) are more expensive than for loops, so the version that replaces recursion with a loop is faster. Any function can be implemented without recursion, although it isn&#x

Re: py3k s***s

2008-04-18 Thread Jean-Paul Calderone
On Fri, 18 Apr 2008 11:32:15 -0700, Nick Stinemates <[EMAIL PROTECTED]> wrote: > [snip] > >Yo, no one here is a child Hi Nick, Actually, there are a number of young people on the list. So let's keep things civil and try to avoid using harsh language. Thanks!

Re: python has memory leak?

2008-04-22 Thread Jean-Paul Calderone
r job of releasing memory when actual use falls below peak, but this is a difficult thing to do perfectly. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python generators (coroutines)

2008-04-23 Thread Jean-Paul Calderone
turning control to the frame immediately above it on the stack. You can build a trampoline based on generators, but you can do that in Python 2.4 just as easily as you can do it in Python 2.5. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python generators (coroutines)

2008-04-23 Thread Jean-Paul Calderone
er/trunk/twisted/internet/defer.py#L555 Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Receive data from socket stream

2008-04-28 Thread Jean-Paul Calderone
sing cStringIO doesn't rely on a very esoteric optimization in the CPython eval loop, as well as on what references happen to exist to what objects. For example, one might want to use a debugger without falling back to the quadratic behavior of repeated string concatenation. cStringIO wins out in this case. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Receive data from socket stream

2008-04-28 Thread Jean-Paul Calderone
r simplicity of programming, not much else. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: portable fork+exec/spawn

2008-05-02 Thread Jean-Paul Calderone
sending and receiving, and doesn't have deadlock issues since it's event-driven. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-blocking connect

2008-05-02 Thread Jean-Paul Calderone
if it has a 0 SO_ERROR, the connection was successful, otherwise it failed. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: confused about self, why not a reserved word?

2008-05-05 Thread Jean-Paul Calderone
no special meaning in the language. `object´, on the other hand, is a builtin name which refers to a particular object. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert unicode string to unsigned char *

2008-05-05 Thread Jean-Paul Calderone
UTF-8 formatted string: test = u'Make \u0633\u0644\u0627\u0645, not war.' `test´ is not a UTF-8 encoded string. It's a unicode string. To get a UTF-8 encoded string from a unicode string, use the `encode´ method: some_module.some_thing(test.encode('utf-8')) Jean

<    1   2   3   4   5   6   7   >