Re: ISO books of official Python docs

2008-01-11 Thread Mike
On Jan 9, 2:59 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Doug Morse wrote: > > Several of the O'Reilly & Assoc. books -- such as Python in a Nutshell, The > > Python Standard Library, etc -- are in large part reproductions of the > > official docs and references. > > if you're using "reproduct

Re: Python too slow?

2008-01-11 Thread sturlamolden
On 9 Jan, 20:11, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is there a better way to do color tracking, or is Python just too slow > as an interpreted language to do any effective color tracking? You should code numerically intensive tasks using NumPy arrays. If things are getting slow, ch

Re: split parameter line with quotes

2008-01-11 Thread Nanjundi
On Jan 11, 1:50 pm, teddyber <[EMAIL PROTECTED]> wrote: > Hello, > > first i'm a newbie to python (but i searched the Internet i swear). > i'm looking for some way to split up a string into a list of pairs > 'key=value'. This code should be able to handle this particular > example string : > > qop=

Re: Strange problem: MySQL and python logging using two separate cursors

2008-01-11 Thread Chris Mellon
On Jan 9, 2008 11:52 AM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 9 Jan 2008 10:11:09 +0100, Frank Aune <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > The only clue I have so far, is that the cursor in task 1 seems to be unable > > to "register" any new entri

split parameter line with quotes

2008-01-11 Thread teddyber
Hello, first i'm a newbie to python (but i searched the Internet i swear). i'm looking for some way to split up a string into a list of pairs 'key=value'. This code should be able to handle this particular example string : qop="auth,auth-int,auth-conf",cipher="rc4-40,rc4-56,rc4,des, 3des",maxbuf=

Re: Python too slow?

2008-01-11 Thread Bruno Desthuilliers
Ross Ridge a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> And the reference implementation of Python (CPython) is not >> interpreted, it's compiled to byte-code, which is then executed by a VM >> (just like Java). > > Ross Ridge a écrit : >> Python's byte-code interpreter is not

Re: Detecting OS platform in Python

2008-01-11 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: > On Thu, 10 Jan 2008 18:37:59 -0800 (PST) Devraj <[EMAIL PROTECTED]> wrote: > > > Hi everyone, > > > > My Python program needs reliably detect which Operating System its > > being run on, infact it even needs to know which d

Re: Python too slow?

2008-01-11 Thread Ed Jensen
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > fact 1: CPython compiles source code to byte-code. > fact 2: CPython executes this byte-code. > fact 3: Sun's JDK compiles source code to byte-code. > fact 4: Sun's JDK executes this byte-code. > > Care to prove me wrong on any of these points ? Don

Re: Converting a bidimensional list in a bidimensional array

2008-01-11 Thread Fredrik Lundh
Santiago Romero wrote: > My problem is that, in my game, each screen is 30x20, and I have > about 100 screens, so my tilemap contains 32*20*100 = 6 python > objects (integers). > > If each integer-python-object takes 16 bytes, this makes 6 * 16 = > almost 1MB of memory just for the tile

Re: Property with Arguments

2008-01-11 Thread Lie
On Jan 11, 6:20 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > > Is there a way to create a property with arguments? > > That's called method in Python, and has it's own syntax.  You cannot > assign to methods. So you've got to use methods? It was in VB.NET that I learned about proper

Re: reading a specific column from file

2008-01-11 Thread Ivan Novick
On Jan 11, 4:15 am, cesco <[EMAIL PROTECTED]> wrote: > Hi, > > I have a file containing four columns of data separated by tabs (\t) > and I'd like to read a specific column from it (say the third). Is > there any simple way to do this in Python? You say you would like to "read" a specific column.

Re: Using a proxy with urllib2

2008-01-11 Thread Jack
Rob, I tried your code snippet and it worked great. I'm just wondering if getopener( ) call is lightweight so I can just call it in every call to fetchurl( )? Or I should try to share the opener object among fetchurl( ) calls? Thanks, Jack "Rob Wolfe" <[EMAIL PROTECTED]> wrote in message new

Re: Detecting OS platform in Python

