PyCon 2010 US - Call For Tutorials Ending Soon

2009-10-13 Thread Greg Lindstrom
The period to submit proposals to teach a tutorial at PyCon 2010 US ends on Sunday, October 18th. There is still time for you to get a proposal on your favorite Python topic and teach a 3-hour class (with breaks and refreshments) to your colleagues on the Wednesday or Thursday before the

reifying indent and dedent into braces

2009-10-13 Thread Rustom Mody
At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that the python code if foo: ... if bar: ... x = 42 ... else: ... print foo ... has its indentation structure made explicit as if foo :[0] INDENT if bar : [0, 4] INDENT x = 42

Re: reifying indent and dedent into braces

2009-10-13 Thread Stefan Behnel
Rustom Mody wrote: I am trying to generate some python code and its indentation=structure is giving me a headache! Have you considered searching the web for Python code generator? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Still wrong architecture on Snow Leopard

2009-10-13 Thread Xiao Yu
Hi everyone, I have Snow Leopard and followed 4.6.1 snapshot 20091010's reference 3.4 instructions to configure both SIP and PyQt in i386. Everything installed fine but when I open Python and tried to import ImageQt, I get the following error: Traceback (most recent call last): File

Re: reifying indent and dedent into braces

2009-10-13 Thread Steven D'Aprano
On Tue, 13 Oct 2009 12:35:13 +0530, Rustom Mody wrote: At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that the python code if foo: ... if bar: ... x = 42 ... else: ... print foo ... has its indentation structure made explicit as if foo :

Re: Still wrong architecture on Snow Leopard

2009-10-13 Thread Ned Deily
In article 89f50109-83f9-4c1e-8e0d-7f985b1c2...@xiao-yu.com, Xiao Yu x...@xiao-yu.com wrote: I have Snow Leopard and followed 4.6.1 snapshot 20091010's reference 3.4 instructions to configure both SIP and PyQt in i386. Everything installed fine but when I open Python and tried to import

Where to find pexpect

2009-10-13 Thread Antoon Pardon
I have been looking for pexpect. The links I find like http://pexpect.sourceforge.net all end up at http://www.noah.org/wiki/Pexpect which produces a 404 not found problem. Does someone know the current location? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against while True: loops

2009-10-13 Thread John Reid
Mensanator wrote: Nothing wrong with a having a break IMHO. My opinion is that there is everything wrong with having a break. I don't think I have ever used one, I write code that doesn't depend on that crutch. I guess its crutch-iness is in the eye of the beholder. You seem to have a

twill unicode related

2009-10-13 Thread james27
hello im learning twill,but have some problem with unicode. whenever i use twill's follow function which emulate webbrowser link click function,it can work well with english link,but can't work with unicode. does anybody some know about this probelm? thank in advance follow is sample # -*-

RE: How to run python script in emacs

2009-10-13 Thread Sells, Fred
Here is the .emacs file I place at c:\ on xp. I don't understand it and cannot explain it. It was developed by a few guys I worked with 20 years ago and still does the job. Probably quite obsolete by now, but if it ain't broke... In response to your what do you mean With the cursor in a python

Form Value Won't Post/Submit

2009-10-13 Thread SuperMetroid
The html code of the form, and my code are below. I can't get the value to post/submit.. instead I get an error. Can anyone help? HTML Code of Form: form method='post' autocomplete='off' input type='hidden' name='action' value='grant-revoke' / input type='hidden'

Re: It Doesn't Add Up!

2009-10-13 Thread Stephen Hansen
On Mon, Oct 12, 2009 at 11:33 AM, Victor Subervi victorsube...@gmail.comwrote: for row in data: i += 1 total = 0 quantity = form.getfirst('order_' + str(i), '') if quantity != '': sql = 'select * from products p join %s c on p.ID=c.ID where c.ID=%s;' %

Re: Work around metaclass programming

2009-10-13 Thread Diez B. Roggisch
Zac Burns schrieb: I have a class called Signal which is a descriptor. It is a descriptor so that it can create BoundSignals, much like the way methods work. What I would like to do is to have the class be a descriptor when instantiated in what will be the locals of the class, but not a

Re: Where to find pexpect

