Re: ascii to unicode line endings

2007-05-03 Thread Jean-Paul Calderone
On 3 May 2007 04:30:37 -0700, [EMAIL PROTECTED] wrote: >On 2 May, 17:29, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On 2 May 2007 09:19:25 -0700, [EMAIL PROTECTED] wrote: >> >> >> >> >The code: >> >> >import codecs >> >>

Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-03 Thread Jean-Paul Calderone
far from the truth. > >The claimed figures were 50,000 Pystones for CPython 2.5, and 101,000 for >the latest IronPython. (He didn't mention it, but I believe Psyco will >outdo both of these.) fwiw, my desktop happens to do 50,000 pystones with cpython 2.4 and 294,000 pystones with cpython 2.4 and psyco.full() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Jean-Paul Calderone
I do a >telnet connection to port 1. > What were you expecting? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Non blocking sockets with select.poll() ?

2007-05-04 Thread Jean-Paul Calderone
On Fri, 4 May 2007 15:05:46 +0300, Maxim Veksler <[EMAIL PROTECTED]> wrote: >On 5/4/07, Maxim Veksler <[EMAIL PROTECTED]> wrote: >>On 5/4/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> > On Fri, 4 May 2007 13:04:41 +0300, Maxim Veksler &l

Re: Non blocking sockets with select.poll() ?

2007-05-05 Thread Jean-Paul Calderone
On Sat, 5 May 2007 15:37:31 +0300, Maxim Veksler <[EMAIL PROTECTED]> wrote: >On 5/4/07, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> >""" >> >#!/usr/bin/env python >> >import socket >> >import select >> > >>

Re: Setting up python socket server with non-standard termination string.

2007-05-08 Thread Jean-Paul Calderone
t import reactor from twisted.internet.protocol import ServerFactory from twisted.protocols.basic import LineOnlyReceiver class CellProtocol(LineOnlyReceiver): delimiter = '-ND-' def lineReceived(self, line): print 'got a line' f = ServerFactory(

Re: Thread-safe dictionary

2007-05-10 Thread Jean-Paul Calderone
t be better to use threading.RLock, mutex, ... instead? > The builtin dict type is already thread safe. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Moving class used in pickle

2007-05-15 Thread Jean-Paul Calderone
b.py and import the relevant class(es) from c.py into it - 'from a.c import ClassA'. You could also build a much more complex system in the hopes of being able to do real "schema" upgrades of pickled data, but ultimately this is likely a doomed endeavour (vis <http://divmod.org:81/websvn/wsvn/Quotient/trunk/atop/versioning.py?op=file&rev=0&sc=0>). Hope this helps, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: NEWBIE: Extending a For Statement.

2007-05-21 Thread Jean-Paul Calderone
in mydict if key in xrange(60, 69) or key == 3] For the statement form of 'for', there is no syntactic way to combine it with 'if' into a single statement. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: howto check does module 'asdf' exist? (is available for import)

2007-05-21 Thread Jean-Paul Calderone
;>> 'Numeric' in modules False >>> getModule('Numeric') PythonModule<'Numeric'> >>> 'Numeric' in modules False >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: split on NO-BREAK SPACE

2007-07-22 Thread Jean-Paul Calderone
27;s only inconsistent if you think it should behave based on the name of a unicode code point. It doesn't use the name, though. It uses the category. NO-BREAK SPACE is in the Zs category (Separator, Space). ZERO WIDTH NO-BREAK SPACE is in the Cf category (Other, Format). Maybe that makes unicode inconsistent (I won't try to argue either way), but it's pretty clear that isspace is being consistent based on the data it has to work with. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting __future__ features

2007-07-30 Thread Jean-Paul Calderone
is >example, and many more. > >Making the switch between different parser-implementations on the fly isn't >technically impossible - but really, really, really complicated. But then, >if it's lameness sucks so much, you might wanna take a stab at it? > I think you misunderstood the behavior which was being called lame. The earlier poster was suggesting that only the first Python code to run any where in a process could perform future imports. This is, of course, not true. It's only restricted to the first Python code to run in a particular file. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: File handle not being released by close

2007-07-30 Thread Jean-Paul Calderone
On Mon, 30 Jul 2007 07:36:00 -0700, [EMAIL PROTECTED] wrote: >Hi, > > [snip] >f=open(fileBeginning+".tmp", 'w') >f.write("Hello") >f.close > You forgot to call close. Try this final line, instead: f.close() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: interaction of 'with' and 'yield'

2007-07-31 Thread Jean-Paul Calderone
aving to >syntactically enclose the code in the 'with' scope, and I am hoping that >the the yield does not exit the 'with' scope and release the resource. It doesn't. Keep in mind that if the generator isn't resumed or garbage collected, the cleanup with never run, though. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread Jean-Paul Calderone
strode along with that? Compared to python, that has been >started in 1991 and now approaches it's third incarnation, I'd say >python has a record of steadiness that surpasses that of MS-based tools >by any means. This is not a valid comparison. In fact, C# 3 is completely

Re: python 3.0, pywin32 and scipy

2007-08-02 Thread Jean-Paul Calderone
On Thu, 02 Aug 2007 23:07:12 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone schrieb: >> On Thu, 02 Aug 2007 21:16:04 +0200, "Diez B. Roggisch" >> <[EMAIL PROTECTED]> wrote: >>> vml schrieb: >>>> Hello,

Re: Importing * From a Package

2007-08-06 Thread Jean-Paul Calderone
fore they can find out what any particular name is bound to, and potentially leading to bugs where names from one package accidentally obscure names from another package. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: udp, datagram sockets

2007-08-06 Thread Jean-Paul Calderone
, causing the server to never see the termination marker. UDP is difficult to use effectively. Fortunately, TCP is suitable for many applications. You should consider using it, instead. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

seeking tinter module

2007-08-07 Thread Jean-François Piéronne
I'm looking for a module name tinter (not tkinter...) from http://www.vex.net/parnassus/apyllo.py?i=97497223 status: Dead and Gone Google return no location to download it, only a few articles mentionned it, for example: http://www.ibm.com/developerworks/linux/library/l-python6.html Does someon

Re: seeking tinter module

2007-08-07 Thread Jean-François Piéronne
Peter Otten wrote: > Jean-François Piéronne wrote: > >> I'm looking for a module name tinter (not tkinter...) >> >> from http://www.vex.net/parnassus/apyllo.py?i=97497223 >> status: Dead and Gone >> >> Google return no location to download it, on

Re: Stackless Integration

2007-08-09 Thread Jean-Paul Calderone
oblems with the current C-extensions? It seems >like if something is fully compatible and better, then it would be >adopted. However, it hasn't been in what appears to be 7 years of >existence, so I assume there's a reason. It's not Pythonic. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Stackless Integration

2007-08-09 Thread Jean-Paul Calderone
On Thu, 9 Aug 2007 05:05:31 -0700, Michael Bentley <[EMAIL PROTECTED]> wrote: > >On Aug 9, 2007, at 4:48 AM, Jean-Paul Calderone wrote: > >> On Thu, 09 Aug 2007 09:00:27 -, "Justin T." >> <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >

Re: The Future of Python Threading

2007-08-10 Thread Jean-Paul Calderone
me point, someone needs to write some code. Stackless is great, but it's not the code that will solve this problem. In the mean time, you might consider some multi-process solutions. There are a number of tools for getting concurrency like that. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: The Future of Python Threading

2007-08-10 Thread Jean-Paul Calderone
On Fri, 10 Aug 2007 16:37:19 -, "Justin T." <[EMAIL PROTECTED]> wrote: >On Aug 10, 3:52 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On Fri, 10 Aug 2007 10:01:51 -, "Justin T." <[EMAIL PROTECTED]> wrote: >> >Hello, >>

Re: curses library

2007-08-14 Thread Jean-Paul Calderone
gt; widget. > >Forgot to say, i don't need it to work on windows :) You might be interested in insults: API docs: http://twistedmatrix.com/documents/current/api/twisted.conch.insults.html Examples: http://twistedmatrix.com/projects/conch/documentation/examples/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Fast socket write

2007-08-22 Thread Jean-Paul Calderone
in mind, maybe you can try to provide more details about the functionality to narrow the field a bit. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread Jean-Paul Calderone
1, in ? AttributeError: 'module' object has no attribute 'time' >>> print time.__file__ time.py >>> ^D [EMAIL PROTECTED]:~$ rm time.py [EMAIL PROTECTED]:~$ rm time.pyc [EMAIL PROTECTED]:~$ python Python 2.4.3 (#2, Oct 6 2006, 0

Re: Python is overtaking Perl

2007-09-04 Thread Jean-Paul Calderone
On Tue, 04 Sep 2007 00:32:23 -, Ben <[EMAIL PROTECTED]> wrote: >Here are the statistics from Google Trends: > >http://benyang22a.blogspot.com/2007/09/perl-vs-python.html > >From the graph, it seems more accurate to say that Perl is undertaking Python. Jean-Paul -- h

Re: implementing SFTP using Python

2007-03-02 Thread Jean-Paul Calderone
python+sftp+server%22&btnG=Search might be a place to start. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Webserver balance load

2007-03-05 Thread Jean-Paul Calderone
On 5 Mar 2007 11:47:15 -0800, Johny <[EMAIL PROTECTED]> wrote: >Can anyone suggest a way how to balance load on Apache server where I >have Python scripts running? >For example I have 3 webservers( Apache servers) and I would like to >sent user's request to one of the three server depending on a lo

Re: Database module & multithreading

2007-03-10 Thread Jean-Paul Calderone
s is the error I am getting > Do you recognize that this has absolutely nothing to do with threading? If this is the reason you want to switch away from SQLite3, reconsider, because it's just a bug in your application code, and no matter what database or adapter you use, bugs in your application code will prevent your application from working properly. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python & Oracle

2007-03-14 Thread Jean-Philippe Durand
So do I ! 2007/3/14, Josh Bloom <[EMAIL PROTECTED]>: > I would suggest using cx_Oracle as I have had good experience with it. > http://www.cxtools.net/default.aspx?nav=cxorlb > > -Josh > > > On 3/14/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > > Hi! I need to connect to Oracle. > > > > I found

Re: Still the __new__ hell ...

2007-03-19 Thread Jean-Paul Calderone
On Mon, 19 Mar 2007 13:17:11 +0100, Bruno Desthuilliers > > [snip] > >And what if it's a unicode string ? >The correct idiom here is: > if isinstance(year, basestring): > >> year,month,day=map(int,string.split(year,'-')) > year, month,

Re: Still the __new__ hell ...

2007-03-19 Thread Jean-Paul Calderone
On Mon, 19 Mar 2007 15:39:49 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone a écrit : >> On Mon, 19 Mar 2007 13:17:11 +0100, Bruno Desthuilliers >>> >>> [snip] >>> >>> And what if it's a unicode string ? >>&

Re: Python object overhead?

2007-03-24 Thread Jean-Paul Calderone
quot;, "n"] > Only one list is created. It is used to define a C array where attributes will be stored. Each instance still has that C array, but it has much less overhead than a Python list or dictionary. Whether this reduction in overhead actually results in a useful or measurable perfor

Re: Python object overhead?

2007-03-24 Thread Jean-Paul Calderone
On 24 Mar 2007 13:52:46 -0700, 7stud <[EMAIL PROTECTED]> wrote: >On Mar 24, 2:19 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> Only one list is created. It is used to define a C array where attributes >> will be stored. Each instance still has that C

Re: Strange behavior when printing a returned closure function

2007-03-25 Thread Jean-Paul Calderone
>what ...? They're _not_ the same function object, just like the `is' test told you. They just happen to have been allocated at the same memory address. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread Jean-Paul Calderone
meric without losing the readability of Python. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread Jean-Paul Calderone
On 26 Mar 2007 06:47:18 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On Mar 26, 2:42 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On 26 Mar 2007 06:20:32 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> >> >

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Jean-Paul Calderone
this in >python.. You need a sendmsg wrapper (there are several, none in the stdlib), then you need a privileged process which is willing to give you the privilege. It's pretty inconvenient. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python object overhead?

2007-03-26 Thread Jean-Paul Calderone
ss is one which has a type of type instead of ClassType. For example: >>> class notnewstyle: ... pass ... >>> type(notnewstyle) >>> class newstyle(object): ... pass ... >>> type(newstyle) >>> class alsonewstyle(list

Re: newbi question on python rpc server, how it works?

2007-03-29 Thread Jean-Paul Calderone
shnakant. Here's an example Twisted-based XML-RPC server: http://twistedmatrix.com/projects/web/documentation/examples/xmlrpc.py When using MySQLdb with Twisted, twisted.enterprise.adbapi is useful. This document explains it and gives some examples of its usage: http://twistedmatrix.co

Re: socket read timeout

2007-03-29 Thread Jean-Paul Calderone
t; So set a long timeout when you want to write and short timeout when you want >> to read. >> > >Are sockets full duplex? Uh, yes. > >I know Ethernet isn't. Not that this is relevant, but unless you're using a hub, ethernet _is_ full duplex. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: with timeout(...):

2007-03-29 Thread Jean-Paul Calderone
that. > >I'm assuming that the timeout function is running in a thread... What does it do when the timeout expires? How does it interrupt recv(2) or write(2) or `for (int i = 0; i < (unsigned)-1; ++i);'? This is what we're talking about, right? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: socket read timeout

2007-03-30 Thread Jean-Paul Calderone
On Fri, 30 Mar 2007 08:22:18 +0200, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: >"Jean-Paul Calderone" <[EMAIL PROTECTED]> wrote: > >> On Thu, 29 Mar 2007 07:29:35 +0200, Hendrik van Rooyen ><[EMAIL PROTECTED]> wrote: > >> >Are sockets full

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
atibility reasons >(though it is being removed in Python 3000). If you have a specific >suggestion for what doc should be updated and how, that would be >helpful. Please post it to: Why does this mean that the unicode type has to implement __getslice__? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: installing pyqt4 on ubuntu 6.06

2007-04-10 Thread Jean-Paul Calderone
>from PyQt4 import QtCore, QtGui >ImportError: No module named PyQt4 > > >Any pointers regarding what packages should i install to get the >system into working condition would be very helpful > >Thanks a lot Qt4 Python bindings aren't available in 6.06, afaik. I

Re: Why is __getslice__ still implemented?

2007-04-10 Thread Jean-Paul Calderone
On Tue, 10 Apr 2007 09:51:45 -0600, Steven Bethard <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Tue, 10 Apr 2007 08:35:56 -0600, Steven Bethard >> <[EMAIL PROTECTED]> wrote: >>> Yes, you do still need to implement __getslice__ if you're subc

Re: unittest assertRaises Problem

2007-04-16 Thread Jean-Paul Calderone
a callable. assertRaises will call it (so that it can do exception handling), so you shouldn't: self.assertRaises(ValueError, f.testException) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue enhancement suggestion

2007-04-16 Thread Jean-Paul Calderone
for >each reader. I found my code cluttered with > >for i in xrange(number_of_worker_threads): > q.put(sentinel) > >which certainly seems like a code smell to me. Instead of putting multiple sentinels, just pre-construct the iterator object. work = iter(q.get, sentine

Re: Queue enhancement suggestion

2007-04-17 Thread Jean-Paul Calderone
On 17 Apr 2007 14:32:01 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >On 2007-04-17, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On 17 Apr 2007 13:32:52 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >>>On 2007-04-17, Hendrik van Rooyen <[EMAIL PROTECT

Re: Using X509 (and TLSlite) authentication

2007-04-17 Thread Jean-Paul Calderone
code in Twisted for this. It's based on PyOpenSSL. http://twistedmatrix.com/trac/browser/trunk/twisted/internet/_sslverify.py Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue enhancement suggestion

2007-04-17 Thread Jean-Paul Calderone
read is the single reader, it will dead >lock if the queue happens to be full at the moment the gui thread >want to add another item. > This is pretty easily solved: def sendToGUI(event): if isInGUIThread(): gui.scheduleCall(event) else: guiQueue.put(event) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Parameterize formatting string

2007-09-21 Thread Jean-Paul Calderone
ething like : >> >> a = 16 >> "%ai" % 12 >> >> But it is not correct. >> >> Any Idea ? > >("%i" % 12).rjust(a) > >Or, more ugly: > >"%%%di" % a % 12 > >The first % (after quotes) builds this string: &quo

Re: Python 3.0 migration plans?

2007-09-28 Thread Jean-Paul Calderone
Higher Order Functions and would >like to see exactly how you do it and to verify the contention. > Perhaps you could do a bit of independent research. Then your messages to the group could contain more thoughtful questions and responses. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Real time plot

2007-10-03 Thread Jean-Francois Canac
I am reading a large amount of data from a COM port (or from a file) at a rate of 20 records per second. It is about positioning of a vehicle on a race track. In each record we have time, position (lat and long) speed, course all from GPS equipment. I would like to Produce a graph in real time wi

Re: Real time plot

2007-10-04 Thread Jean-Francois Canac
"Hendrik van Rooyen" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Jean-Francois Canac wrote: > >>I am reading a large amount of data from a COM port (or from a file) at a >>rate > of 20 records per second. It is about >pos

Please Help me

2007-10-05 Thread Jean-Francois Canac
don’t know which I should take for producing plot with data coming from a steam Please could you help? Many thanks Jean-François -- http://mail.python.org/mailman/listinfo/python-list

Re: Real time plot

2007-10-05 Thread Jean-Francois Canac
"Lawson Hanson" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] > Nicholas Bastin wrote: >> On 10/4/07, Jean-Francois Canac <[EMAIL PROTECTED]> wrote: >>> [EMAIL PROTECTED] >>>> I would draw dots on a suitably sized Tk

Re: Python + Shoutpy + Twisted Locks

2007-10-09 Thread Jean-Paul Calderone
that >>> I have to re-think a lot. But in the end I suppose it will pay off. >>> >>> Thanks for taking the time and reading my little essay Gabriel ;) >>> >> >> Using Twisted won't help if the libshout calls are really blocking the >> main

Re: Native class methods

2007-10-09 Thread Jean-Paul Calderone
#x27;m really trying to do this without any dependencies on external >libraries. The ctypes way looks interesting but I had really hoped for >something more JNI-like :-/ > JNI is awful. I can't imagine why you'd want something like it. However, since you do, why don't you

Re: unpickle from URL problem

2007-10-10 Thread Jean-Paul Calderone
rican.edu/econ/notes/hw/example2')) > >Why the difference? You shouldn't unpickle things you get from the network, since pickle can execute arbitrary code: http://jcalderone.livejournal.com/15864.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Error on base64.b64decode() ?!

2007-10-12 Thread Jean-Paul Calderone
If you get an incorrect padding error, try appending a "=" and decoding again. If you get the error again, try appending one more "=". If it still doesn't work, then you might be out of luck. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP idea: Instrumented Python

2007-10-12 Thread Jean-Paul Calderone
t you can connect >to the app and explore its current state. Take a look at the >evalexception module in Paste to see what he does. > Or manhole in Twisted. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatically organize module imports

2007-10-15 Thread Jean-Paul Calderone
dule name for every class/function that I use >(quite unhandy)? > Pyflakes will tell you which imports aren't being used (among other things). I don't know if an existing tool which will automatically rewrite your source, though. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Get the instance name from a list by Reflection

2007-10-20 Thread Jean-Paul Calderone
>>> from twisted.python.reflect import objgrep, isSame >>> for elem in aList: ... objgrep(__main__, elem, isSame) ... ['.aList[0]', '.elem', '.a1'] ['.aList[1]', '.elem', '.a2'] >>> Don't see how this could help, Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: python with braces pre-processor

2007-10-22 Thread Jean-Paul Calderone
_pp.py It's just some throw-away code, but it at least manages to indent code properly. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: pure python data compression (zip)

2007-10-23 Thread Jean-Paul Calderone
t/, which is written in >C. Unfortunately this is not solution for me, because my target "only" >has a python interpreter > >I have "googled" for a while, but I don't have found anything useful. What is your target, that it can only run programs written in Python, not C?

Re: Adding idle timeout capabilities to asyncore

2007-10-23 Thread Jean-Paul Calderone
really useful in any real-world sense, but I still wouldn't characterize time.time as "relatively inexpensive." Of course, for any real-world work, one would want to profile the application to determine if removing calls to time.time() could make a worthwhile difference. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Socket communication problem

2007-10-24 Thread Jean-Paul Calderone
code does not check the return value of socket.send(), which you must do. Twisted is a third-party library which abstracts many of the low-level details of the BSD socket API away from you. You might want to take a look at it. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to get exit code from os.popen()?

2007-10-24 Thread Jean-Paul Calderone
exit 5", >close() returns 1280. Here's the code: > > pipe = os.popen("exit 5") > print pipe.close() # prints 1280 > >Am I doing something wrong? Is there an easier way to get the exit >code? >>> import os >>> os.WEXITSTATUS(1280) 5 >>> Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding idle timeout capabilities to asyncore

2007-10-25 Thread Jean-Paul Calderone
7;m not sure that >your testing examples were ultimately germane to the conversation (how >would one handle timeouts in asyncore). Or maybe it's just late and >I've had a long day :/ . That's okay. I wasn't trying to be germane to the asyncore timeout handling convers

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
many("INSERT INTO keywords (keyword) VALUES (%s)", datas) Note that I also corrected your use of %, which was unnecessarily complex and insecure. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
ole serialized >inserts thing is strictly something popularized by MySQL and is by no >means necessary or standard (as with a lot of MySQL). PostgreSQL won't serialize inserts to the same table with a sequence column? Wow. :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Built-in functions and keyword arguments

2007-10-29 Thread Jean-Paul Calderone
ster = 42) and an assignment (s='I am a string') > But it's not a keyword: >>> len(s=[]) Traceback (most recent call last): File "", line 1, in ? TypeError: len() takes no keyword arguments >>> I think that's the issue here. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

logic programming in python (was something about py3k)

2007-10-30 Thread Jean-Paul Calderone
at it is good for, but I'd like to find out!) > If you have some time to experiment, PyPy has some support for logic programming with Python. http://codespeak.net/pypy/dist/pypy/doc/objspace-proxies.html#the-logic-object-space Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: A Python 3000 Question

2007-10-30 Thread Jean-Paul Calderone
-m timeit -s ' class X(object): def __len__(self): return 100 seq = X() ' 'len(seq)' 100 loops, best of 3: 0.701 usec per loop [EMAIL PROTECTED]:~$ I guess we've learned that sometimes something is faster than something else, and other times the contrary. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a usenet library for Python?

2007-10-30 Thread Jean-Paul Calderone
om/documents/current/api/twisted.news.nntp.NNTPClient.html Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
rceForge bug. > >Is this a dumb policy change or a dumb administrator action? > I don't know why they chose to make the sf tracker private. Maybe that was the only way to remove write access. Python bugs are now tracked at http://bugs.python.org/. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 08:26:06 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >>> I'm now getting messages like this from the Python bug tracker on >>> S

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
e won't browse outdated information. > Though it also means all old links are broken and there's no obvious pointer to the new information. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Which persistence is for me?

2007-11-01 Thread Jean-Paul Calderone
nt to call a function (c.insert?). > >Is there some other interface/database that I might like better? > There are a lot of choices. Take a look, for example, at storm: https://storm.canonical.com/ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: marshal vs pickle

2007-11-01 Thread Jean-Paul Calderone
s I'm concerned marshal.load is not any >more insecure than file.read. You're mistaken. $ python Python 2.4.3 (#2, Oct 6 2006, 07:52:30) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license&quo

Re: marshal vs pickle

2007-11-01 Thread Jean-Paul Calderone
On Thu, 01 Nov 2007 21:15:06 -, Aaron Watters <[EMAIL PROTECTED]> wrote: >On Nov 1, 4:59 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On Thu, 01 Nov 2007 20:35:15 -, Aaron Watters <[EMAIL PROTECTED]> wrote: >> >On Nov 1, 2:15 pm, Raymond

Re: maximum number of threads

2007-01-10 Thread Jean-Paul Calderone
150 200 250 300 350 400 450 500 550 600 650 700 750 Exception raised: can't start new thread Biggest number of threads: 764 [EMAIL PROTECTED]:~$ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the idiom for copy lots of params into self?

2007-01-10 Thread Jean-Paul Calderone
;,'j','k','l','m','n']: > self.__dict__[name] = locals()[name] > >This saves a lot of code and makes it easier to see what is going on, >but it seems like there should be a better idiom for this task. Any >suggestions? I use a helper, like http://divmod.org/trac/browser/trunk/Epsilon/epsilon/structlike.py#L35 Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: context managers and generators

2007-01-12 Thread Jean-Paul Calderone
me way to transparently save >and restore context over a yield, but I don't see an easy way to do >this. Wrap the generator in a function which co-operates with your context managers to clean-up or re-instate whatever they are interacting with whenever execution leaves or re-enters the generator. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: python - process id

2007-01-14 Thread Jean-Paul Calderone
ddress.. and yeah, i've tried changing the address a >number of times.. IRC bans can cover a wide range of addresses. Someone else on your ISP may have abused the channel badly enough to get a large range of addresses, maybe every address you could possibly get, banned from the channel. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Debugging SocketServer.ThreadingTCPServer

2007-01-16 Thread Jean-Paul Calderone
will. Grab the gdbinit out of Python SVN Misc/ directory. Apply this patch: http://jcalderone.livejournal.com/28224.html Attach to the process using gdb. Make sure you have debugging symbols in your build of Python. Run 'thread apply all pystack'. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write unicode to a txt file?

2007-01-17 Thread Jean-Paul Calderone
this, you may as well not even bother to do the decoding in the first place, unless you have some code in between the input and output steps which manipulates the unicode in some way. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Globbing files by their creation date

2007-01-17 Thread Jean-Paul Calderone
"copyright", "credits" or "license" for more information. >>> import os >>> import datetime >>> datetime.date.fromtimestamp(os.path.getctime('.')) datetime.date(2007, 1, 17) >>> [EMAIL PROTECTED]:~$ ls -ld . drwxr-xr-x 93 exarkun exarkun 8192 2007-01-17 10:34 . [EMAIL PROTECTED]:~$ Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out if another process is using a file

2007-01-18 Thread Jean-Paul Calderone
recognizable and only rename or move them to their final location when they have been completely written. For example, name files ".new" as they are being written. When they are fully written, drop the ".new" suffix. On the reader side, ignore any file with a name ending in ".new". Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Wierd M2Crypto bug - phony "peer did not return certificate" error

2007-01-19 Thread Jean-Paul Calderone
ned before, if you use the Twisted wrapper and let >> Twisted handle network stuff you should be fine. > > That would mean struggling with Twisted and dealing with its bugs. >(For example, has the MySQLdb mess been resolved for Twisted's API?) http://twistedmatrix

Re: smtplib starttls gmail example

2007-01-23 Thread Jean-Paul Calderone
27;, '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', messageText, contextFactory=contextFactory) reactor.connectTCP('smtp.gmail.com', 25, factory) result.addCallback(lambda ign: reactor.stop()) reactor.run() Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: smtplib starttls gmail example

2007-01-23 Thread Jean-Paul Calderone
On Tue, 23 Jan 2007 23:48:59 GMT, py <[EMAIL PROTECTED]> wrote: >Hi, Jean Paul. > >I read your code with interest. I wonder, does twisted also raise the socket >error or does it know >about this apparently well-known and often ignored incompatibility between th

Re: Module for SVG?

2007-01-25 Thread Jean-François Piéronne
Sebastian Bassi a écrit : > Hello, > > I found http://www2.sfk.nl/svg as a Python module for writing SVG. > Last update was in 2004 and I am not sure if there is something > better. > Any recommendation for generating SVG graphics? I have ported to Python the Ruby SVG graph generation library htt

Re: Trouble with max() and __cmp__()

2007-01-28 Thread Jean-Paul Calderone
, x()].sort() >>> [z(), z(), z()].sort() >>> [y(), y(), y()].sort() yes yes >>> So, if you implement __gt__, max will work right. If you also implement __le__, sorting will work right. Your best bet is probably to implement all of the rich comparison methods. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing Javascript, then reading value

2007-01-29 Thread Jean-Paul Calderone
o the stand-alone Spidermonkey runtime. However, it lacks the DOM APIs, so it may not be able to run the JavaScript you are interested in running. There are a couple other JavaScript runtimes available, at least. If Spidermonkey is not suitable, you might look into one of them. Jean-Paul -- http:

Re: Synchronous shutil.copyfile()

2007-01-30 Thread Jean-Paul Calderone
ileobj(fsrc, fdst) finally: if fdst: fdst.close() if fsrc: fsrc.close() The problem you are experiencing must have a different cause. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Help me understand this

2007-01-30 Thread Jean-Paul Calderone
integer | floatnumber | >imagnumber > >An integer is a primary so 2.__add(1) should be valid. A float is, too. 2.__add is a float followed by an identifier. Not legal. As pointed out elsewhere in the thread, (2). forces it to be an integer followed by a ".". Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

<    5   6   7   8   9   10   11   12   13   14   >