2008-01-11 Thread MrJean1
On Jan 10, 7:53 pm, Benjamin <[EMAIL PROTECTED]> wrote: > On Jan 10, 8:37 pm, Devraj <[EMAIL PROTECTED]> wrote:> Hi everyone, > > > My Python program needs reliably detect which Operating System its > > being run on, infact it even needs to know which distribution of say > > Linux its running on. T

Re: Using a proxy with urllib2

2008-01-11 Thread Jack
> Works for me. > How do you know that the proxy is not set? The proxy drops some URLs and the URLs were not being dropped when I did this :) > Try this: Thank you. I'll give it a try. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a bidimensional list in a bidimensional array

2008-01-11 Thread bearophileHUGS
Santiago Romero: > If each integer-python-object takes 16 bytes, this makes 6 * 16 = > almost 1MB of memory just for the tilemaps... > Using array of type H (16 bits per item = 2 bytes), my maps take just > 6*2 = 120KB of memory. > Do you think I should still go with lists instead of an

Re: Python too slow?

2008-01-11 Thread Paul Boddie
On 10 Jan, 21:47, Ed Jensen <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > I fail to see how the existence of JIT compilers in some Java VM changes > > anything to the fact that both Java (by language specification) and > > CPython use the byte-code/VM scheme. > > W

Re: MFC app to Python IDLE communication

2008-01-11 Thread konstantin . smolin
>         IDLE is a Tkinter/TK IDE for Python... Why would you invoke a whole > IDE to manipulate application data? It was just an idea. I have never dealt with python before... I need some hints to understand where the answer to my problem is. > >          If you already have MFC in the mix, woul

Re: Magic function

2008-01-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > obj1 = Obj(params1) > obj2 = Obj(params2) > ... > run() > > The idea is that the run() function inspects the stack, and looks for > object which are instances of class Obj, creates a Bigobj with those > objects and calls its run() method. > > So, any comments on that

Re: split parameter line with quotes

2008-01-11 Thread Russ P.
On Jan 11, 10:50 am, teddyber <[EMAIL PROTECTED]> wrote: > Hello, > > first i'm a newbie to python (but i searched the Internet i swear). > i'm looking for some way to split up a string into a list of pairs > 'key=value'. This code should be able to handle this particular > example string : > > qop

os.rename() problems on OS X

2008-01-11 Thread lukas
hello, i recently had the job of having to rename about 200 files. The source for the renaming was a bunch of names in a file. I know next to nothing when it comes to bash scripting (which would have seemed the obvious choice) so i used python. The files i was renaming were canon raw files (.CR2).

Re: Help needed

2008-01-11 Thread Bjoern Schliessmann
Devraj wrote: > Sorry to diverge from the topic, but is there a reason you need to > develop something like again? It's obvious, isn't it? > On Jan 11, 1:15 pm, tijo <[EMAIL PROTECTED]> wrote: >> I dont know how to check the rest like how many bytes send or how >> much time taken since this is

removeall() in list

2008-01-11 Thread castironpi
Any ideas for a thread-safe list.removeall( X ): removing all occurrences of X within list L, when L might be modified concurrently? Sincerely, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: virtualpython / workingenv / virtualenv ... shouldn't this be part of python

2008-01-11 Thread Christian Heimes
Damjan wrote: > My question is, shoudn't it be enough to set PYTHONPATH and everything > automagically to work then? Is there some work done on this for python 3.0 > or 2.6 perhaps? I'm working on a PEP for a per user site dir for 2.6 and 3.0 Christian -- http://mail.python.org/mailman/listinfo

Re: removeall() in list

2008-01-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Any ideas for a thread-safe list.removeall( X ): removing all > occurrences of X within list L, when L might be modified concurrently? That way lies madness. Do something sensible instead. Put a lock around the list, or put all mutators for the list into a single thre

Re: split parameter line with quotes

2008-01-11 Thread Russ P.
On Jan 11, 12:53 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jan 11, 10:50 am, teddyber <[EMAIL PROTECTED]> wrote: > > > Hello, > > > first i'm a newbie to python (but i searched the Internet i swear). > > i'm looking for some way to split up a string into a list of pairs > > 'key=value'. This co

