Re: socket and subprocess problem

2008-12-18 Thread James Mills
On Thu, Dec 18, 2008 at 8:00 PM, Bryan Olson wrote: > I'd swear James copied my response, except his came first. Even the > formatting came out similar. I hadn't seen his response when I wrote mine, > and wouldn't have bothered posing the same thing again. Great minds think alike huh :) You shoul

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 8:18 AM, Martin Manns wrote: > Hi: Hi, > I am writing a spreadsheet application in Python What's wrong with pyspread ? [ ... snip ... ] > The dict that I tried out is of the type: > > {(1,2,3): "2323", (1,2,545): "2324234", ... } > > It is too slow for my application w

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 8:52 AM, Robert Kern wrote: > pyspread *is* the spreadsheet application he is writing. Oh :) My bad :) --JamesMills -- http://mail.python.org/mailman/listinfo/python-list

Re: importing csv file into sqlite

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina wrote: > But your code does *exactly* that, it reads the whole file in memory: > >> def mkBuffer(fd): >> buffer = StringIO() >> buffer.write(fd.read()) >> ... > > That mkBuffer function has no useful purpose IMHO, just remove it. It was a mis

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina wrote: > En Thu, 18 Dec 2008 17:37:35 -0200, escribió: > >> I am trying to write a simple application to factor polynomials. I >> wrote (simple) raw_input lines to collect the a, b, and c values from >> the user, but I dont know how to implement

Re: Factoring Polynomials

2008-12-18 Thread James Mills
Hi Collin, Here you go: jmi...@atomant:~/tmp$ cat polycalc.py #!/usr/bin/env python from math import sqrt def f(a, b, c): if (b**2 - (4 * a * c)) < 0: return None, None # Can't solve x = (-1 * b) + (((b**2 - (4 * a * c)) ** 0.5) / (2 * a)) return (-1 * x), x print "Polynomi

Re: Factoring Polynomials

2008-12-18 Thread James Mills
UPDATE: jmi...@atomant:~/tmp$ cat polycalc.py #!/usr/bin/env python from math import sqrt def f(a, b, c): if (b**2 - (4 * a * c)) < 0: return None, None # Can't solve x1 = -b - (sqrt(b**2 - (4 * a * c)) / (2 * a)) x2 = -b + (sqrt(b**2 - (4 * a * c)) / (2 * a)) return x1,

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:49 AM, wrote: > On Fri, 19 Dec 2008 08:33:28 +1000 > "James Mills" wrote: > >> > The dict that I tried out is of the type: >> > >> > {(1,2,3): "2323", (1,2,545): "2324234", ... } >> > >&

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 11:37 AM, Collin D wrote: > Ahh. Great.. that answers a lot of questions. > Originally I was using just a = raw_input('a: ') > And was getting errors because you cant perform mathmatical operations > on strings. >.< > Thanks again! No worries. Please take an hour or two to

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 12:48 PM, Collin D wrote: > UPDATE: > > #import > from math import sqrt > > # collect data > a = float(raw_input('Type a value: ')) > b = float(raw_input('Type b value: ')) > c = float(raw_input('Type c value: ')) > > # create solver > def solver(a,b,c): >disc = b**2 -

Re: importing csv file into sqlite

2008-12-19 Thread James Mills
On Fri, Dec 19, 2008 at 8:32 PM, Peter Otten <[email protected]> wrote: > James Mills wrote: > >> values = ",".join(["\"%s\"" % x for x in line]) >> print "INSERT INTO %s %s VALUES (%s);" % (table, fields, values) > > htt

Re: Python is slow

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 4:47 AM, r wrote: > Could not have said it better myself Luis, i stay as far away from C > as i can. But there are usage cases for it. If you can think of 1 typical common case I'll reward you with praise! :) By the way, by common and typical I mean use-cases that you'd t

Re: Twisted for non-networking applications

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 4:27 AM, Kottiyath wrote: > Hi all, > Is it a good idea to use Twisted inside my application, even though > it has no networking part in it? > Basically, my application needs lots of parallel processing - but I > am rather averse to using threads - due to myraid issues

