Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 8:52 AM, Robert Kern robert.k...@gmail.com 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 gagsl-...@yahoo.com.ar 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.

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 18 Dec 2008 17:37:35 -0200, collin.da...@gmail.com 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

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

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, mma...@gmx.net wrote: On Fri, 19 Dec 2008 08:33:28 +1000 James Mills prolo...@shortcircuit.net.au wrote: 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 when it grows. One slicing

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 11:37 AM, Collin D collin.da...@gmail.com 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

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 12:48 PM, Collin D collin.da...@gmail.com 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

Re: The rule of literal string

2008-12-17 Thread James Mills
On Thu, Dec 18, 2008 at 9:25 AM, Chris Rebert c...@rebertia.com wrote: As I stated previously, the key rule is: eval(repr(something)) == something This rule is only true for basic data types; For example: eval(repr(1)) == 1 True eval(repr([1, 2, 3])) == [1, 2, 3] True eval(repr({a: 1, b:

Re: importing csv file into sqlite

2008-12-17 Thread James Mills
csv2sql.py tool (1): #!/usr/bin/env python # Module: csv2sql # Date: 14th September 2008 # Author: James Mills, prologic at shortcircuit dot net dot au csv2sql Tool to convert CSV data files into SQL statements that can be used

Re: Python is slow

2008-12-16 Thread James Mills
n Wed, Dec 17, 2008 at 8:24 AM, r rt8...@gmail.com wrote: What kind of performance problem have you find in python that makes you so unhappy? What are you going to do with all the extra speed provided by c++ (a Hello World! ?)... Still no reply from cm_gui, he must have googled C hello world

Re: Python is slow

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 9:08 AM, r rt8...@gmail.com wrote: What about all the crap you had to go through just to get output? Python wins Yes I can't say I really enjoy writing C (at all!) _except_ in the case where I may need to optimise some heavy computation. But then again with multi-core

Re: Free place to host python files?

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 10:25 AM, Chris Rebert c...@rebertia.com wrote: I'll plug Bitbucket (http://bitbucket.org/). It gives you 150MB of Mercurial hosting for free, along with a bug tracker and wiki. And I hear it's implemented using Django. FreeHG (http://freehg.org) is pretty good too :)

Re: How to modify a program while it's running?

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 11:26 AM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: So I'd like to restructure my app so that it can stay running and stay logged in, yet I can still update and reload at least most of the code. But I'm not sure what's the best way to do this. Should I

Re: How to modify a program while it's running?

2008-12-16 Thread James Mills
@Aaron Your code and suggestion is way too complicated. Just register your objects. When you need to reload your module, destroy the existing objects and re-creat them. This works well assuming you have a stable running core that maintains the connection and that code doesn't change much.

Re: Python is slow

2008-12-15 Thread James Mills
On Mon, Dec 15, 2008 at 5:26 PM, Andreas Kostyrka andr...@kostyrka.org wrote: So to summarize, Python is fast enough for even demanding stuff, and when done correctly even number crunching or binary parsing huge files or possible in competitive speeds. But you sometime need a developer that

Re: Having Issues with CMD and the 'python' command

2008-12-15 Thread James Mills
cmd has _nothing_ to do with Python. --JamesMills -- -- Problems are solved by method On Mon, Dec 15, 2008 at 10:51 PM, Lamonte Harris pyth0nc0...@gmail.com wrote: Every time I start cmd on windows it requires me to set path=%path%;C:\python26 why? I'm getting annoyed... --

Re: parse C expression?

2008-12-15 Thread James Mills
On Tue, Dec 16, 2008 at 9:48 AM, Torsten Mohr tm...@s.netic.de wrote: Hi, i found some examples when googling for the subject but nothing really matched. Is there a standard module available that lets me parse a syntax like C with numbers, operators, braces, variables and function calls?

Re: ethical questions about global variables

2008-12-15 Thread James Mills
On Tue, Dec 16, 2008 at 12:45 PM, Giampaolo Rodola' gne...@gmail.com wrote: Hi, in a module of mine (ftpserver.py) I'd want to add a (boolean) global variable named use_gmt_times to decide whether the server has to return times in GMT or localtime but I'm not sure if it is a good idea because

Re: Copying files in directory

2008-12-15 Thread James Mills
On Tue, Dec 16, 2008 at 12:49 PM, pacsciad...@gmail.com wrote: I'm writing a project management system, and I need the ability to accept a directory name and move its contents to another directory. Can someone give me a code sample that will handle this? I can't find any copying functions in

Re: socket and subprocess problem

2008-12-15 Thread James Mills
On Tue, Dec 16, 2008 at 3:30 PM, goat...@gmail.com wrote: Guys thanks to point it out. Yes, it's a race problem. I tried sleep long enough, then I can connect to the socket. I should add code to try to connect to the socket for a given time out. This is where event-driven approaches become

Re: XMPP xmpppy - User Authorization

2008-12-14 Thread James Mills
On Sun, Dec 14, 2008 at 3:47 PM, Henson mrn...@gmail.com wrote: In my own bot, using the latest xmpppy, I've been printing everything going to the message handler to the screen. I've yet to see a 'subscribe' string. Has this changed? No this hasn't changed. This is the string you need to

Re: Python 3.0 crashes displaying Unicode at interactive prompt

2008-12-14 Thread James Mills
On Mon, Dec 15, 2008 at 9:03 AM, Fuzzyman fuzzy...@gmail.com wrote: It seems to me to be a generally accepted term when an application stops due to an unhandled error to say that it crashed. it == application Yes. #!/usr/bin/env python from traceback import format_exc

Re: Python is slow

2008-12-14 Thread James Mills
On Mon, Dec 15, 2008 at 2:44 PM, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Dec 14, 2008 at 11:38 PM, cm_gui cmg...@gmail.com wrote: hahaha, do you know how much money they are spending on hardware to make youtube.com fast??? Obviously not enough to get to the point where it's

Re: Python is slow

2008-12-14 Thread James Mills
On Mon, Dec 15, 2008 at 2:59 PM, James Mills prolo...@shortcircuit.net.au wrote: On Mon, Dec 15, 2008 at 2:44 PM, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Dec 14, 2008 at 11:38 PM, cm_gui cmg...@gmail.com wrote: hahaha, do you know how much money they are spending on hardware

Re: Bidirectional Networking

2008-12-12 Thread James Mills
Just as a matter of completeness for my own suggestion, here is my implementation of your code (using circuits): cheers James -- import random from circuits import listener, Event, Manager from circuits.lib.sockets import TCPServer, TCPClient class Server(TCPServer):

Re: How can I understan the for here?

2008-12-11 Thread James Mills
On Fri, Dec 12, 2008 at 12:44 AM, Kermit Mei [EMAIL PROTECTED] wrote: I can't understand the second sentence because of the for ... in. I consider that the syntactics of for should be: for k,v in params.items(): .. But there's no a colon here, why it can work? It's called a list

Re: Bidirectional Networking

2008-12-11 Thread James Mills
Have a look at circuits. http://trac.softcircuit.com.au/circuits/ It's a general purpose event-driven framework with a focus on Component architectures and has a good set of Networking Components, specifically: circuits.lib.sockets * TCPServer * TCPClient * UDPServer * UDPClient (alias of

Re: cx_Oracle issues

2008-12-10 Thread James Mills
On Thu, Dec 11, 2008 at 2:48 AM, huw_at1 [EMAIL PROTECTED] wrote: Any tips - i have never seen this error before but am guessing that the value being returned is too big for the buffer size set for the cursor. the procedure fetches data from a LOB. Any suggestions/confirmations? Could you

Re: Python is slow

2008-12-10 Thread James Mills
@em_gui: You are outrightly wrong. Why ? Python's VM is not slow! In fact it's quite fast. What does tend to be slow is sloppy poorly designed code. Django/Turbogears (sorry for any devs reading this) are large frameworks with a lot of complexity - and yes they tend to be a little cumbersome and

Re: List Problem

2008-12-09 Thread James Mills
On Wed, Dec 10, 2008 at 3:40 PM, dongzhi [EMAIL PROTECTED] wrote: If I execute part[1], I have got 'a'. If I execute part[2], I have got ' '. But, if I execute part[1::2], I have got ['a', '', '']. I don't know why. Please tell me why. Perhaps you meant: part[1:2] pydoc list This will tell

Re: Strengths and weaknesses of Pygame vs. pyglet vs. PyOpenGL?

2008-12-08 Thread James Mills
On Mon, Dec 8, 2008 at 6:31 PM, alex23 [EMAIL PROTECTED] wrote: On Dec 8, 2:26 pm, illume [EMAIL PROTECTED] wrote: pygame is simpler to learn, since it doesn't require you to know how to create classes or functions. I'm not sure if I'd be quick to tout that as an advantage... :) Neither

Re: A question about reference in Python.

2008-12-08 Thread James Mills
In case the OP is interested here is a more complete implementation (others are welcome to comment): http://codepad.org/drIhqb7Z Enjoy :) cheers James -- -- -- Problems are solved by method -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner trying to understand functions.

2008-12-08 Thread James Mills
On Mon, Dec 8, 2008 at 11:32 PM, simonh [EMAIL PROTECTED] wrote: That works fine. Then I've tried to use functions instead. The first two work fine, the third fails: [ ... snip ... ] Try this: def getName(): name = input('Please enter your name: ') print('Hello', name) return name

Re: Beginner trying to understand functions.

2008-12-08 Thread James Mills
On Tue, Dec 9, 2008 at 12:24 AM, cadmuxe [EMAIL PROTECTED] wrote: i think we should use raw_input('Please enter your name: ') instead of input('Please enter your name: ') Good point :) OP: Please take notes :) cheers James -- -- -- Problems are solved by method --

Re: Beginner trying to understand functions.

2008-12-08 Thread James Mills
On Tue, Dec 9, 2008 at 12:46 AM, Peter Otten [EMAIL PROTECTED] wrote: I think the OP is using Python 3.0. What used to cause trouble Well of course he/she/it is! I'm too blind to have noticed that! :) --JamesMills -- -- -- Problems are solved by method --

Re: infering the number of args a function takes at runtime

2008-12-07 Thread James Mills
On Mon, Dec 8, 2008 at 2:45 PM, Chris Rebert [EMAIL PROTECTED] wrote: On Sun, Dec 7, 2008 at 8:39 PM, sniffer [EMAIL PROTECTED] wrote: hi all, i am a python newbie, in a project currently doing i need to find out the number of arguments that a function takes at runtime.? Is this possible ,if

Re: A question about reference in Python.

2008-12-07 Thread James Mills
Hi, This is really really really pointless code and a really really pointless exercise, but nonetheless, here is a very very basic and minimal implementation of what you're expecting. This should almost *never* be done in Python! Python is a superior dynamic programming language, but it's NOT C!

Re: A question about reference in Python.

2008-12-07 Thread James Mills
On Mon, Dec 8, 2008 at 4:13 PM, Chris Rebert [EMAIL PROTECTED] wrote: The following three lines serve no purpose and can only lead to confusion: value = None prev = None next = None You are absolutely right :) Updated code: #!/home/jmills/bin/python -i class Node(object): def

Re: A question about reference in Python.

2008-12-07 Thread James Mills
On Mon, Dec 8, 2008 at 4:25 PM, Chris Rebert [EMAIL PROTECTED] wrote: No apology necessary of course, i just didn't want the newbie OP to pick up any bad Python coding habits. Apologies that I might have phrased my criticism a bit harshly. No not at all :) I do use class variables in some

Re: as keyword woes

2008-12-04 Thread James Mills
One of the things I'd like to point out here is what we've been learning in new job during Induction Training... That is, it's part of the coding standard and design standards to name variables sensibly. For instance, naming a variable db when it's really a database object is a no no. Instead

Re: as keyword woes

2008-12-04 Thread James Mills
On Thu, Dec 4, 2008 at 9:04 PM, Aaron Brady [EMAIL PROTECTED] wrote: [... snip ...] Does the OP hold the following should be legal? if if or or: and( for ) if not: while( def ) I most certainly hope not! :) --JamesMills -- -- -- Problems are solved by method --