Re: Newbie question on Classes

2008-01-11 Thread John Machin
On Jan 11, 9:27 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of Adrian Wood > > Sent: Thursday, January 10, 2008 4:47 PM > > To: [EMAIL PROTECTED] > > Subject: Newbie question on Classes >

RE: split parameter line with quotes

2008-01-11 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of teddyber > Sent: Friday, January 11, 2008 1:51 PM > To: python-list@python.org > Subject: split parameter line with quotes > > Hello, > > first i'm a newbie to python (but i searched the Inte

[Kamaelia] TCPClient: How to sense connection failure?

2008-01-11 Thread Bjoern Schliessmann
Hello, I'm currently trying to implement a simulation program with Kamaelia and need a reliable TCP connection to a data server. >From Twisted, I know that a method is called if the connection fails by whatever reason. I tried to get the same results with Kamaelia's TCPClient component. If I star

Magic function

2008-01-11 Thread dg . google . groups
Hi all, I'm part of a small team writing a Python package for a scientific computing project. The idea is to make it easy to use for relatively inexperienced programmers. As part of that aim, we're using what we're calling 'magic functions', and I'm a little bit concerned that they are dangerous c

Re: alternating string replace

2008-01-11 Thread Paddy
On Jan 11, 9:54 am, Chris <[EMAIL PROTECTED]> wrote: > On Jan 9, 12:34 pm, cesco <[EMAIL PROTECTED]> wrote: > > > Hi, > > > say I have a string like the following: > > s1 = 'hi_cat_bye_dog' > > and I want to replace the even '_' with ':' and the odd '_' with ',' > > so that I get a new string like

Re: Converting a bidimensional list in a bidimensional array

2008-01-11 Thread Diez B. Roggisch
Santiago Romero schrieb: >>> - Speed Performance: Do you think that changing from list to Array() >>> would improve speed? I'm going to do lots of tilemap[y][x] checks (I >>> mean, player jumping around the screen, checking if it's falling over >>> a non-zero tile, and so). > >> First of all: if y

Re: split parameter line with quotes

2008-01-11 Thread teddyber
On 11 jan, 20:28, Nanjundi <[EMAIL PROTECTED]> wrote: > On Jan 11, 1:50 pm, teddyber <[EMAIL PROTECTED]> wrote: > > > Hello, > > > first i'm a newbie to python (but i searched the Internet i swear). > > i'm looking for some way to split up a string into a list of pairs > > 'key=value'. This code sh

Re: split parameter line with quotes

2008-01-11 Thread Joshua Kugler
teddyber wrote: > first i'm a newbie to python (but i searched the Internet i swear). > i'm looking for some way to split up a string into a list of pairs > 'key=value'. This code should be able to handle this particular > example string : > > qop="auth,auth-int,auth-conf",cipher="rc4-40,rc4-56,rc

number of element in array/matrix

2008-01-11 Thread Tommy Grav
On Jan 11, 2008, at 11:09 AM, [EMAIL PROTECTED] wrote: > > Hi, > I have what I suspect to be a fairly simple problem while using > python Numeric. > I am attempting to count the number of times that an element 'b' > occurs in > numeric array 'a'. I tried unsuccessfully to find a more efficien

Re: Graphics Module

2008-01-11 Thread Mike
On Jan 11, 3:31 pm, "Gabriel" <[EMAIL PROTECTED]> wrote: > Hi all ! > > I'm developing a math program that shows graphics of functions. > I would hear suggestions about the way of drawing 2D . > > Thanks a lot for your answers. > > - Gabriel - That's not a very descriptive question, however most p

Re: Analyzing Python GC output - turns out to be MySQLdb problem

2008-01-11 Thread John Nagle
Francesco Guerrieri wrote: > On Jan 11, 2008 6:20 PM, John Nagle <[EMAIL PROTECTED]> wrote: >> Tried: >> print item.dir() >> got: >> 'cell' object has no attribute 'dir' It's a problem inside MySQLdb's "connections.py": def _get_unicode_literal(): def uni