Re: Are python objects thread-safe?

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 4:51 AM, RajNewbie wrote: > Say, I have two threads, updating the same dictionary object - but for > different parameters: > Please find an example below: > a = {file1Data : '', > file2Data : ''} > > Now, I send it to two different threads, both of which are looping >

Re: Threads, forks, multiplexing - oh my

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 11:36 AM, Thomas Raef wrote: > I now want to run multiple instances of this program on a client, after > receiving the command line and args from a broker, dispatcher, whatever you > want to call it. You can use the subprocess module. > I've read where forks will run prog

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 11:37 AM, alex23 wrote: > On Dec 21, 10:11 am, r wrote: >> Most of the complaints i hear are the redundant use of self. >> Which I lamented about but have become accustom(brainwashed) to it. I >> would remove this if it where up to me. > > It's a shame Python wasn't releas

Re: Twisted for non-networking applications

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 3:25 PM, RajNewbie wrote: > I was unable to see documentation explaining this - so asking again. Documentation is available here: http://trac.softcircuit.com.au/circuits/wiki/docs And here: pydoc circuits The code itself is heavily documented. I'm still writing better onl

Re: How to represent a sequence of raw bytes

2008-12-22 Thread James Mills
On Mon, Dec 22, 2008 at 4:56 PM, Steven Woody wrote: > I thing "\x11\x22\x33" in python is not the {0x11, 0x22, 0x33} in C. > Since, a string in python is immutable, I can _not_ do something like: > b[1] = "\x55". > > And, how about char buf[200] in my original question? The intension > is to al

Re: Are Django/Turbogears too specific?

2008-12-22 Thread James Mills
On Tue, Dec 23, 2008 at 12:35 AM, Philip Semanchuk wrote: > > On Dec 22, 2008, at 1:52 AM, Tino Wildenhain wrote: > >> Philip Semanchuk wrote: >> ... >>> >>> I prefer Mako over the other template languages I've seen. >> >> From what I can tell Mako is nearly identical to all other >> template lang

Re: Event Driven programming - Doubts

2008-12-22 Thread James Mills
On Tue, Dec 23, 2008 at 12:57 AM, Kottiyath wrote: > Hi, >I have been looking at Twisted and lately Circuits as examples for > event driven programming in Python. Wonderful! :) "circuits" that is :) >Even though I understood how to implement the code in these and > what is deferred etc,

Re: Python is slow

2008-12-22 Thread James Mills
On Tue, Dec 23, 2008 at 4:42 AM, cm_gui wrote: > i am referring mainly to Python for web applications. > > Python is slow. Please just go away. You are making an embarrassment of yourself. --JamesMills -- http://mail.python.org/mailman/listinfo/python-list

Re: why cannot assign to function call

2008-12-28 Thread James Mills
On Mon, Dec 29, 2008 at 4:01 PM, scsoce wrote: > I have a function return a reference, and want to assign to the reference, > simply like this: >>>def f(a) > return a >b = 0 > * f( b ) = 1* > but the last line will be refused as "can't assign to function call". > In my thought , the

Re: multiprocessing vs thread performance

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 12:52 AM, mk wrote: > Hello everyone, > > After reading http://www.python.org/dev/peps/pep-0371/ I was under > impression that performance of multiprocessing package is similar to that of > thread / threading. However, to familiarize myself with both packages I > wrote my o

Re: get method

2008-12-29 Thread James Mills
ns a dictionary of all the letters to any string s I > give it but each corresponding value is incorrectly the default of 0. > What am I doing wrong? Ross, the others have informed you that you are not actually incrementing the count. I'll assume you've fixed your function now :) ..

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:32 AM, James Mills wrote: > Ross, the others have informed you that you are not > actually incrementing the count. I'll assume you've > fixed your function now :) ... I want to show you a far > simpler way to do this which takes advant