Re: pretty strange behavior of strip

2008-12-04 Thread James Mills
On Fri, Dec 5, 2008 at 9:35 AM, Guy Doune [EMAIL PROTECTED] wrote: test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] test ['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html',

Re: generating a liste of characters

2008-12-03 Thread James Mills
On Thu, Dec 4, 2008 at 12:18 AM, Yves Dorfsman [EMAIL PROTECTED] wrote: Is there any built in way to generate a list of characters, something along the line of range('a'-'z') ? Right now I am using: chars = [ chr(l) for l in range(0x30, 0x3a) ] # 0 - 9 chars += [ chr(l) for l in

Re: Don't you just love writing this sort of thing :)

2008-12-03 Thread James Mills
uggh no! On Thu, Dec 4, 2008 at 11:07 AM, Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: for \ Entry \ in \ sorted \ ( f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None ) \ : Patch = (open,

Re: RELEASED Python 3.0 final

2008-12-03 Thread James Mills
On Thu, Dec 4, 2008 at 11:58 AM, alex23 [EMAIL PROTECTED] wrote: On Dec 4, 11:51 am, Barry Warsaw [EMAIL PROTECTED] wrote: On behalf of the Python development team and the Python community, I am happy to announce the release of Python 3.0 final. Thanks to you and everyone involved for your

Re: Running a Python script from crontab

2008-12-02 Thread James Mills
Put your main function in a big try, except. Catch any and all errors and log them. Example: def main(): try: do_something() except Exception, error: log(ERROR: %s % error) log(format_exc()) Hope this helps. cheers James On Wed, Dec 3, 2008 at 12:35 AM, Astley Le Jasper

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread James Mills
Pssft r, it's I that needs to get laid :) --JamesMills On Tue, Dec 2, 2008 at 4:07 PM, r [EMAIL PROTECTED] wrote: PS james, Since you are alex23's friend, do the world a favor...PLEASE GET ALEX LAID...before it's too late! -- http://mail.python.org/mailman/listinfo/python-list -- --

Re: How to sort a list of file paths

2008-12-02 Thread James Mills
Hi Eriksson, It's nice to see people actually contribute what they've learned back to the community. Great problem, well thought out solution and congrats on the learning :) I can't say per say that I've actually run into a situation where I need to sort file paths in this way ... But if I do

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread James Mills
On Wed, Dec 3, 2008 at 4:44 AM, Benjamin Kaplan [EMAIL PROTECTED] wrote: On Tue, Dec 2, 2008 at 1:36 PM, Craig Allen [EMAIL PROTECTED] wrote: Just remember thought that if you threat Python like a hammer, suddenly everything will look like a bail. don't you mean if you use Python like

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread James Mills
You're a funny man r :) Good luck with your endeavours! I have a hard enough time convincing my work colleagues to use anything other than PHP for everything! Here PHP is the Hammer / Pitchfork! --JamesMills On Wed, Dec 3, 2008 at 8:16 AM, r [EMAIL PROTECTED] wrote: OK...so here are the stat's

Re: HELP!...Google SketchUp needs a Python API

2008-12-01 Thread James Mills
This is my first post to this particular topic and my good friend alsex32 will know that I tend to steer away from large pointless conversation topics (for obvious reasons). @OP: Listen ... The best way you can support Python is to use Python. The best way you can promote Python is to encourage

Re: RELEASED Python 3.0rc3

2008-11-21 Thread James Mills
On Sat, Nov 22, 2008 at 1:06 AM, Barry Warsaw [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the third and last planned release candidate for Python 3.0. Whoohoo! :) Great works

[ANN]: circuits-1.0a2 released!

2008-11-19 Thread James Mills
Hi all, I'm pleased to announce the release of circuits-1.0a2 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

Re: Using eval, or something like it...

2008-11-19 Thread James Mills
DON'T USE eval! On Thu, Nov 20, 2008 at 10:44 AM, r0g [EMAIL PROTECTED] wrote: Hi There, I know you can use eval to dynamically generate the name of a function you may want to call. Can it (or some equivalent method) also be used to do the same thing for the variables of a class e.g. class

[ANN]: circuits-1.0a2 released!

2008-11-19 Thread James Mills
Hi all, I'm pleased to announce the release of circuits-1.0a2 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

Re: Memory error due to the huge/huge input file size

2008-11-10 Thread James Mills
On Tue, Nov 11, 2008 at 7:47 AM, [EMAIL PROTECTED] wrote: refSeqIDsinTransPro = [] promoterSequencesinTransPro = [] reader2 = csv.reader(open(sys.argv[2],rb)) reader2_list = [] reader2_list.extend(reader2) Without testing, this looks like you're reading the _ENTIRE_ input stream into

Re: concurrency program design stackless python tasklet or python thread?

2008-11-10 Thread James Mills
On Tue, Nov 11, 2008 at 3:57 PM, davy zhang [EMAIL PROTECTED] wrote: first here is my basic idea is every actor holds their own msg queue, the process function will handle the message as soon as the dispatcher object put the message in. This idea naturally leads me to place every actor in a

Re: Plz help..SocketServer UDP server losing lots of packets

2008-11-06 Thread James Mills
On Fri, Nov 7, 2008 at 12:57 AM, I D [EMAIL PROTECTED] wrote: Thanks for your response. But I cannot use a third party software, I need to use the exisiting API's within python. Why ? Even this seems to lose packets, I would really appreciate if any pointers can be provided to improve my

Re: Cisco's $100,000 Developer Contest

2008-11-06 Thread James Mills
On Fri, Nov 7, 2008 at 7:15 AM, Guido van Rossum [EMAIL PROTECTED] wrote: This seems of interest to Python developers all over the world. Develop a Python app to run on a Cisco router and win real money! On any Cisco ISR ? Any particular product/version ? --JamesMills -- -- -- Problems are

Re: Plz help..SocketServer UDP server losing lots of packets

2008-11-06 Thread James Mills
On Fri, Nov 7, 2008 at 1:43 AM, Ben Sizer [EMAIL PROTECTED] wrote: On Nov 6, 12:46 am, James Mills [EMAIL PROTECTED] wrote: Try these instead: * UDPServer -http://trac.softcircuit.com.au/circuits/browser/examples/udpserver.py * UDPClient -http://trac.softcircuit.com.au/circuits

Re: Can read() be non-blocking?

2008-11-06 Thread James Mills
On Fri, Nov 7, 2008 at 8:54 AM, Thomas Christensen [EMAIL PROTECTED] wrote: Is there a way to read non-blocking? Or maybe event a better way in generel to handle this situation? Check out circuits [1]. It has a Component called Stdin [2] which allows you to have non-blocking Standard Input

Re: Plz help..SocketServer UDP server losing lots of packets

2008-11-05 Thread James Mills
On Thu, Nov 6, 2008 at 9:53 AM, [EMAIL PROTECTED] wrote: logFileName = 'log.txt' logfile = open(logFileName, a) class MyUDPServer(SocketServer.UDPServer): def server_bind(self): self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF,

Re: damn street venders

2008-11-05 Thread James Mills
On Tue, Nov 4, 2008 at 12:13 AM, Aspersieman [EMAIL PROTECTED] wrote: +1 +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: find an object ancestor

2008-11-05 Thread James Mills
On Mon, Nov 3, 2008 at 7:16 AM, Michel Perez [EMAIL PROTECTED] wrote: HI all: imagine something like this: class father: pass class son( father ): pass I need to know the son ancestor class how can i know this. class Father(object): pass ... class Son(Father): pass ... son =

Re: damn street venders

2008-11-05 Thread James Mills
On Tue, Nov 4, 2008 at 7:31 AM, Benjamin Kaplan [EMAIL PROTECTED] wrote: I'm pretty sure all of the spam is automated, so your message won't get through to anyone. It feels good to let our frustration out :) -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 249 - DB API question