2009-10-13 Thread Javier Collado
Hello, Google is your friend: http://sourceforge.net/projects/pexpect/ http://sourceforge.net/projects/pexpect/files/pexpect/Release%202.3/pexpect-2.3.tar.gz/download Best regards, Javier 2009/10/13 Antoon Pardon apar...@forel.vub.ac.be: I have been looking for pexpect. The links I find

Re: An assessment of Tkinter and IDLE

2009-10-13 Thread Ben Finney
TerryP bigboss1...@gmail.com writes: One thing you should also learn about me, is I do not deal in absolutes. What, *never*? That's a pretty uncompromising position to h— I'll get my coat. -- \ “Smoking cures weight problems. Eventually.” —Steven Wright | `\

Re: The rap against while True: loops

2009-10-13 Thread Grant Edwards
On 2009-10-12, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: my_prissy_little_indicator_variable = true while (my_prissy_little_indicator_variable){ body } isn't satisfying because it doesn't guard the body with any assurance that the loop invariant will be true before you enter into

Re: What do I do now?

2009-10-13 Thread n00m
I'm going to develop further my py. script for text detection and localization in raster images: http://funkybee.narod.ru/ Slow Doe... -- http://mail.python.org/mailman/listinfo/python-list

Re: In python CGI, how to pass hello back to a javascript function as an argument at client side?

2009-10-13 Thread Bruno Desthuilliers
zxo102 a écrit : Hi everyone, How can I pass a string generated from python cgi at server side to a javascript function as an argument at client side? This is common HTTP / javascriot stuff - nothing related to Python. First learn about the HTTP protocol - something you obviously need if

Re: Form Value Won't Post/Submit

2009-10-13 Thread Piet van Oostrum
SuperMetroid xsupermetro...@gmail.com (S) wrote: S The html code of the form, and my code are below. I can't get the S value to post/submit.. instead I get an error. Can anyone help? S HTML Code of Form: S form method='post' autocomplete='off' S input type='hidden' name='action'

Re: In python CGI, how to pass hello back to a javascript function as an argument at client side?

2009-10-13 Thread Piet van Oostrum
zxo102 zxo...@gmail.com (z) wrote: z Hi everyone, z How can I pass a string generated from python cgi at server side z to a z javascript function as an argument at client side? z I want test.py to return a hello back so the javascript function z load takes hello as argument like

RabbitMQ vs ApacheQpid (AMQP)

2009-10-13 Thread jacopo
Short question: I am considering two solutions for a distributed system: either RabbitMQ with py-amqplib or ApacheQpid with its own set of API. I wander is any of you would be able to compare the two. In particular, I would expect that since Apache comes with its own documented Python API this

does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg format. I would like to convert this to a simple RGB format buffer to pass to numpy. Has anyone managed this using libjpeg or any other

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Stefan Behnel
Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg format. I would like to convert this to a simple RGB format buffer to pass to numpy. Has anyone managed this

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
In answering my own question, this can be done trivially with PIL. Here is a self contained example: In [1]: import httplib In [2]: from PIL import ImageFile In [3]: import numpy as np In [4]: conn = httplib.HTTPConnection('www.therealstevencolbert.com') In [5]: conn.request('GET',

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Heh, for whatever reason, your post is dated earlier than my response, but wasn't here when I sent mine. But yeah, PIL worked. On Tue, Oct 13, 2009 at 12:04 PM, Stefan Behnel stefan...@behnel.de wrote: Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Dave Angel
Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg format. I would like to convert this to a simple RGB format buffer to pass to numpy. Has anyone managed this

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
My emails must not be making it to list... I posted a solutions about 10 minutes after I posted the questions. Thanks! On Tue, Oct 13, 2009 at 12:35 PM, Dave Angel da...@ieee.org wrote: Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images via http

Re: reifying indent and dedent into braces

2009-10-13 Thread rustom
On Oct 13, 12:45 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Have you looked at the tokenize module? http://docs.python.org/library/tokenize.html Thanks Steven -- that was what I was looking for. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run python script in emacs

2009-10-13 Thread rustom
On Sep 26, 8:54 pm, devilkin devilsp...@gmail.com wrote: I'm just starting learning python, and coding in emacs. I usually split emacs window into two, coding in one, and run script in the other, which is not very convenient. anyone can help me with it? is there any tricks like emacs short

Re: postprocessing in os.walk

2009-10-13 Thread kj
In mailman.1196.1255347115.2807.python-l...@python.org Dave Angel da...@ieee.org writes: kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets invoked just before

undefined symbol: TLSv1_method error when import psycopg2

2009-10-13 Thread 一首诗
I installed psycopg2 by easy_install psycopg2 on CentOS 5.3, no error was reported, but when I tried import psycopg2, I got : exceptions.ImportError: /usr/lib/python2.4/site-packages/ psycopg2-2.0.9-py2.4-linux-i686.egg/psycopg2/_psycopg.so: undefined symbol: TLSv1_method What might cause

Cannot upload a good egg on pypi

2009-10-13 Thread Luca Fabbri
Hi all. I've problems while using setuptools for getting an egg and upload it on pypi. The egg (in bdist_egg or sdist format) are always corrupted as far as a lot of files are not included in the zip, tar.gz or egg results. Looking at google it seems that this problem has been fixed (related to

Re: postprocessing in os.walk

2009-10-13 Thread Peter Otten
kj wrote: In mailman.1196.1255347115.2807.python-l...@python.org Dave Angel da...@ieee.org writes: kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback, called postprocess, that gets

speed up linecache.getline()

2009-10-13 Thread bbarbero
Hi Everyone!! I am using linecache.getline, to access to a line in a long file. It s really fast, appx 4seconds, but I was just wandering if any of you, know either another way, or there is something that I can do to speed it up... thank you very much for your help!! Regards, Bea

Re: postprocessing in os.walk

2009-10-13 Thread Paul Rubin
kj no.em...@please.post writes: I think you're missing the point. The hook in question has to be called *immediately after* all the subtrees that are rooted in subdirectories contained in the current directory have been visited by os.walk. I'd love to see your 5 lines for *that*. I'm

Is somebody used Python in LabVIEW?

2009-10-13 Thread Nadav Chernin
Hi, I use Python as scripting tool in LabVIEW. I use lvpython.dll that include only built-in modules of python. But I need to use for example also urllib that is not included in lvpython.dll. How can I use it also? Thanks, Nadav --

Re: Where to find pexpect

2009-10-13 Thread Jean-Michel Pichavant
Antoon Pardon wrote: I have been looking for pexpect. The links I find like http://pexpect.sourceforge.net all end up at http://www.noah.org/wiki/Pexpect which produces a 404 not found problem. Does someone know the current location? maybe they removed the distribution so you may use

Re: Cannot upload a good egg on pypi

2009-10-13 Thread Chris Withers
Luca Fabbri wrote: I've problems while using setuptools for getting an egg and upload it on pypi. The egg (in bdist_egg or sdist format) are always corrupted as far as a lot of files are not included in the zip, tar.gz or egg results. Looking at google it seems that this problem has been fixed

Re: a=[1,2,3,4].reverse() - why a is None?

2009-10-13 Thread Simon Forman
On Mon, Oct 12, 2009 at 4:44 AM, Nadav Chernin nada...@qualisystems.com wrote:        Chris Withers wrote:        ...becauase you were looking for:        reversed([1,2,3,4]) OK, but my question is generic. Why when I use object's function that changed values of the object, I can't to get

Input redirection with IDLE

2009-10-13 Thread candide
Hi Does IDLE (the default GUI avalaible with the standard distribution) support redirection from the standard input ? To be more precise, inside a Windows or Linux shell I may redirect input data from a text file to be executed by a python file. For instance suppose I have this python file #

os.chmod problem

2009-10-13 Thread Victor Subervi
Hi; I have the following code: if 13 x 20: y += 1 w += 1 try: getpic = getpic + str(w) + .py try: os.remove(getpic) except: pass code = #! /usr/bin/python import

Re: os.chmod problem

2009-10-13 Thread Victor Subervi
Never mind. I just discovered that os.chmod requires 0755, not just 755. V On Tue, Oct 13, 2009 at 9:26 AM, Victor Subervi victorsube...@gmail.comwrote: Hi; I have the following code: if 13 x 20: y += 1 w += 1 try: getpic =

Re: pickle's backward compatibility

2009-10-13 Thread M.-A. Lemburg
exar...@twistedmatrix.com wrote: On 03:17 pm, pengyu...@gmail.com wrote: Hi, If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version of python. What if I serialize (using pickle) an object of a class

When to derive from object?

2009-10-13 Thread Igor Mikushkin
Hello all! I'm a newbie to Python. Could you please say me when it is better to derive from object and when not? Thanks, Igor -- http://mail.python.org/mailman/listinfo/python-list

Re: When to derive from object?

2009-10-13 Thread Bruno Desthuilliers
Igor Mikushkin a écrit : Hello all! I'm a newbie to Python. Welcome onboard Could you please say me when it is better to derive from object and when not? - When not : when using Python = 3.0, or when already subclassing another class. - When : any other case !-) --

Re: When to derive from object?

2009-10-13 Thread Matimus
On Oct 13, 7:45 am, Igor Mikushkin igor.mikush...@gmail.com wrote: Hello all! I'm a newbie to Python. Could you please say me when it is better to derive from object and when not? Thanks, Igor The only reason to derive from 'object' is if there is some sort of weird side effect of using

Re: pickle's backward compatibility

2009-10-13 Thread exarkun
On 02:48 pm, m...@egenix.com wrote: exar...@twistedmatrix.com wrote: On 03:17 pm, pengyu...@gmail.com wrote: Hi, If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version of python. What if I serialize

Re: pickle's backward compatibility

2009-10-13 Thread M.-A. Lemburg
exar...@twistedmatrix.com wrote: On 02:48 pm, m...@egenix.com wrote: exar...@twistedmatrix.com wrote: On 03:17 pm, pengyu...@gmail.com wrote: Hi, If I define my own class and use pickle to serialize the objects in this class, will the serialized object be successfully read in later version

Re: The rap against while True: loops

2009-10-13 Thread Mensanator
On Oct 13, 3:44�am, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: Mensanator wrote: Nothing wrong with a having a break IMHO. My opinion is that there is everything wrong with having a break. I don't think I have ever used one, I write code that doesn't depend on that crutch. I guess

efficient running median

2009-10-13 Thread Janto Dreijer
I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median of a sliding window) is unfortunately too slow as my sliding windows are quite large

Re: When to derive from object?

2009-10-13 Thread Matimus
On Oct 13, 8:02 am, Matimus mccre...@gmail.com wrote: On Oct 13, 7:45 am, Igor Mikushkin igor.mikush...@gmail.com wrote: Hello all! I'm a newbie to Python. Could you please say me when it is better to derive from object and when not? Thanks, Igor The only reason to derive from

Re: Is pythonic version of scanf() or sscanf() planned?

2009-10-13 Thread Aahz
In article b413e049-8f3f-4cdd-b702-341714763...@r36g2000vbn.googlegroups.com, ryniek90 rynie...@gmail.com wrote: But I remember that lambda function also was unwelcome in Python, but finally it is and is doing well. So maybe someone, someday decide to put in Python an alternative, really great

setting variables in the local namespace

2009-10-13 Thread Chris Withers
Hi All, Say I have a piece of code like this: mname = model.__name__ fname = mname+'_order' value = request.GET.get('order') if value: request.session[fname]=value else: value = request.session.get( fname,

Re: The rap against while True: loops

2009-10-13 Thread John Reid
Mensanator wrote: No, it's just that the OP was asking whether avoiding while True is considered Best Practice. How can you answer such a question without sounding dogmatic? I was just pointing out your style of programming seems inflexible. Just another line that has to be interpreted

Re: efficient running median

2009-10-13 Thread Peter Otten
Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median of a sliding window) is unfortunately too slow as my

Re: [OT] organizing your scripts, with plenty of re-use

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 03:48:00 -0300, Dennis Lee Bieber wlfr...@ix.netcom.com escribió: On Mon, 12 Oct 2009 16:36:58 -0700, Ethan Furman et...@stoneleaf.us declaimed the following in gmane.comp.python.general: coffe table, you look in your car, etc, etc, and so forth. If you move a file in a

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 12, 4:30 pm, Carl Banks pavlovevide...@gmail.com wrote: On Oct 12, 11:24 am, Buck workithar...@gmail.com wrote: On Oct 10, 9:44 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The good thing is that, if the backend package is properly installed   somewhere in the Python

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 12, 3:34 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Mon, 12 Oct 2009 15:24:34 -0300, Buck workithar...@gmail.com escribió: On Oct 10, 9:44 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: The good thing is that, if the backend package is properly installed  

Re: postprocessing in os.walk

2009-10-13 Thread Dave Angel
Peter Otten wrote: kj wrote: In mailman.1196.1255347115.2807.python-l...@python.org Dave Angel da...@ieee.org writes: kj wrote: Perl's directory tree traversal facility is provided by the function find of the File::Find module. This function accepts an optional callback,

Re: setting variables in the local namespace

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 13:05:03 -0300, Chris Withers ch...@simplistix.co.uk escribió: What I'd be looking for is something like: locals()[name]=value ...or, say: setattr(somethingspecial,name,value) Now, I got horribly flamed for daring to be so heretical as to suggest this might be a

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Ethan Furman
Buck wrote: [snip] Steven had the nicest workaround (with the location = __import__ ('__main__').__file__ trick), but none of them solve the problem of the OP: organization of runnable scripts. So far it's been required to place all runnable scripts directly above any used packages. The

Re: speed up linecache.getline()

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 10:21:31 -0300, bbarb...@inescporto.pt escribió: I am using linecache.getline, to access to a line in a long file. It s really fast, appx 4seconds, but I was just wandering if any of you, know either another way, or there is something that I can do to speed it up...

Re: setting variables in the local namespace

2009-10-13 Thread Mick Krippendorf
Hello. Chris Withers schrieb: mname = model.__name__ fname = mname+'_order' value = request.GET.get('order') if value: request.session[fname]=value else: value = request.session.get( fname,

Re: postprocessing in os.walk

2009-10-13 Thread Ethan Furman
kj wrote: In mailman.1196.1255347115.2807.python-l...@python.org Dave Angel da...@ieee.org writes: [snippetty snip] Why would you need a special hook when the os.walk() generator yields exactly once per directory? So whatever work you do on the list of files you get, you can then put

Re: setting variables in the local namespace

2009-10-13 Thread Duncan Booth
Chris Withers ch...@simplistix.co.uk wrote: Now, if I want to do *exactly* the same thing with a variable named 'sort', I have to copy and paste the above code or do something hacky like have a dict called vars and manipulate that, or factor the above into a function and take the hit on

Re: The rap against while True: loops

2009-10-13 Thread Ethan Furman
Mensanator wrote: On Oct 13, 3:44�am, John Reid j.r...@mail.cryst.bbk.ac.uk wrote: while not done: seems very dangerous to me as you'd have to del done before writing the same construct again. That's the sort of thing that leads to errors. Duh. I won't write silly code like that either.

Re: efficient running median

2009-10-13 Thread Dave Angel
Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median of a sliding window) is unfortunately too slow as my sliding

Re: When to derive from object?

2009-10-13 Thread Anson Mackeracher
Can someone point me to some reason on why not to derive from Object when using Python = 3.0? I am a Python novice, I need some background. On Oct 13, 10:49 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: Igor Mikushkin a écrit : Hello all! I'm a newbie to

Re: efficient running median

2009-10-13 Thread Ethan Furman
Janto Dreijer wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). My naive attempt (taking the median of a sliding window) is unfortunately too slow as my sliding

Re: When to derive from object?

2009-10-13 Thread Benjamin Kaplan
On Tue, Oct 13, 2009 at 1:34 PM, Anson Mackeracher amack...@gmail.com wrote: Can someone point me to some reason on why not to derive from Object when using Python = 3.0? I am a Python novice, I need some background. It's redundant. Python 3 cleaned up a lot of the warts that appeared in

Re: setting variables in the local namespace

2009-10-13 Thread Carl Banks
On Oct 13, 9:05 am, Chris Withers ch...@simplistix.co.uk wrote: Hi All, Say I have a piece of code like this:          mname = model.__name__          fname = mname+'_order'          value = request.GET.get('order')          if value:              request.session[fname]=value          

Re: setting variables in the local namespace

2009-10-13 Thread Mel
Chris Withers wrote: - what is so wrong with wanting to set a variable in the local namespace based on a name stored in a variable? What's wrong is that no other statement using the local name space can know what that name might be. It's a documented fact that changing the locals()

Is pythonic version of scanf() or sscanf() planned?

2009-10-13 Thread ryniek90
In article b413e049-8f3f-4cdd-b702-341714763...@r36g2000vbn.googlegroups.com, ryniek90 rynie...@gmail.com wrote: But I remember that lambda function also was unwelcome in Python, but finally it is and is doing well. So maybe someone, someday decide to put in Python an alternative, really

Re: setting variables in the local namespace

2009-10-13 Thread Carl Banks
On Oct 13, 9:39 am, Mick Krippendorf mad.m...@gmx.de wrote: Yes, and, uh, yes. locals()['foo'] = bar works in that it does the same thing as foo = bar. So why don't you write that instead? Lemme guess. You tried this at the interactive prompt and concluded it worked in general, right? Even

Load a list subset with pickle?

2009-10-13 Thread Peng Yu
I use pickle to dump a long list. But when I load it, I only want to load the first a few elements in the list. I am wondering if there is a easy way to do so? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: When to derive from object?

2009-10-13 Thread Paul Rudin
Benjamin Kaplan benjamin.kap...@case.edu writes: It's redundant. Python 3 cleaned up a lot of the warts that appeared in Python over the years. Old-style classes (classes that didn't inherit from object) were one of them. Every class in Python 3 is derived from object whether you specify it

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 13:28:05 -0300, Buck workithar...@gmail.com escribió: On Oct 12, 3:34 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: Quoting Steven D'Aprano   (changing names slightly): You would benefit greatly from separating the interface from the backend. You should arrange

Re: Load a list subset with pickle?

2009-10-13 Thread Robert Kern
On 2009-10-13 13:00 PM, Peng Yu wrote: I use pickle to dump a long list. But when I load it, I only want to load the first a few elements in the list. I am wondering if there is a easy way to do so? Thank you! Not by pickling the list. However, you can concatenate pickles, so you could just

Re: efficient running median

2009-10-13 Thread Dale Dalrymple
On Oct 13, 8:22 am, Janto Dreijer jan...@gmail.com wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). ... Any suggestions? For a reference try: Comparison

Re: setting variables in the local namespace

2009-10-13 Thread Dave Angel
Mick Krippendorf wrote: snip Yes, and, uh, yes. locals()['foo'] = bar works in that it does the same thing as foo = bar. So why don't you write that instead? Mick. I wouldn't expect it to do the same thing at all, and it doesn't, at least not in Python 2.6.2. It may store the bar

Python XMLRPC question

2009-10-13 Thread prasanna
In using Python's XMLRPC, there is a statement that gets printed on stdout of the form: localhost - - [12/Oct/2009 23:36:12] POST /RPC2 HTTP/ 1.0 200 - Where does this message originate? Can I turn it off, or at least redirect it into a logging file? I am planning to run the

Re: setting variables in the local namespace

2009-10-13 Thread Peter Pearson
On Tue, 13 Oct 2009 17:05:03 +0100, Chris Withers wrote: [snip] - what is so wrong with wanting to set a variable in the local namespace based on a name stored in a variable? I'm not sure it's so wrong that one should never, ever do it, but it *does* blur the boundary between the program and

Re: Nested Menus

2009-10-13 Thread Victor Subervi
This is probably more appropriate for the MySQL list, but since this is Dennis' pseudo-code... Dennis wrote the following: cursor.execute(create table if not exists Relationship (ID integer auto_increment primary key, Parent integer not null, foreign key (Categories.ID), Child

Re: What is Islam?-1

2009-10-13 Thread Aahz
In article 39b1ba4d-be69-477d-8baa-e65465bea...@a7g2000yqo.googlegroups.com, Mensanator mensana...@aol.com wrote: There's no point in trying to reason with a Muslim. That's not funny, and if you were being serious, that was incredibly rude. -- Aahz (a...@pythoncraft.com) *

PyCon 2010 US - Call For Tutorials Ending Soon

2009-10-13 Thread Greg Lindstrom
The period to submit proposals to teach a tutorial at PyCon 2010 US ends on Sunday, October 18th. There is still time for you to get a proposal on your favorite Python topic and teach a 3-hour class (with breaks and refreshments) to your colleagues on the Wednesday or Thursday before the

Re: efficient running median

2009-10-13 Thread Daniel Stutzbach
On Tue, Oct 13, 2009 at 10:22 AM, Janto Dreijer jan...@gmail.com wrote: I'm looking for code that will calculate the running median of a sequence, efficiently. (I'm trying to subtract the running median from a signal to correct for gradual drift). In the past, I've used the following

Re: When to derive from object?

2009-10-13 Thread Terry Reedy
Paul Rudin wrote: Benjamin Kaplan benjamin.kap...@case.edu writes: It's redundant. Python 3 cleaned up a lot of the warts that appeared in Python over the years. Old-style classes (classes that didn't inherit from object) were one of them. Every class in Python 3 is derived from object whether

Re: setting variables in the local namespace

2009-10-13 Thread Mick Krippendorf
Carl Banks schrieb: Lemme guess. You tried this at the interactive prompt and concluded it worked in general, right? Yes. Thank you for enlighten me. One of these days we're going to have a thread like this where no one makes this mistake. Don't know when, but one day it will happen.

problem with running os.path.walk()

2009-10-13 Thread MalC0de
heya there, where's the problem with the following code ? I couldn't see any result while running as a script : #!/usr/bin/python import time import os def walker2(arg,dirname,filenames): cutoff = time.time() - (arg * 24 * 60 * 60) for filename in filenames :

python-apache configuration

2009-10-13 Thread Bhanu Mangipudi
Hi, I am new to python I have few questions regarding configuring apache with python. I have a hello_world.py file in /var/www/html/testing/ with permissions 755, but when I try to access http://localhost/testing/helloworl.py in mu web browser. The web browser is showing the out put in

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Stef Mientki
[snip] The key is to put all the core functionality into a package, and place the package where Python can find it. Also, it's a good idea to use relative imports from inside the package. There is no need to juggle with sys.path nor even set PYTHONPATH nor import __main__ nor play any

Re: Python XMLRPC question

2009-10-13 Thread Falcolas
On Oct 13, 12:47 pm, prasanna prasa...@ix.netcom.com wrote: In using Python's XMLRPC, there is a statement that gets printed on stdout of the form:                  localhost - - [12/Oct/2009 23:36:12] POST /RPC2 HTTP/ 1.0 200 - Where does this message originate? Can I turn it off, or at

Re: efficient running median

2009-10-13 Thread Paul Rubin
sturlamolden sturlamol...@yahoo.no writes: The obvious way to compute a running median involves a tree structure so you can quickly insert and delete elements, and find the median. That would be asymtotically O(n log n) but messy to implement. QuickSelect will find the median in O(log n)

Reply Delays

2009-10-13 Thread Ned Deily
In article 7f014ea60910130325n34156771r7f79eed588eaa...@mail.gmail.com, Chris Colbert sccolb...@gmail.com wrote: Heh, for whatever reason, your post is dated earlier than my response, but wasn't here when I sent mine. [...] It's not always obvious but this forum is multiplexed in several

Re: Python XMLRPC question

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 16:55:09 -0300, Falcolas garri...@gmail.com escribió: On Oct 13, 12:47 pm, prasanna prasa...@ix.netcom.com wrote: In using Python's XMLRPC, there is a statement that gets printed on stdout of the form:                  localhost - - [12/Oct/2009 23:36:12] POST /RPC2 HTTP/

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Stef Mientki
Stephen Hansen wrote: On Mon, Oct 12, 2009 at 4:15 PM, Stef Mientki stef.mien...@gmail.com mailto:stef.mien...@gmail.com wrote: Hierarchical choices are done on todays knowledge, tomorrow we might have different views and want/need to arrange things in another way. An otter

Re: problem with running os.path.walk()

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 16:32:07 -0300, MalC0de malc0de.encr...@gmail.com escribió: where's the problem with the following code ? I couldn't see any result while running as a script : #!/usr/bin/python import time import os def walker2(arg,dirname,filenames): cutoff = time.time() - (arg

Re: organizing your scripts, with plenty of re-use

2009-10-13 Thread Buck
On Oct 13, 9:37 am, Ethan Furman et...@stoneleaf.us wrote: Buck wrote: I'd like to get to zero-installation if possible. It's easy with simple python scripts, why not packages too? I know the technical reasons, but I haven't heard any practical reasons. I don't think we mean the same

Re: RabbitMQ vs ApacheQpid (AMQP)

2009-10-13 Thread Roger Binns
jacopo wrote: I am considering two solutions for a distributed system: either RabbitMQ with py-amqplib or ApacheQpid with its own set of API. Have you considered the multiprocessing module? http://docs.python.org/library/multiprocessing.html#using-a-remote-manager Roger --

Re: for loop: range() result has too many items

2009-10-13 Thread Andre Engels
On Tue, Oct 13, 2009 at 11:17 PM, Peng Yu pengyu...@gmail.com wrote: Hi, The following code does not run because range() does not accept a big number. Is there a way to make the code work. I'm wondering if there is a way to write a for-loop in python similar to that of C style. for(int i =

  1   2   >