Re: Newbie wants to get visual

2008-01-11 Thread Mike
On Jan 11, 1:50 pm, [EMAIL PROTECTED] wrote: > I'm ready to start coding the parser for my Decaf (beginners) > language. I think that a "visual" parser (one that shows what it's > doing as it does it) would be nice. (And I think that it would help > the parser author by saving the requirement for a

Re: Python too slow?

2008-01-11 Thread sturlamolden
On 10 Jan, 03:10, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > You are correct that optimizing Python is hard. However, in many cases, > the problem is not that Python is too slow, but the specific algorithm > chosen by the programmer is slow, e.g. no compiler optimization is going > to turn an O(

Re: virtualpython / workingenv / virtualenv ... shouldn't this be part of python

2008-01-11 Thread Goldfish
On Jan 11, 11:45 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Damjan wrote: > > My question is, shoudn't it be enough to set PYTHONPATH and everything > > automagically to work then? Is there some work done on this for python 3.0 > > or 2.6 perhaps? > > I'm working on a PEP for a per user site

Re: improving performance of python webserver running python scripts in cgi-bin

2008-01-11 Thread Mike Meyer
On Thu, 10 Jan 2008 23:17:28 -0800 (PST) Dale <[EMAIL PROTECTED]> wrote: > I am using a simple python webserver (see code below) to serve up > python scripts located in my cgi-bin directory. > > import BaseHTTPServer > import CGIHTTPServer > class Handler(CGIHTTPServer.CGIHTTPRequestHandler): >

RE: Newbie question on Classes

2008-01-11 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of John Machin > Sent: Friday, January 11, 2008 4:08 PM > To: python-list@python.org > Subject: Re: Newbie question on Classes > > On Jan 11, 9:27 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: >

Re: split parameter line with quotes

2008-01-11 Thread Paul McGuire
On Jan 11, 12:50 pm, teddyber <[EMAIL PROTECTED]> wrote: > Hello, > > first i'm a newbie to python (but i searched the Internet i swear). > i'm looking for some way to split up a string into a list of pairs > 'key=value'. This code should be able to handle this particular > example string : > > qop

Re: Newbie question on Classes

2008-01-11 Thread Nanjundi
On Jan 10, 5:32 pm, "Steven Clark" <[EMAIL PROTECTED]> wrote: > > l = [] > > l.append(man) > > l.append(woman) > > > # Print the state. > > for item in l: > > print item.state() > > Small, off-topic nitpick: > please don't use "l" (lower-case el) as a variable name. > > >Fromhttp://www.python.or

Re: Using a proxy with urllib2

2008-01-11 Thread Rob Wolfe
"Jack" <[EMAIL PROTECTED]> writes: > Rob, > > I tried your code snippet and it worked great. I'm just wondering if > getopener( ) call > is lightweight so I can just call it in every call to fetchurl( )? Or I > should try to share > the opener object among fetchurl( ) calls? Creating an opener

Newbie wants to get visual

2008-01-11 Thread MartinRinehart
I'm ready to start coding the parser for my Decaf (beginners) language. I think that a "visual" parser (one that shows what it's doing as it does it) would be nice. (And I think that it would help the parser author by saving the requirement for a bazillion print statements while debugging the tool.

Import and execfile()

2008-01-11 Thread George Sakkis
I maintain a few configuration files in Python syntax (mainly nested dicts of ints and strings) and use execfile() to read them back to Python. This has been working great; it combines the convenience of pickle with the readability of Python. So far each configuration is contained in a single stand

Re: Python too slow?

2008-01-11 Thread sturlamolden
On 9 Jan, 20:11, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is there a better way to do color tracking, or is Python just too slow > as an interpreted language to do any effective color tracking? The slowness stems from the use of k-means clustering on each frame. SciPy's clustering module

Re: opensg or openscenegraph

2008-01-11 Thread serilanimi
On Jan 4, 3:08 pm, yomgui <[EMAIL PROTECTED]> wrote: > Hi, > > I need to use a scengraph for my python/opengl application > but I have trouble finding out which one I should use. > > opensg or openscenegraph (OSG) ? > > I suppose the quality of the python bindings will make the decision. > > any ad

extracting Javadocs using Python

2008-01-11 Thread Rajarshi
Hi, I work on a Java project and I was thinking out creating a hook in the subversion repo for the project that would check whether a class and it's associated methods were documented with Javadocs. Since I have written Subversion hooks for other purposes in Python, I'd like to try and do this tas

Re: scope question in a switch mixin

2008-01-11 Thread John Machin
[EMAIL PROTECTED] wrote: > The code that follows is the result of noodling around with switches as a > learning tool. I've played with python for a few years, but I'm self-taught, > so . . . > > Class Switch builds a set of functions. Method switch executes one of them > given a value of the sw

Re: Magic function

2008-01-11 Thread Ruediger
[EMAIL PROTECTED] wrote: > Hi all, > > I'm part of a small team writing a Python package for a scientific > computing project. The idea is to make it easy to use for relatively > inexperienced programmers. As part of that aim, we're using what we're > calling 'magic functions', and I'm a little b

Re: virtualpython / workingenv / virtualenv ... shouldn't this be part of python

2008-01-11 Thread Christian Heimes
Goldfish wrote: > What about security holes, like a malicious version of socket getting > downloaded into a user's directory, and overriding the default, safe > version? Don't forget that in your PEP. A malicious piece of software has already hundreds of way to overwrite modules. It could add a py

RE: alternating string replace

2008-01-11 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of cesco > Sent: Wednesday, January 09, 2008 5:34 AM > To: python-list@python.org > Subject: alternating string replace > > Hi, > > say I have a string like the following: > s1 = 'hi_cat_bye_dog'

Graphics Module

2008-01-11 Thread Gabriel
Hi all ! I'm developing a math program that shows graphics of functions. I would hear suggestions about the way of drawing 2D . Thanks a lot for your answers. - Gabriel - -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop without variable

2008-01-11 Thread Neil Hodgson
Marty: > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) Another way to write this is data_out = [[]] * len(data_in) Neil -- http://mail.python.org/mailman/listinfo/python-list

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 2:57 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Any ideas for a thread-safe list.removeall( X ): removing all > > occurrences of X within list L, when L might be modified concurrently? > > That way lies madness. Do something sensible instead. Put a

Re: split parameter line with quotes

2008-01-11 Thread teddyber
wow! that's perfect this shlex module! thanks for pointing this! On 11 jan, 20:36, Joshua Kugler <[EMAIL PROTECTED]> wrote: > teddyber wrote: > > first i'm a newbie to python (but i searched the Internet i swear). > > i'm looking for some way to split up a string into a list of pairs > > 'key=valu

Re: split parameter line with quotes

2008-01-11 Thread teddyber
i know this is some kind of bad design but the problem is that i receive this string from a jabber server and i cannot do anything to change this. i should try to verify if that's correct implementation of jabber protocol still... On 11 jan, 22:02, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jan 11,

Re: for loop without variable

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 22:18:22 GMT Neil Hodgson <[EMAIL PROTECTED]> wrote: > Marty: > > I recently faced a similar issue doing something like this: > > data_out = [] > > for i in range(len(data_in)): > > data_out.append([]) > > Another way to write this is > data_out = [[]] * le

Re: for loop without variable

2008-01-11 Thread Tim Chase
>> I recently faced a similar issue doing something like this: >> >> data_out = [] >> for i in range(len(data_in)): >> data_out.append([]) > > Another way to write this is > data_out = [[]] * len(data_in) ...if you're willing to put up with this side-effect: >>> data_in = ran

Re: split parameter line with quotes

2008-01-11 Thread teddyber
here's the solution i have for the moment : t = shlex.shlex(data) t.wordchars = t.wordchars + "/+.-" r='' while 1: token = t.get_token() if not token: break if not token==',': r = r+token else: r = r +

Re: encrypting python modules

2008-01-11 Thread Ben Finney
Paul Sijben <[EMAIL PROTECTED]> writes: > I know that I can not stop a dedicated hacker deconstructing my code. A direct consequence of this is that you can not stop *anyone* from deconstructing your code if it's in their possession. It takes only one dedicated, skilled person to crack your obfus

Re: Import and execfile()

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > I maintain a few configuration files in Python syntax (mainly nested > dicts of ints and strings) and use execfile() to read them back to > Python. This has been working great; it combines the convenience of > pic

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Faber J. Fedor
On 10/01/08 22:53 -0500, Mike Meyer wrote: > Personally, I think it would be more pythonic to not try and use two > different APIs to walk the list of jobs (... One Way To Do it): > > def __call__(self, where=None): > q = "select * from %s" % (self.name,) + ("" if not where else (" where > %s

installing mod_python

2008-01-11 Thread Milad
I downloaded mod_python and Enter: sh install-sh but the installer said that you would install DSO http://httpd.apache.org/docs/2.0/dso.html http://httpd.apache.org/docs/2.0/programs/apxs.html but how cat in install DSO and apxs? I'm using ubuntu gnu/linux -- http://mail.python.org/mailman/listin

Re: encrypting python modules

2008-01-11 Thread Mike Meyer
On Sat, 12 Jan 2008 09:47:26 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > Paul Sijben <[EMAIL PROTECTED]> writes: > > I know that I can not stop a dedicated hacker deconstructing my code. > A direct consequence of this is that you can not stop *anyone* from > deconstructing your code if it's in t

Re: python recursive function

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 06:30:04 -0600, Nick Craig-Wood wrote: > HYRY <[EMAIL PROTECTED]> wrote: >> def bears (n): >> if n==42: >> return True ... >> return False > > Almost but you missed a case... Why are you people doing the OP's homework for him? And then DEBUGGING it as wel

Re: removeall() in list

2008-01-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > This function just wants X out of the list. It doesn't matter if this > happens before, during, or after something else; so long as it happens. If you're asking in a general way how to do something like that, there are several basic methods: 1. Put a single thread in

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 18:11:41 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > On 10/01/08 22:53 -0500, Mike Meyer wrote: > > Personally, I think it would be more pythonic to not try and use two > > different APIs to walk the list of jobs (... One Way To Do it): > > > > def __call__(self, where

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Hrvoje Niksic
"Faber J. Fedor" <[EMAIL PROTECTED]> writes: > On 10/01/08 22:53 -0500, Mike Meyer wrote: >> Personally, I think it would be more pythonic to not try and use two >> different APIs to walk the list of jobs (... One Way To Do it): >> >> def __call__(self, where=None): >> q = "select * from %s"

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:26 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > This function just wants X out of the list. It doesn't matter if this > > happens before, during, or after something else; so long as it happens. > > 2. Associate a lock with the list. Anything wantin

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:43 pm, [EMAIL PROTECTED] wrote: > On Jan 11, 5:26 pm, Paul Rubin wrote: > > > [EMAIL PROTECTED] writes: > > > This function just wants X out of the list. It doesn't matter if this > > > happens before, during, or after something else; so long as it happens.

Re: removeall() in list

2008-01-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > > 2. Associate a lock with the list. Anything wanting to access the > > list should acquire the lock, do its stuff, then release the lock. > > This gets confusing after a while. > > To keep it generic, how about: > > listA.op( insert, x ) > listA.op( remove, x ) Sure

Re: virtualpython / workingenv / virtualenv ... shouldn't this be part of python

2008-01-11 Thread Paul Boddie
On 11 Jan, 21:44, Goldfish <[EMAIL PROTECTED]> wrote: > > What about security holes, like a malicious version of socket getting > downloaded into a user's directory, and overriding the default, safe > version? Don't forget that in your PEP. As Christian points out, there are various exploitable we

converting JSON to string

2008-01-11 Thread Gowri
Hello, I actually have two questions: 1. Are there any libraries which convert XML to JSON? 2. I am currently doing the above using the DOM parser and creating a JSON array for node in doc.getElementsByTagName("book"): isbn = node.getAttribute("isbn") titleNode =

Re: Magic function

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 08:29:18 -0800, dg.google.groups wrote: > Hi all, > > I'm part of a small team writing a Python package for a scientific > computing project. The idea is to make it easy to use for relatively > inexperienced programmers. ... > This is fine, but we decided that for clarity o

IDLE won't start in Python 2.5 for Windows

2008-01-11 Thread mikez302
I have Python 2.5 and Windows XP SP2. For a while, IDLE worked, but now it doesn't. The last time I was using it, I was changing some keyboard shortcuts, then the window suddenly disappeared. Since then, I haven't been able to start it. When I try to start it, I see pythonw.exe come up on my Ta

Re: Import and execfile()

2008-01-11 Thread Mitko Haralanov
On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > # trying to set the configuration: > CFG = {} > execfile('path/to/some_config.py', CFG) > > Traceback (most recent call last): > ... > ImportError: No module named master_config > > > I understand why this fails

Re: encrypting python modules

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 10:44:36 +0100, Paul Sijben wrote: > Hello, > > this question has come by repeatedly in several guises over the past > years but has never been solved in this forum as far as I have been able > to Google. > > However since so many people are asking the question, I hope someon

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 5:51 pm, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > listA.op( insert, x ) > > listA.op( remove, x ) > > Sure, there are various ways you can make the code look uniform. What > gets messy is if you want to (say) operate on several lists at the > same tim

Re: Python in IIS + WSGI

2008-01-11 Thread mr . zeitgeist
On Jan 12, 1:42 am, Phillip Sitbon <[EMAIL PROTECTED]> wrote: > Pardon my typo! > > http://pyisapie.sourceforge.net > > On Jan 11, 4:37 pm, Phillip Sitbon <[EMAIL PROTECTED]> wrote: > > > Recently (finally) updated the PyISAPIe project. Version 1.0.4 > > includes WSGI support (tested with current D

Python in IIS + WSGI

2008-01-11 Thread Phillip Sitbon
Recently (finally) updated the PyISAPIe project. Version 1.0.4 includes WSGI support (tested with current Django SVN and Trac 0.10) and a Django-native handler, as well as other examples of using it as a standalone web app. Also added some installation/usage docs on the project page. Comments/fee

Re: removeall() in list

2008-01-11 Thread castironpi
On Jan 11, 6:17 pm, [EMAIL PROTECTED] wrote: > On Jan 11, 5:51 pm, Paul Rubin wrote: > > > > > [EMAIL PROTECTED] writes: > > > listA.op( insert, x ) > > > listA.op( remove, x ) > > > Sure, there are various ways you can make the code look uniform. What > > gets messy is

Re: Python in IIS + WSGI

2008-01-11 Thread Phillip Sitbon
Pardon my typo! http://pyisapie.sourceforge.net On Jan 11, 4:37 pm, Phillip Sitbon <[EMAIL PROTECTED]> wrote: > Recently (finally) updated the PyISAPIe project. Version 1.0.4 > includes WSGI support (tested with current Django SVN and Trac 0.10) > and a Django-native handler, as well as other exa

Re: IDLE won't start in Python 2.5 for Windows

2008-01-11 Thread Tommy Nordgren
On 12 jan 2008, at 01.18, mikez302 wrote: > I have Python 2.5 and Windows XP SP2. For a while, IDLE worked, but > now it doesn't. The last time I was using it, I was changing some > keyboard shortcuts, then the window suddenly disappeared. Since then, > I haven't been able to start it. > > Whe

Re: converting JSON to string

2008-01-11 Thread Adonis Vargas
Gowri wrote: > Hello, > > I actually have two questions: > 1. Are there any libraries which convert XML to JSON? > 2. I am currently doing the above using the DOM parser and creating a > JSON array > > > for node in doc.getElementsByTagName("book"): > isbn = node.getAttribute("is

Re: encrypting python modules

2008-01-11 Thread Marc 'BlackJack' Rintsch
On Sat, 12 Jan 2008 09:47:26 +1100, Ben Finney wrote: > Trying to make bits uncopyable and unmodifiable is like trying to make > water not wet. Certainly not. I can put water into the freezer, but I have no idea how to make bits uncopyable and unmodifiable while still delivering them to the clie

Re: Magic function

2008-01-11 Thread Michael Tobis
On Jan 11, 6:15 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Your users are *scientists*, and you don't trust their intellectual > ability to learn a programming language as simple as Python? > > Instead of spending time and effort writing, debugging and maintaining > such a

Re: converting JSON to string

2008-01-11 Thread Gowri
Hi Adonis, Thanks so much. Appreciate it :) -- http://mail.python.org/mailman/listinfo/python-list

Re: encrypting python modules

2008-01-11 Thread Ben Finney
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Sat, 12 Jan 2008 09:47:26 +1100, Ben Finney wrote: > > > Trying to make bits uncopyable and unmodifiable is like trying to > > make water not wet. > > Certainly not. I can put water into the freezer Turning it into ice, and making it no

Re: removeall() in list

2008-01-11 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Could you: > > lockerA= Locker( listA, listB ) > lockerA.op( listB.reverse ) > lockerA.op( listA.pop ) > > Where lockerA ops acquire the locks on all its threads? I don't understand that question. The main thing to understand is that multi-threaded programming is com

Re: alternating string replace

2008-01-11 Thread George Sakkis
On Jan 9, 6:34 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > cesco <[EMAIL PROTECTED]> wrote: > > Hi, > > > say I have a string like the following: > > s1 = 'hi_cat_bye_dog' > > and I want to replace the even '_' with ':' and the odd '_' with ',' > > so that I get a new string like the following: >

ctypes, GetWindowLongPtr

2008-01-11 Thread Henry Baxter
Hello, I have been happily using ctypes for a while to do win32 programming. I use the Microsoft documentation to understand the function, then call it with the help of ctypes. The problem is that the docs says user32.dll has GetWindowLongPtr, but ctypes can't find it using windll.user32.GetWindo

Re: alternating string replace

2008-01-11 Thread Paul Rubin
George Sakkis <[EMAIL PROTECTED]> writes: > from itertools import chain, izip, cycle > print ''.join(chain(*izip(s1.split('_'),cycle(':,'[:-1] from itertools import cycle a = cycle(':,') print re.sub('_', lambda x: a.next(), s1) -- http://mail.python.org/mailman/listinfo/python-list

Re: Magic function

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 17:36:10 -0800, Michael Tobis wrote: > On Jan 11, 6:15 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> Your users are *scientists*, and you don't trust their intellectual >> ability to learn a programming language as simple as Python? >> >> Instead of spe

Re: alternating string replace

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 14:55:18 -0600, Reedick, Andrew wrote: > For those of us who still think in Perl, here's an easy to read ... > s = re.sub(r'_(.*?(_|$))', r':\1', s) "Easy to read"? Oh that's priceless. Andrew, you should consider writing comedy professionally! -- Steven -- http://mail.

Re: os.rename() problems on OS X

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 12:29:24 -0800, lukas wrote: > hello, > > i recently had the job of having to rename about 200 files. The source > for the renaming was a bunch of names in a file. I know next to nothing > when it comes to bash scripting (which would have seemed the obvious > choice) so i used

Re: Python too slow?

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 09:55:08 -0800, sturlamolden wrote: > It seems the code he is referring to is doing k-means clustering on each > frame. The clustering is done by from SciPy's cluster module, which is > doing 'vector quantitization'. The algorithm is written in plain C. It > is not Python that

Re: alternating string replace

2008-01-11 Thread Pablo Ziliani
Paul Rubin wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > >> from itertools import chain, izip, cycle >> print ''.join(chain(*izip(s1.split('_'),cycle(':,'[:-1] >> > > from itertools import cycle > a = cycle(':,') > print re.sub('_', lambda x: a.next(), s1) > Lovely. If there

Re: Python too slow?

2008-01-11 Thread Steven D'Aprano
On Fri, 11 Jan 2008 09:52:17 -0800, Paul Boddie wrote: > These days, I seriously doubt that anyone uses the term "interpreted" to > mean "parses the source text and works out what to do, over and over > again as the program runs". Given the way that people seem to use "interpreted" as a pejorativ

<    1   2   3   >