Re: multiprocessing vs thread performance

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote: > The OP may be interested in Erlang, which Wikipedia (end-all, be-all) > claims is a 'distribution oriented language'. I would suggest to the OP that he take a look at circuits (1) an event framework with a focus on component architectures and

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:38 AM, Ross wrote: > I realize the code isn't counting, but how am I to do this without > using an if statement as the problem instructs? I just gave you a hint :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in C

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:32 AM, Chris Rebert wrote: > On Mon, Dec 29, 2008 at 5:22 PM, wrote: > >> 2. Have there been any suggestions in the past to rewrite Python's >> mainstream implementation in C++ (or why wasn't it done this way from >> the beginning)? > > I'm not a CPython dev (I bet on

Re: get method

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 11:43 AM, James Mills wrote: > On Tue, Dec 30, 2008 at 11:38 AM, Ross wrote: >> I realize the code isn't counting, but how am I to do this without >> using an if statement as the problem instructs? > > I just gave you a hint :) Ross: This exe

Re: multiprocessing vs thread performance

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 12:52 PM, Aaron Brady wrote: > On Dec 29, 7:40 pm, "James Mills" > wrote: >> On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote: >> > The OP may be interested in Erlang, which Wikipedia (end-all, be-all) >> > claims is a 'd

Re: print a vs print '%s' % a vs print '%f' a

2008-12-29 Thread James Mills
On Tue, Dec 30, 2008 at 1:19 PM, David Cournapeau wrote: (... snip ...) > print '%f' % a # -> print '1.#INF' Would this not be controlled by: 1. float(a) or a.__float__() 2. tp_print cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: get method

2008-12-30 Thread James Mills
On Tue, Dec 30, 2008 at 7:10 PM, Roel Schroeven wrote: > Hm, you just changed an O(n) algorithm to an O(n**2) algorithm. No big > deal for short strings, but try your solution on a string with length > 1 and see the difference. On my computer the O(n) version takes > 0.008 seconds, while your

Re: multiprocessing vs thread performance

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 12:29 AM, Aaron Brady wrote: > James, Hi. I'm glad you asked; I never know how "out there" my > comments are (but surmise that feedback is always a good thing). What > I was thinking was, I didn't know Virtual Synchrony, and I've never > used Erlang, but I'm interested in

[ANN]: circuits-1.0b1 released!

2008-12-30 Thread James Mills
Hi all, I'm pleased to announce the release of circuits-1.0b1 Overview == circuits is an event-driven framework with a focus on Component Software Architectures where System Functionality is defined in Components. Components communicate with one another by propagating events throughout the s

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 9:15 AM, MRAB wrote: (snip) > A while back I posted a Python implementation of 'bag' (also called a > multiset). The code would then become something like: What complexity is this ? cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN]: circuits-1.0b1 released!

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:00 AM, John Krukoff wrote: > I'm curious, you've a number of comparisons to Twisted on your site FAQ > section, but this sounds like a much closer project to Kamaelia > (http://www.kamaelia.org/Home). Are these actually similar or am I > missing something important that

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:22 AM, John Machin wrote: (snip) > The "crawl through the shrubbery looking for evidence" approach > stumbles on the actual code: Yes I found his implementation soon after :) Not bad actually... I wonder why bag() isn't shipped with the std lib - perhaps in teh set mod

Re: multiprocessing vs thread performance

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 8:42 AM, James Mills wrote: (snip) > As I continue to develop circuits and improve it's > core design as well as building it's ever growing set > of Components, I try to keep it as general as > possible - my main aim though is distributed > pro

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:49 AM, Steven D'Aprano wrote: > What set module? Sorry I must have meant the collections module :) > Adding a multi-set or bag class to the collections module would be a good > idea though. Perhaps you should put in a feature request? :) Perhaps I will. cheers James

Re: get method

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 10:54 AM, MRAB wrote: > Occasionally someone posts here wanting to count items and solutions > involving dict or defaultdict are suggested, and I think that a 'bag' class > would be useful. The 'set' class was introduced first in a module, but it > soon became a builtin. My

greenlets and how they can be used

2008-12-30 Thread James Mills
Hey all, The "greenlet" from http://codespeak.net/py/dist/greenlet.html is a rather interesting way of handling flow of control. I can't seem to find anything else on the subject except for the above link and the most recent version 0.2 and it's tests. What can "greenlet"'s be used for ? What us

