Re: How to get the actual address of a object

2008-10-23 Thread James Mills
On Fri, Oct 24, 2008 at 2:58 PM, <[EMAIL PROTECTED]> wrote: > maybe id(x) can get it ,but how to cast it back into a object You can't. Python is NOT C/C++/Java or whatever. If you have a variable, x, and you want to "copy" it to another variable, y. Use assignment. Most (if not all) objects in

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__', '

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 "pas

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

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. http://hg.softcircuit.co

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 time

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 stu

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/dro

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 a

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: 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 t

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 -- -- -- "Pr

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. C"mon guys these "problems" are a bit old and out dated :) --JamesMills -- -- -- "Pro

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

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.

Re: Looking for a pure python Mysql module

2008-10-27 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 th

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

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" -- http://mail.python.org/mailma

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 p

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 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 l

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

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 http://hg.softcircuit.com.au/index.wsgi/project

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

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

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:

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 n

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

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" -- http://mail.pytho

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 fou

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_

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): p

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: 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

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 a

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/br

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: 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 int

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

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. >

[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 s

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! :) Grea

Re: Understanding this generator function

2008-08-27 Thread James Mills
Hi, There is a great set of slides on this topic available here: http://www.dabeaz.com/generators/ They explain this concept quite well and walk you through everything you need to know about generators and how powerful they can be. Please read it. cheers James On 8/27/08, Hussein B <[EMAIL PRO

Re: List of modules available for import inside Python?