2008-11-04 Thread James Mills
On Wed, Nov 5, 2008 at 3:52 AM, k3xji [EMAIL PROTECTED] wrote: As development goes on for a server project, it turns out that I am using the MySQLDB and DB interactions excessively. One questions is just bothering me, why don't we have a timeout for queries in PEP 249 (DB API)? Because not

Re: PEP 249 - DB API question

2008-11-04 Thread James Mills
On Wed, Nov 5, 2008 at 6:13 AM, k3xji [EMAIL PROTECTED] wrote: Try spawning a new process to run your query in. Use the multiprocessing library. Your main application can then just poll the db/query processes to see if they're a) finished and b) have a result Your application server can

XMPP xmpppy - User Authorization

2008-11-04 Thread James Mills
Hi all, Can anyone shed any light on how I might be able to react to User Authorization Requests from other users on an XMPP server/network using teh xmlpp [1] library ? Thanks, cheers James [1] http://xmpppy.sourceforge.net/irc/ -- -- -- Problems are solved by method --

Re: XMPP xmpppy - User Authorization

2008-11-04 Thread James Mills
On Wed, Nov 5, 2008 at 11:28 AM, James Mills [EMAIL PROTECTED] wrote: Can anyone shed any light on how I might be able to react to User Authorization Requests from other users on an XMPP server/network using teh xmlpp [1] library ? [SOLVED}: I found out from having a peek at jabberbot [1

Re: Regarding shared memory

2008-10-30 Thread James Mills
On Thu, Oct 30, 2008 at 2:13 PM, gaurav kashyap [EMAIL PROTECTED] wrote: Dear all, I have a server program that listens to a particular port and a number of client programs that connect to the server. Now i want to put some data in form of python list in main memory on server.Hence whenver

Re: Web crawler on python

2008-10-30 Thread James Mills
On Fri, Oct 31, 2008 at 8:13 AM, yura [EMAIL PROTECTED] wrote: I need simple web crawler, I found Ruya, but it's seems not currently maintained. Does anybody know good web crawler on python or with python interface? http://watch-me.890m.com

Re: Python 2.5: wrong number of arguments given in TypeError for function argument aggregation (dictionary input vs the norm)

2008-10-30 Thread James Mills
On Fri, Oct 31, 2008 at 8:49 AM, mark floyd [EMAIL PROTECTED] wrote: I was doing some testing with the different ways to pass arguments into functions and ran into what looks like a bug. Given function, def foo(a,b,c): print a print b print c # Call function with named

Re: Python 2.5: wrong number of arguments given in TypeError for function argument aggregation (dictionary input vs the norm)

2008-10-30 Thread James Mills
On Fri, Oct 31, 2008 at 9:18 AM, John Krukoff [EMAIL PROTECTED] wrote: Are you sure? It looks like his complaint isn't that it doesn't work, but that the error message is misleading. With the setup: Python 2.5.2 (r252:60911, Sep 22 2008, 12:08:38) [GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2

Re: Exec and Scope

2008-10-30 Thread James Mills
Manu, Good lord man, what are you trying to solve ? Describe your actual problem you're attempting to solve... This looks really really ugly and I would advise against any solution that relies on exec() --JamesMills On Fri, Oct 31, 2008 at 1:47 PM, Emanuele D'Arrigo [EMAIL PROTECTED] wrote: Hi

Re: How to get high precision timer in python?

2008-10-29 Thread James Mills
On Wed, Oct 29, 2008 at 4:22 PM, Tim Roberts [EMAIL PROTECTED] wrote: I'm not sure you understood what he was saying. time.time() and time.clock() can both be used for elapsed timing, but because of a fluke of implementation, time.time() is more precise on Linux, and time.clock() is more

Re: Improving interpreter startup speed

2008-10-29 Thread James Mills
On Wed, Oct 29, 2008 at 9:43 PM, Lie [EMAIL PROTECTED] wrote: On Oct 27, 2:36 pm, Paul Rubin http://[EMAIL PROTECTED] wrote: It's not optimal but it is very common (CGI for example). CGI? When you're talking about CGI, network traffic is simply the biggest bottleneck, not something like

Re: Looking for a pure python Mysql module

2008-10-28 Thread James Mills
On Tue, Oct 28, 2008 at 9:41 AM, Carl [EMAIL PROTECTED] wrote: Does anyone know of a package that can connect and query a mysql server that is platform independent and does not need to compile any extra c modules (IE a pure python module)? There was a recent discussion on this mailing list

Re: Using threads to quit the main python process

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 10:42 AM, sharpblade [EMAIL PROTECTED] wrote: Is there a way I can use threads to quit the main python process? In brief, I have a python script that starts when my computer starts. It chooses a random wallpaper background out of a specified path, and sets it as the

Re: gl Multiple versions of python

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 11:50 AM, Glenn Linderman [EMAIL PROTECTED] wrote: When using multiple versions of Python co-installed on the same system, what happens with local .pyc files? If the .py is loaded with a different version of Python, is the .pyc rebuilt (even if the .py hasn't changed)?

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 [EMAIL PROTECTED] wrote: I use python2.5 in WindowsXP. If using time.time() as timer, it seems On the win32 platform should you not be using time.clock vs. time.time ? --JamesMills -- -- -- Problems are solved by method --

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
2008/10/29 甜瓜 [EMAIL PROTECTED]: 2008/10/29 James Mills [EMAIL PROTECTED]: On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 [EMAIL PROTECTED] wrote: I use python2.5 in WindowsXP. If using time.time() as timer, it seems On the win32 platform should you not be using time.clock vs. time.time ? Well

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 3:36 PM, Terry Reedy [EMAIL PROTECTED] wrote: It this a theoretical problem or an actual one, that we might have other suggestions for? Heaven knows! I hardly think invoking hundreds and possibly thousands of short-lived python interpreters to be an optimal solution that

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:28 PM, David Cournapeau [EMAIL PROTECTED] wrote: Any command line based on python is a real example of that problem. There are plenty of them. Yes, but in most cases you are not invoking your command-line app x times per y units of time. --JamesMills -- -- --

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:36 PM, Paul Rubin http://phr.cx@nospam.invalid wrote: It's not optimal but it is very common (CGI for example). Which is why we (The Python Community) created WSGI and mod_wsgi. Cmon guys these problems are a bit old and out dated :) --JamesMills -- -- -- Problems

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:40 PM, David Cournapeau [EMAIL PROTECTED] wrote: Depends on the tool: build tool and source control tools are example it matters (specially when you start interfaciing them with IDE or editors). Having fast command line tools is an important feature of UNIX, and if

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:46 PM, Gabriel Genellina [EMAIL PROTECTED] wrote: +1 This thread is stupid and pointless. Even for a so-called cold startup 0.5s is fast enough! I don't see the need to be rude. And I DO care for Python startup time and memory footprint, and others do too. Even if

Re: Improving interpreter startup speed

2008-10-26 Thread James Mills
On Sun, Oct 26, 2008 at 11:23 AM, BJörn Lindqvist [EMAIL PROTECTED] wrote: How are you getting those numbers? 330 μs is still pretty fast, isn't it? :) Most disks have a seek time of 10-20 ms so it seem implausible to me that Ruby would be able to cold start in 47 ms. $ time python -c pass

Re: Why can't I assign a class method to a variable?

2008-10-26 Thread James Mills
On Thu, Oct 23, 2008 at 2:34 AM, ed [EMAIL PROTECTED] wrote: I'm trying to make a shortcut by doing this: t = Globals.ThisClass.ThisMethod Calling t results in an unbound method error. Is it possible to do what I want? I call this method in hundreds of locations and I'm trying to cut down

Re: Web crawler on python

2008-10-26 Thread James Mills
On Mon, Oct 27, 2008 at 6:54 AM, sonich [EMAIL PROTECTED] wrote: I need simple web crawler, I found Ruya, but it's seems not currently maintained. Does anybody know good web crawler on python or with python interface? Simple, but it works. Extend it all you like.

Re: Improving interpreter startup speed

2008-10-26 Thread James Mills
On Sun, Oct 26, 2008 at 11:19 PM, Pedro Borges [EMAIL PROTECTED] wrote: The scripts i need to run but be executed with no apparent delay specially when the text transforms are simple. That makes no sense whatsoever! If you are performing data conversion with Python, interpreter startup times

Re: Improving interpreter startup speed

2008-10-26 Thread James Mills
On Mon, Oct 27, 2008 at 4:12 AM, Benjamin Kaplan [EMAIL PROTECTED] wrote: You must be in a real big hurry if half a second matters that much to you. Maybe if it took 5 seconds for the interpreter to start up, I could understand having a problem with the start up time. +1 This thread is stupid

Re: Improving interpreter startup speed

2008-10-26 Thread James Mills
On Mon, Oct 27, 2008 at 3:45 AM, BJörn Lindqvist [EMAIL PROTECTED] wrote: Pedro was talking about cold startup time: $ sudo sh -c echo 3 /proc/sys/vm/drop_caches $ time python -c pass real0m0.627s user0m0.016s sys 0m0.008s $ sudo sh -c echo 3 /proc/sys/vm/drop_caches $ time

Re: 2.6, 3.0, and truly independent intepreters

2008-10-26 Thread James Mills
On Mon, Oct 27, 2008 at 12:03 PM, Andy O'Meara [EMAIL PROTECTED] wrote: I think we miscommunicated there--I'm actually agreeing with you. I was trying to make the same point you were: that intricate and/or large structures are meant to be passed around by a top-level pointer, not using and

Re: Improving interpreter startup speed

2008-10-26 Thread James Mills
On Mon, Oct 27, 2008 at 3:15 PM, David Cournapeau [EMAIL PROTECTED] wrote: Not if the startup is the main cost for a command you need to repeat many times. Seriously if you have to spawn and kill python processes that many times for an initial cold startup and subsequent warm startups to be

Re: How to get the actual address of a object

2008-10-24 Thread James Mills
On Sat, Oct 25, 2008 at 12:25 AM, [EMAIL PROTECTED] wrote: Thank you,James. My original idea was to study all the contents of any object. I can do it by using module ctypes. You can simply just query it's attributes. Use __dict__ or dir(obj) Example: x = 10 dir(x) ['__abs__', '__add__',

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 contained

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 Type

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 separates it

<    1   2   3   4   5   6   >