Re: How to get back a list object from its string representation?

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 2:46 PM, Harish Vishwanath wrote: > Hello, > Consider : li = [1,2,3] repr(li) > '[1, 2, 3]' > Is there a standard way to get back li, from repr(li) ? Normally you would use eval(..) however this is considered by many to be evil and bad practise (especially by me!

Re: MemoryError when list append... plz help

2008-12-30 Thread James Mills
(Sorry for top posting): You are mad! Why on God's earth would you want to create a list containing 60 MILLION elements ? What is the use case ? What are you solving ? You may have 4G of ram, but I very seriously doubt you have 4G of ram available to Python. I have no idea how many bytes of mem

Re: MemoryError when list append... plz help

2008-12-30 Thread James Mills
On Wed, Dec 31, 2008 at 4:17 PM, James Mills wrote: > I have no idea how many bytes of memory > storing each element of a list consumes > let alone each float object, but I assure you > it's not going to be anywhere near that of > 60494500 4-bytes spaces (do floats in C > n

Re: greenlets and how they can be used

2008-12-31 Thread James Mills
On Thu, Jan 1, 2009 at 9:24 AM, Aaron Brady wrote: (snip) > I had a dream for a while that in a GUI framework, every event would > spawn a unique thread. The GUI would remain responsive even while > executing minor tasks. Of course, shaving a second off running time > isn't exactly mission-crit

Re: greenlets and how they can be used

2009-01-04 Thread James Mills
On Sun, Jan 4, 2009 at 4:52 AM, Benjamin Walkenhorst wrote: > Back when I was still using Perl, there was - and still is, I guess - a > really nice framework called POE, that allowed you to write event-driven > state machines in a really easy and pleasant way. Under POE, EVERYTHING was > an eve

Re: structuring a package?

2009-01-04 Thread James Mills
On Mon, Jan 5, 2009 at 10:17 AM, Torsten Mohr wrote: > It looks natural to me to write in a code that uses the package: > > import graphic > import graphic.square > import graphic.circle > > That way i'd have to structure the code like this: > > graphic/ > __init__,py (GraphicObject) > square.p

Re: Code coverage to Python code

2009-01-04 Thread James Mills
On Sun, Jan 4, 2009 at 9:35 PM, Hussein B wrote: > What is the best code coverage tool available for Python? I like ot use nose with it's coverage plugin. easy_install nose easy_install co And I use the following in my top-level Makefile tests: @nosetests \ --with-coverage \ --c

Re: Noob question: Is all this typecasting normal?

2009-01-04 Thread James Mills
On Mon, Jan 5, 2009 at 1:47 PM, sprad wrote: > On Jan 3, 6:41 pm, Steven D'Aprano cybersource.com.au> wrote: >> The OP comes from a Perl background, which AFAIK allows you to concat >> numbers to strings and add strings to numbers. That's probably the (mis) >> feature he was hoping Python had. I

Re: greenlets and how they can be used

2009-01-05 Thread James Mills
On Tue, Jan 6, 2009 at 4:39 AM, Benjamin Walkenhorst wrote: > James Mills wrote: >> On Sun, Jan 4, 2009 at 4:52 AM, Benjamin Walkenhorst wrote: >>> POE was one of the nicest software frameworks I have ever used, and I've >>> been continuously frustrated by the la

Re: Measuring bytes of packet sent from python application

2009-01-05 Thread James Mills
On Tue, Jan 6, 2009 at 8:26 AM, Kangkook Jee wrote: > I'd like to measure number of bytes sent(or recv'd) from my python > application. Does anyone have any idea how can I achieve this? > > I tried to do this by tracing some socket calls (send, sendto, sendAll) > using 'metaclass' but I could fin

Re: socket send help

2009-01-05 Thread James Mills
On Tue, Jan 6, 2009 at 10:49 AM, Bryan Olson wrote: >> I thought a firewall would block an attempt to bind to any routeable >> address, but not to localhost. So using INADDR_ANY would be rejected. No. > My understanding is that firewalls block network traffic, not system calls. This is correct.

Re: socket send help