2008-08-27 Thread James Mills
On Thu, Aug 28, 2008 at 2:21 PM, ssecorp <[EMAIL PROTECTED]> wrote: > Also, is there anything like Cpan for Python? Try the Python Cheese Shop / PyPi http://pypi.python.org/pypi cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread James Mills
On Fri, Aug 29, 2008 at 9:28 AM, Paul McNett <[EMAIL PROTECTED]> wrote: > When confronted with this type of question, I ask the interpreter: > > {{{ > mac:~ pmcnett$ python > Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "c

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread James Mills
Hi, If you cannot use a simple data structure/format like JSON, or CSV, or similar, _don't_ use eval or exec, but use the pickle libraries instead. This is much safer. cheers James On Fri, Aug 29, 2008 at 7:51 AM, Fett <[EMAIL PROTECTED]> wrote: > I am creating a program that requires some data

Re: Fastest way to write huge files

2008-08-28 Thread James Mills
Hi, You could use generators connected via a pipe or tcp socket ... cheers James On Fri, Aug 29, 2008 at 10:35 AM, Mohamed Yousef <[EMAIL PROTECTED]> wrote: > Hello , > > let's say , I'm moving large files through network between devices > what is the fastest way to do this ? > what i came up wi

Re: lacking follow-through

2008-09-07 Thread James Mills
Hi, This is the strangest post I've seen since I've joined this list (only recently). What the ? cheers James On Mon, Sep 8, 2008 at 7:00 AM, castironpi <[EMAIL PROTECTED]> wrote: > I am concerned by the lack of follow-through on some responses to > recent ideas I have described. Do I merely ha

Re: max(), sum(), next()

2008-09-07 Thread James Mills
Can we stop this thread now? :) I think we've all seen what the intended behavior of sum(), max() and other similar functions. cheers James On Mon, Sep 8, 2008 at 3:30 AM, Mensanator <[EMAIL PROTECTED]> wrote: > On Sep 6, 11:05�pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote:

Re: problem with permutations

2008-09-07 Thread James Mills
Hi, Here's a (better?) function: def permutate(seq): if not seq: return [seq] else: temp = [] for k in range(len(seq)): part = seq[:k] + seq[k+1:] for m in permutate(part): temp.append(seq[k:k+1] + m) return temp che

Re: formatting a string with thousands separators

2008-09-07 Thread James Mills
Hi, There is a much easier more consistent way: >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_AU.UTF-8") 'en_AU.UTF-8' >>> locale.format("%0.2f", 500, True) '5,000,000.00' >>> cheers James On Mon, Sep 8, 2008 at 5:24 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On 9/7/2008 12:2

Re: Updating python dictionary

2008-09-07 Thread James Mills
Hi, There is "never" a "clever" way of doing anything, but: $ cat test.py MAPPING_DICT = {'a': 'A','b': 'B',} my_dict = {'a': '1','b': '2'} my_dict = dict((MAPPING_DICT[k], my_dict[k]) for k in my_dict) print my_dict $ python test.py {'A': '1', 'B': '2'} $ That should do the trick. cheers James

Re: Updating python dictionary

2008-09-07 Thread James Mills
On Mon, Sep 8, 2008 at 8:37 AM, John Machin <[EMAIL PROTECTED]> wrote: > Is this homework? I hope it's not - or I'll be quite annoyed :) > There seems to be an implicit assumption in the answers so far that > your mapping is a 1:1 mapping of all possible input keys. > > If it doesn't include all

Re: Updating python dictionary

2008-09-07 Thread James Mills
On Mon, Sep 8, 2008 at 8:59 AM, John Machin <[EMAIL PROTECTED]> wrote: > What do you mean by "this right"? Perhaps the Divine Right of OPs, > managers, examiners, business analysts, etc never to give a complete > spec up front and never to contemplate the consequences of Murphy's > Law? Now you're

Re: Test if list contains another list

2008-09-08 Thread James Mills
Hi, >>> a = [1,2,3] >>> b = [3,2,1,4] >>> a = set(a) >>> b = set(b) >>> a.intersection(b) set([1, 2, 3]) Is this what you want ? cheers James On 9/8/08, mathieu <[EMAIL PROTECTED]> wrote: > Hi there, > > I am trying to write something very simple to test if a list > contains another one: > >

Re: The difference between __XX__ and XX method

2008-09-08 Thread James Mills
Hi, This is convention only and typically used to denote that a particular class attribute is "private". Though note, there is really no such thing in Python. cheers James On Tue, Sep 9, 2008 at 7:31 AM, AON LAZIO <[EMAIL PROTECTED]> wrote: > Hi, Pythoners. > I would like to know that in s

Re: Trying to make a spider using mechanize

2008-09-08 Thread James Mills
Hi, Perhaps you might want to try out using a sample spider I wrote and base your code of this ? See: http://hg.shortcircuit.net.au/index.wsgi/pymills/file/b9936ae2525c/examples/spider.py cheers James On Tue, Sep 9, 2008 at 2:24 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I can

Alternatives to traditional RDBMS

2008-09-10 Thread James Mills
Hi all, Are there any known alternatives to the traditional RDBMS (MySQL, PostgreSQL, SQLite, Oracle, etc0 / I know of 3 written in Python: * buzhug * kirbybase * PyDbLite buzhug - Although buzhug has a group membership size of ~60 or so it has not seen any activity in some time - an

Re: Alternatives to traditional RDBMS

2008-09-10 Thread James Mills
On Thu, Sep 11, 2008 at 12:51 AM, Tino Wildenhain <[EMAIL PROTECTED]> wrote: > Looks as you didn't mention ZODB yet. > As it is actively developed, it is maybe something > you could consider. Problem with ZODB is that I find that anything that comes out of Zope to be far too complicated in design

Re: Alternatives to traditional RDBMS

2008-09-10 Thread James Mills
On Thu, Sep 11, 2008 at 3:40 AM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote: > There is also dejavu: http://www.aminus.net/dejavu This is an ORM. They are off-topic for this thread :) cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple UDP server

2008-09-10 Thread James Mills
Tzury, You may consider using pymills to simplify writing your UDP server and just concentrating on the behavior of the system. You can get a copy of the latest development branch by cloning it with Mercurial: hg clone http://hg.shortcircuit.net.au/pymills/ There is an example UDP Server in exa

Re: Simple UDP server

2008-09-10 Thread James Mills
On Thu, Sep 11, 2008 at 10:36 AM, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > For UDP I wouldn't thread or, fork, I'd use select and run > asynchronously. > > http://docs.python.org/lib/module-select.html > > Actually if I really had to do this I'd use twisted. Right tool for > the job! For any

Re: Alternatives to traditional RDBMS

2008-09-10 Thread James Mills
On Thu, Sep 11, 2008 at 12:06 PM, alex23 <[EMAIL PROTECTED]> wrote: > "James Mills" <[EMAIL PROTECTED]> wrote: >> This is an ORM. They are >> off-topic for this thread :) > > Tsk, such an unfounded bias... To be honest. I have since now tried both ZODB a

Re: Use Python to solve equations?

2008-09-11 Thread James Mills
Hi Kelie, Check out sympy it is capable of doing things like this. cheers James On Thu, Sep 11, 2008 at 5:09 PM, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > Is there any packages in Python that will help me solve functions > similar to this: > > x = a*(1+bx)**2.5-c where a, b, c is known

Re: PEP proposal optparse

2008-09-18 Thread James Mills
Hi James, I can't say I really agree with your proposal. I tend to keep the help descriptions of my options short and concise and to the point. Also, one must use the language's features (indentation) to your advantage, as doing so ensure readability. For example (from my bhimport tool): def p

Re: Twisted vs Python Sockets

2008-09-18 Thread James Mills
On Fri, Sep 19, 2008 at 6:24 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > James Matthews wrote: > >> I am wondering what are the major points of twisted over regular python >> sockets. I am looking to write a TCP server and want to know the pros can >> cons of using one over the other. > > Twiste

Re: PEP proposal optparse

2008-09-18 Thread James Mills
On Thu, Sep 18, 2008 at 9:02 PM, James Nicolson <[EMAIL PROTECTED]> wrote: > Perhaps it is better to keep descriptions short and store longer > descriptions elsewhere, but there are many programs that have long > descriptions, for example try: ls --help (at least on my machine a lot > of these desc

Re: Not fully OO ?

2008-09-20 Thread James Mills
This is wrong. Python _is_ a full OOP language. Everything form modules, functions to basic data types are an object. --JamesMills On Sat, Sep 20, 2008 at 7:23 PM, candide <[EMAIL PROTECTED]> wrote: > Excerpt quoted from http://www.astro.ufl.edu/~warner/prog/python.html : > > "About Python: Pytho

Re: how can i check whether a variable is iterable in my code?

2008-09-21 Thread James Mills
satoru, I should point out that the normal approach is to just try whatever it is that you're doing, and let it fail where it fails. For example: def processSeq(x): for i in x: print i processSeq([1, 2, 3]) processSeq("foobar") processSeq(5) <-- This will fail. cheers James On Sat, Se

Re: What do you call a class not intended to be instantiated

2008-09-21 Thread James Mills
Hi, Wouldn't a normal class called State suffice for storing state between calls ? And ... Creating a state instance ? For example: class State(object): """State() -> new state object Creates a new state object that is suitable for holding different states of an application. Usefull

Re: What do you call a class not intended to be instantiated

2008-09-21 Thread James Mills
On Mon, Sep 22, 2008 at 9:05 AM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I'm not wedded to the idea, there are alternatives (perhaps the factory > should instantiate the class and return that?) but I assume others have > used this design and have a name for it. The problem is, I don't see why

Re: What do you call a class not intended to be instantiated

2008-09-21 Thread James Mills
On Mon, Sep 22, 2008 at 9:39 AM, Calvin Spealman <[EMAIL PROTECTED]> wrote: > I call it an obvious misuse and misunderstanding of why you'd use a class in > the first place. Either create an instance and not make these things > classmethods or just share the stuff in a module-level set of variables

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread James Mills
On 22 Sep 2008 09:07:43 GMT, Steven D'Aprano > But that's precisely what I want to avoid: I don't want the objects to > share *any* state, not even their class. I'm not trying for a Borg or > Singleton: the user can call the factory as many times as they want, but > the objects returned shouldn'

Re: Not fully OO ?

2008-09-25 Thread James Mills
On Fri, Sep 26, 2008 at 8:20 AM, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > Object orientation IS procedural. Correction: OOP is Imperative. --JamesMills -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP Proposal

2008-09-25 Thread James Mills
On Fri, Sep 26, 2008 at 6:14 AM, <[EMAIL PROTECTED]> wrote: > Typed parameters. Method-Declaration-filtered-typed parameters. That's what > I'm thinking of. Why do we need this (rubbish) ? Seriously. The use-case is far too small. And don't invent use-cases either. Instead of coming up with idea

Re: python & sms

2008-09-29 Thread James Mills
sui, I am sure you'll find many web services that you can use to send SMS'. Your problem would then become one of learning how to communicate and access web services in Python. Start with: * urllib and urllib2 * xmlrpc There are others... cheers James On Tue, Sep 30, 2008 at 1:47 PM, sui <[EM

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread James Mills
On Wed, Oct 1, 2008 at 6:01 PM, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > Are there any python event driven frameworks other than twisted? Phillip, I have been developing a rather unique event-driven and component architecture library for quite some time that is (not twisted). Actually it's no

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread James Mills
On Wed, Oct 1, 2008 at 6:55 PM, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > I've noticed that. I'm thinking more for a web environment (instead of > MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm > looking for alternatives. Again with pymills, here's an alternative: http://hg.

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread James Mills
On Thu, Oct 2, 2008 at 2:09 AM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > "view" doesn't imply (x)html - any valid HTTP response is ok. The whole > point of decoupling controler from view (in web MVC) is to allow the same > controler to return different views. There is an alternative to the

Re: TypeError: can't pickle HASH objects?

2008-10-01 Thread James Mills
On Thu, Oct 2, 2008 at 3:34 PM, est <[EMAIL PROTECTED]> wrote: > wow. It's giga-size file. I need stream reading it, md5 it. It may > break for a while. So use generators and consume the stream ? --JamesMills -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/py

Re: problem with sockets code

2008-10-02 Thread James Mills
On Fri, Oct 3, 2008 at 2:13 AM, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I can't seem to get my sockets code to work right. Here is what I > have inside my RequestHandler handle() function: > >total_data=[] > >data = True >logger_server.debug(self.__class__.__name__ +

Re: Event-driven framework (other than Twisted)?

2008-10-02 Thread James Mills
On 10/2/08, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > On Oct 2, 1:28 am, "James Mills" <[EMAIL PROTECTED]> wrote: > > Phillip, I have been developing a rather unique > > event-driven and component architecture library > > for quite some time that i

Re: Event-driven framework (other than Twisted)?

2008-10-03 Thread James Mills
On 10/2/08, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > On Oct 2, 1:32 am, "James Mills" <[EMAIL PROTECTED]> wrote: > > http://hg.shortcircuit.net.au/index.wsgi/pymills/file/b7498cd4c6a4/ex... > > Thanks for the example, but its not loading. Sorry my

Re: strange subprocess behavior when calling ps

2010-11-16 Thread James Mills
rrupt: >                print "Keyboard interrupt received -- terminating." >                sys.stdout.flush() >                sys.exit(-1) >        except: >                print "%s: unexpected error in generation of system process > list" % > pro

Re: Catching user switching and getting current active user from root on linux

2010-11-30 Thread James Mills
is a good idea and you could also make use of the following library: http://pypi.python.org/pypi?:action=search&term=utmp&submit=search cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How to initialize each multithreading Pool worker with an individual value?

2010-11-30 Thread James Mills
the Pool object works and what it does with the initializer argument. I'm not entirely sure it does what you expect and yes documentation on this is lacking... cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: To Thread or not to Thread....?

2010-12-01 Thread James Mills
erable latency for I2C operation, you can try > to run it as an OS thread, or a separate process (if running as a > separate process, make sure it cannot block while sending IO to the > master process). > > Regards > > Antoine. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: odd runtime error

2010-12-01 Thread James Mills
started" % os.getpid() if os.fork() == 0: print "doing stuff" sleep(5) print "done" raise SystemExit, 0 print "child %d exited with %d" % os.wait() if __name__ == "__main__": main() cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I define class methods outside of the class?

2010-12-01 Thread James Mills
smethod on %r" % cls class Foo(object): pass Foo.foo = foo cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Python metaclass and UML

2011-01-31 Thread James Mills
ts metaclass? Is there a standard for this? IHMO (but others may have other opinions) the same way you'd represent a decorated function. Metaclasses IHMO have the same effect as a decorated function - modifying another classes's behavior. cheers Jaes -- -- James Mills -- -- "Pr

Re: Determine from a HTTP request if the user is on a Smart Phone, IE, Firefox

2011-01-31 Thread James Mills
nique User-Agent strings. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get and search a html file from a website

2011-02-01 Thread James Mills
tion with lxml to parse the html in a sensible way (instead of just doing: if "foo" in s) cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatic Parsing of ps

2011-02-10 Thread James Mills
out psutil (1) to see if it meets your needs ? cheers James 1. http://pypi.python.org/pypi/psutil/0.2.0 -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
constructor of the base class (Ship) gets called and the object initialized with the attributes you've defined. Note for convention reasons I've also included proper class names in the example. Classes normally start with an Upper case letter. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
s's constructor directly and using the super type ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-13 Thread James Mills
eed" was not a member of the OP's class ship. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-14 Thread James Mills
"understands" how to "correctly" use the API(s). If the programmer doesn't use the API(s) "correctly" f(...) will blow up in his/her face. g(...) will blow up as well but tries to guard against the expected TypeError you would expect if you called f(...) incorrectly. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending classes __init__behavior for newbies

2011-02-14 Thread James Mills
he vast amount of time involved in a coding project should be > spent in the design and testing phases and NOT actually writing code. > If you spend more time writing code you are not being professional, > you are being sloppy -- and it WILL catch up to you. I actually agree with this. :) -

<    1   2   3   4   5   6   >