2009-01-05 Thread James Mills
On Wed, Dec 24, 2008 at 3:59 PM, [email protected] wrote: (snip) > If I run testserver.py via the cmd prompt in Windows XP and then the > testclient.py program, I get the following error: > > Traceback (most recent call last): > File "C:\Python30\testclient.py", line 12, in >s.send('Hello

Re: Is there a best linux distro for a python hobbyist?

2009-01-05 Thread James Mills
On Tue, Jan 6, 2009 at 11:11 AM, alex goretoy wrote: > +1 for ubuntu +1 for Ubuntu also (for the novice and ex-windows user(s)) +2 for CRUX (1) cheers James 1. http://crux.nu/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 8:54 AM, Ken D'Ambrosio wrote: > Hi, all. As a recovering Perl guy, I have to admit I don't quite "get" > the re module. For example, I'd like to do a few things (I'm going to use > phone numbers, 'cause that's what I'm currently dealing with): > 12345678900 -- How would I

Re: An idea of how to identify Israeli owned software companies

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 9:24 AM, Steve Holden wrote: (...) > OK, that's enough non-Python ramblings for this thread. God I wish we could delete threads :) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions...

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 10:03 AM, James Stroud wrote: (...) > Indeed it seems you are recovering from an especially bad case. I recommend > two doses of the python cookbook per day for one to two months. Report back > here after your first cycle and we'll tell you how you are doing. I'm very > opti

Re: multiprocessing vs thread performance

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 10:55 AM, Arash Arfaee wrote: > Hi All , HI :) > Does anybody know any tutorial for python 2.6 multiprocessing? Or bunch of > good example for it? I am trying to break a loop to run it over multiple > core in a system. And I need to return an integer value as the result of

subclassing multiprocessing.Process

2009-01-07 Thread James Mills
Hey all, Just a quick clarification on multiprocessing' Process object. If I were to subclass this, say: class Foo(Process): def foo(self): ... def run(self): ... Would the parent and child objects be identical ? That is, would the same methods of Foo exist in the child ? Ba

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:08 PM, Shane wrote: > Consider a network of 3 fully-connected boxes i.e. every box as a TCP- > IP connection to every other box. > > Suppose you start a python program P on box A. Is there a Python > mechanism for P to send a copy of itself to box B or C then start that >

asynchronous events with multithreading and multiprocessing with circuits

2009-01-07 Thread James Mills
Hi folks, For those interested, I have just completed implementing multiprocessing support for circuits (1). It has historically always had multithreading support. These components can be found in circuits.workers and are called: Thread and Process The reason these exist is to perform "work", ie:

Re: asynchronous events with multithreading and multiprocessing with circuits

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:45 PM, James Mills wrote: > For those interested, I have just completed implementing > multiprocessing support for circuits (1). (...) PS: circuits can be found on PyPi or here: http://trac.softcircuits.com.au/circuits/ The code/support I mentioned is in the devel

Re: parallel and/or synchronous start/run/stop on multiple boxes

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:44 PM, Ned Deily wrote: > The multiprocessing module, new in the 2.6 standard library and > available in PyPi as a backport to 2.4 and 2.5, supports managing of > processes on both local and remote machines. The 2.6 module > documentation has an "example/demo of how to us

Re: frontend + backend style application design

2009-01-07 Thread James Mills
On Thu, Jan 8, 2009 at 3:56 PM, Steven Woody wrote: > I am considering write an application, its core functionalities should > be implemented in a command-line application with which a user can > interact via its command line interface. This kind of command line > interface can help batch usage of

Re: Multiprocessing takes higher execution time

2009-01-08 Thread James Mills
On Thu, Jan 8, 2009 at 7:31 PM, Nick Craig-Wood wrote: (...) > How many projects are you processing at once? And how many MB of zip > files is it? As reading zip files does lots of disk IO I would guess > it is disk limited rather than anything else, which explains why doing > many at once is a

Re: BadZipfile "file is not a zip file"

2009-01-08 Thread James Mills
On Fri, Jan 9, 2009 at 11:28 AM, webcomm wrote: > Hmm. When I open it in Windows or with 7-Zip, it contains a text file > that has the data I would expect it to have. I guess that alone > doesn't necessarily prove it's a zip file? > > datum is something I'm downloading via a web service. The pr

Re: Implementing file reading in C/Python

2009-01-08 Thread James Mills
On Fri, Jan 9, 2009 at 1:04 PM, Johannes Bauer wrote: > Hello group, Hello. (...) > Which takes about 40 seconds. I want the niceness of Python but a little > more speed than I'm getting (I'd settle for factor 2 or 3 slower, but > factor 30 is just too much). > > Can anyone point out how to sol

Re: Implementing file reading in C/Python

2009-01-08 Thread James Mills
On Fri, Jan 9, 2009 at 3:13 PM, Johannes Bauer wrote: > Uhh, yes, you're right there... I must admit that I was too lazy to > include all the stat headers and to a proper st_size check in the C > version (just a quick hack), so it's practically hardcoded. > > With files of exactly 2GB in size the

Re: Best practice in organize classes into modules

2009-01-08 Thread James Mills
On Fri, Jan 9, 2009 at 2:57 PM, Steven Woody wrote: > In C++/Java, people usually put one class into one file. What's the > suggestion on this topic in Python? I so much interesting this > especially when exception classes also involved. Normally i group related functionality into the one modul

Re: Implementing file reading in C/Python

2009-01-08 Thread James Mills
On Fri, Jan 9, 2009 at 2:29 PM, James Mills wrote: > I shall attempt to optimize this :) > I have a funny feeling you might be caught up with > some features of Python - one notable one being that > some things in Python are immutable. > > psyco might help here though ... Wha

Re: Implementing file reading in C/Python

2009-01-09 Thread James Mills
On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch wrote: >> print("Filesize : %d" % (filesize)) print("Image size : %dx%d" >> % (width, height)) print("Bytes per Pixel: %d" % (blocksize)) > > Why parentheses around ``print``\s "argument"? In Python <3 ``print`` is > a statement a

Re: Implementing file reading in C/Python

2009-01-09 Thread James Mills
On Fri, Jan 9, 2009 at 7:41 PM, Marc 'BlackJack' Rintsch wrote: > Please read again what I wrote. Lol I thought "<3" was a smiley! :) Sorry! cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Is PyFIT dead and abandoned?

2008-10-06 Thread James Mills
On Tue, Oct 7, 2008 at 5:18 AM, <[EMAIL PROTECTED]> wrote: > Has PyFIT been completely abandoned? Is there a better alternative or > other resources to help me integrate fitnesse and python? I for one am not interested in this kind of framework for testing - and yet I come from a strict Software

Re: Pure Python interface to MySQL?

2008-10-06 Thread James Mills
On Tue, Oct 7, 2008 at 9:15 AM, Roy Smith <[EMAIL PROTECTED]> wrote: > Does there exist a pure Python version of a MySQL module? I've got a data > logging application that needs to run on a whole bunch of OSs, ranging from > Windows to a dozen different unix flavors on all sorts of hardware. > > P

Re: HARD REAL TIME PYTHON

2008-10-06 Thread James Mills
On Tue, Oct 7, 2008 at 9:25 AM, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: > close to real time constraints? For example is it possible to develop a > python program that can address an interrupt or execute an operation > within 70 Hz or less?? Are there any additional considerations that I > sh

Re: HARD REAL TIME PYTHON

2008-10-06 Thread James Mills
On Tue, Oct 7, 2008 at 11:48 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > Indeed, this looks wrong - or at least inconclusive. The benchmark > above demonstrates throughput, not minimum (or maximum, or average, > or any other statistic) response latency, which is what the OP was > really a

Re: Pure Python interface to MySQL?

2008-10-06 Thread James Mills
On Tue, Oct 7, 2008 at 2:12 PM, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > Will you be asking for a pure python implementation of mysql > in the next question? ;) Why not use the proxy approach (for > example via xmlrpc) as suggested by James or just spill to > a file? :-) You could for example

Re: If an OS was to be written in Python, how'w it look?

2008-10-07 Thread James Mills
On Tue, Oct 7, 2008 at 4:02 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > There was an experiment ("Unununium"), now abandoned: http://unununium.org/ Yeah does anyone have or know where one can get the source code and any other materials relating to Unununium ? It not only seems to be abando

Re: HARD REAL TIME PYTHON

2008-10-07 Thread James Mills
On Tue, Oct 7, 2008 at 6:42 PM, <[EMAIL PROTECTED]> wrote: > AFAIK, the requirement for hard real time, is that response time have > to be predictable, rather than > generally 'fast'. > Very high level languages like python use many features which are by > their nature unpredictable or > difficult

Re: HARD REAL TIME PYTHON

2008-10-07 Thread James Mills
On Tue, Oct 7, 2008 at 7:27 PM, Kurt Mueller <[EMAIL PROTECTED]> wrote: > To be more helpful, we should know what you mean by "HARD REAL TIME". > Do you mean: > - Handle at least 70 interrupt per second("SPEED") > - If one fails, this is catastrophic for the application ("HARD")

Re: If an OS was to be written in Python, how'w it look?

2008-10-07 Thread James Mills
On Wed, Oct 8, 2008 at 10:40 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > web.archive.org contains the site history: > http://web.archive.org/web/*re_/http://www.unununium.org > Going back to Jan 2007 is enough to discover that their repository was at > http://www.unununium.org/darcs/ - and i

Re: distributing apps without the Python source?

2008-10-08 Thread James Mills
On Thu, Oct 9, 2008 at 4:19 AM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch a écrit : >> >> On Wed, 08 Oct 2008 10:59:44 -0500, skip wrote: >>> Though of course there is decompyle to consider, assuming Joe's client >>> is truly paranoid. >> >> Simply don't tell the cli

Re: Safe eval of insecure strings containing Python data structures?

2008-10-08 Thread James Mills
On Thu, Oct 9, 2008 at 2:26 PM, Warren DeLano <[EMAIL PROTECTED]> wrote: > JSON rocks! Thanks everyone. Yes it does :) > Ben wrote: > >>More generally, you should never execute (via eval, exec, or whatever) >>*any* instruction from an untrusted path; especially not arbitrary >>data from an input

epoll socket server

2008-10-09 Thread James Mills
Does anyone have any simple examples of using Python 2.6/3.0's epoll with a simpler socket (tcp) server ? Thanks, cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: HARD REAL TIME PYTHON

2008-10-10 Thread James Mills
On 10/7/08, James Mills <[EMAIL PROTECTED]> wrote: > I shall do some latency benchmarks ok :) Out of curiosity I modifed my bench marking tool for my event/component library (pymills) and here are the results: ~/pymills/examples/event $ ./bench.py -m latency -t 10 Setting up lat

Re: better scheduler with correct sleep times

2008-10-18 Thread James Mills
On Sat, Oct 18, 2008 at 10:09 PM, qvx <[EMAIL PROTECTED]> wrote: [ ... ] > Is there a better way or some library that does that? How about this ? $ ./timerexamples.py Time: 1224375945.336958 Timer 2 fired at: 1224375945.840600 Timer 1 fired at: 1224375955.336889 #!/usr/bin/env python import

Re: loops

2008-10-18 Thread James Mills
On Sun, Oct 19, 2008 at 1:30 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > for x in (2**i for i in xrange(10)): >print x This is by far the most concise solution I've seen so far. And it should never be about conserving code. Also, Python IS NOT C (to be more specific: Python is not a C-cla

Re: loops

2008-10-18 Thread James Mills
On Sun, Oct 19, 2008 at 1:44 PM, James Mills <[EMAIL PROTECTED]> wrote: > On Sun, Oct 19, 2008 at 1:30 PM, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> for x in (2**i for i in xrange(10)): >>print x > > This is by far the most concise solution I

Re: better scheduler with correct sleep times

2008-10-19 Thread James Mills
On Mon, Oct 20, 2008 at 5:31 AM, sokol <[EMAIL PROTECTED]> wrote: > >> from circuits.core import Manager, Component, Event, listener >> from circuits.timers import Timer > > what is circuits? If you're interested: An event framework with a focus on Component architectures. It can be downloaded cu

Re: import a function from bash to python? -HELP!-

2008-10-21 Thread James Mills
On Wed, Oct 22, 2008 at 10:32 AM, gita ziabari <[EMAIL PROTECTED]> wrote: > Is is possible to import a function from bash to python? If so, what is the > syntax and how should I pass the input parameters? The only possibility is to use the subprocess module and this is a more general problem, one

Re: Create a message

2008-10-22 Thread James Mills
On Wed, Oct 22, 2008 at 8:21 PM, Amie <[EMAIL PROTECTED]> wrote: > I would like to know if it's possible to display a message using > python, if so can you show me an example. > I saw something like:" from twisted.python import log > log.msg" in some programs but am not too sure how it works Defin

Re: How can I handle the char immediately after its input, without waiting an endline?

2008-10-22 Thread James Mills
Lave, If you're doing this btw, you may want to look at the curses module or urwid (3rd-party). cheers James On Wed, Oct 22, 2008 at 9:17 PM, Lave <[EMAIL PROTECTED]> wrote: > Yes, it's what i want. Many thanks. > > BTW,python-list 's reply is so quick. I love it. I like you all guys. > > On 10/

Re: do export statement in Python script

2008-10-22 Thread James Mills
On Wed, Oct 22, 2008 at 9:19 PM, Simon Strobl <[EMAIL PROTECTED]> wrote: > #!/usr/bin/ > python > > import os > > os.system("export NLTK_DATA=/opt/nltk/data/") Try: os.environ["NLTK_DATA"] = "/opt/nltk/data/" if that doesn't work, consider wrapping up NLTK in a bash script that contains the shel

Re: socket programming (client-server) error

2008-10-22 Thread James Mills
On Wed, Oct 22, 2008 at 9:50 PM, ryan fox <[EMAIL PROTECTED]> wrote: > I guess its a firewall problem... How do i go abt it? > any help? See as it's most likely a firewall issue and a firewall that I'm not familiar with, I can't help here :/ Sorry. cheers James -- -- -- "Problems are solved

Re: Create a message

2008-10-22 Thread James Mills
On Wed, Oct 22, 2008 at 9:23 PM, Amie <[EMAIL PROTECTED]> wrote: > for example, I wanna display a message that contains a persons age > from the database like so: "Your age is 25". kind of like a messagebox Amie, you're just picking random behavioral examples that you've seen in the software world

Re: socket programming (client-server) error

2008-10-22 Thread James Mills
On Thu, Oct 23, 2008 at 1:49 PM, ryan <[EMAIL PROTECTED]> wrote: > any ideas? As mentioned before, try: * Turning _off_ _all_ _firewalls_. cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Style questions

2008-10-23 Thread James Mills
David, Here's a "good" example (NB: subjective): http://hg.softcircuit.com.au/index.wsgi/circuits/file/251bce4b92fd/circuits/core.py On Fri, Oct 24, 2008 at 10:04 AM, David Di Biase <[EMAIL PROTECTED]> wrote: > I have a few simple questions regarding python style standards. I have a > class cont

Re: How to examine the inheritance of a class?

2008-10-23 Thread James Mills
On Fri, Oct 24, 2008 at 11:36 AM, John Ladasky <[EMAIL PROTECTED]> wrote: > etc. The list of subclasses is not fully defined. It is supposed to > be extensible by the user. Developer. NOT User. Consider: $ python Python 2.5.2 (r252:60911, Oct 13 2008, 15:09:03) [GCC 4.2.4 (CRUX)] on linux2 Typ

Re: Question about interpreter

2008-10-23 Thread James Mills
On Fri, Oct 24, 2008 at 12:55 PM, Usman Ajmal <[EMAIL PROTECTED]> wrote: > An interpreter which Python also uses, translates and checks for errors in > code, one line at a time. > > Question: Does interpreter also executes the translated code? http://en.wikipedia.org/wiki/Evaluate --JamesMills -

Re: How to get the actual address of a object

2008-10-23 Thread James Mills
On Fri, Oct 24, 2008 at 2:51 PM, <[EMAIL PROTECTED]> wrote: > Hi,I have a strange idea:is there any way to get memory address of a > object. id(obj) Example: >>> x = 10 >>> id(x) 134536908 But this probably (most likely) isn't it's address in memory but more it's unique identifier that separa

<    1   2   3   4   5   6   >