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 <:>[0] <:> [0, 4] <=> <42> [0, 4,

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

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 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 ImageQt, I >

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 dogmat

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 # -*- codi

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: Grant badge: My Code: opener = urllib.request.build_opener() cj = http.cookiejar.MozillaCookieJar() cj.load('C:/Users/Al

Re: It Doesn't Add Up!

2009-10-13 Thread Stephen Hansen
On Mon, Oct 12, 2009 at 11:33 AM, Victor Subervi wrote: > 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;' % (client, str(i)) >

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 descripto

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 : > I have been looking for pexpect. The links I find like > http://pexpect.sou

Re: An assessment of Tkinter and IDLE

2009-10-13 Thread Ben Finney
TerryP 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 wrote: >> my_prissy_little_indicator_variable = true >> while (my_prissy_little_indicator_variable){ >> >> } >> isn't satisfying because it doesn't guard the with any >> assurance that the loop invariant will be true before you enter into >> that block of co

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 (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> >S> >S> >S> S> value='92dcd92a8bc16f73f330d118ae1ed891' /> >S> >S> Grant bad

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 (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 lo

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 wou

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 l

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 manage

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', '/dump/IMG

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 wrote: > Chris Colbert wrote: >> Say I use python to talk to a wireless webcamera that delivers images >> via http request

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 using

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 wrote: > Chris Colbert wrote: >> >> Say I use python to talk to a wireless webcamera that delivers images >> via http requests. >> >

Re: reifying indent and dedent into braces

2009-10-13 Thread rustom
On Oct 13, 12:45 pm, Steven D'Aprano 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 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 cut? > > also pleas

Re: postprocessing in os.walk

2009-10-13 Thread kj
In Dave Angel 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 leaving >> the currently processed directory." The docum

"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 Dave Angel > 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 leaving >>> the currently processed d

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 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 having trouble un

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 -- http://mail.python.org/mailman/listinfo/python-list

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

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 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 value of it on

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 # fo

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

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 wrote: > Hi; > I have the following code: > > if 13 < x < 20: > y += 1 > w += 1 > try: > getpic = "getpic" + str(w

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 objec

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

Re: When to derive from object?

2009-10-13 Thread Matimus
On Oct 13, 7:45 am, Igor Mikushkin 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 new style classe

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 (usi

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 r

Re: The rap against "while True:" loops

2009-10-13 Thread Mensanator
On Oct 13, 3:44�am, John Reid 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 its crutch-iness

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 wrote: > On Oct 13, 7:45 am, Igor Mikushkin 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 ... erm... t

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

2009-10-13 Thread Aahz
In article , ryniek90 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 implementation of scanf() ? How long have you been using Python? lambda has bee

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 l

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 escribió: On Mon, 12 Oct 2009 16:36:58 -0700, Ethan Furman 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 package to somewhere else, and you don't

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

2009-10-13 Thread Buck
On Oct 12, 4:30 pm, Carl Banks wrote: > On Oct 12, 11:24 am, Buck wrote: > > > On Oct 10, 9:44 am, "Gabriel Genellina" > > wrote: > > > > The good thing is that, if the backend package is properly installed   > > > somewhere in the Python path ... it still works with no modifications. > > > I'd

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

2009-10-13 Thread Buck
On Oct 12, 3:34 pm, "Gabriel Genellina" wrote: > En Mon, 12 Oct 2009 15:24:34 -0300, Buck escribió: > > > On Oct 10, 9:44 am, "Gabriel Genellina" > > wrote: > >> The good thing is that, if the backend package is properly installed   > >> somewhere in the Python path ... it still works with no mo

Re: postprocessing in os.walk

2009-10-13 Thread Dave Angel
Peter Otten wrote: kj wrote: In Dave Angel 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 leaving the curren

Re: setting variables in the local namespace

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

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 workaro

Re: speed up linecache.getline()

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 10:21:31 -0300, 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... thank you very much for y

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 Dave Angel 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 the summary logic immediately after. I think you're missing the p

Re: setting variables in the local namespace

2009-10-13 Thread Duncan Booth
Chris Withers 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 the extra function

Re: The rap against "while True:" loops

2009-10-13 Thread Ethan Furman
Mensanator wrote: On Oct 13, 3:44�am, John Reid 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. If I need more than one loop

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 wi

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 wrote: > Igor Mikushkin a écrit : > > > Hello all! > > > I'm a newbie to Python. > > Welcome onboard > > > Could yo

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 wi

Re: When to derive from object?

2009-10-13 Thread Benjamin Kaplan
On Tue, Oct 13, 2009 at 1:34 PM, Anson Mackeracher 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 Python over the ye

Re: setting variables in the local namespace

2009-10-13 Thread Carl Banks
On Oct 13, 9:05 am, Chris Withers 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 >          else: >        

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() diction

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

2009-10-13 Thread ryniek90
In article , ryniek90 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 implementation of scanf() ? How long have you been using Python? lambd

Re: setting variables in the local namespace

2009-10-13 Thread Carl Banks
On Oct 13, 9:39 am, Mick Krippendorf 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 though when

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 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 or not. ... it coul

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 escribió: On Oct 12, 3:34 pm, "Gabriel Genellina" wrote: Quoting Steven D'Aprano   (changing names slightly): """You would benefit greatly from separating the interface from the backend. You should arrange matters so that the users see something like t

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 pi

Re: efficient running median

2009-10-13 Thread Dale Dalrymple
On Oct 13, 8:22 am, 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). > ... > Any suggestions? For a reference try: Comparison of algorithms

Re: setting variables in the local namespace

2009-10-13 Thread Dave Angel
Mick Krippendorf 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? 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" som

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 ser

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 an

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), Chi

Re: What is Islam?-1

2009-10-13 Thread Aahz
In article <39b1ba4d-be69-477d-8baa-e65465bea...@a7g2000yqo.googlegroups.com>, Mensanator 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) <*> http://www.pyth

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 conferenc

Re: efficient running median

2009-10-13 Thread Daniel Stutzbach
On Tue, Oct 13, 2009 at 10:22 AM, 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). > In the past, I've used the following algorithm which appr

Re: When to derive from object?

2009-10-13 Thread Terry Reedy
Paul Rudin wrote: Benjamin Kaplan 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 or not.

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

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

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 stra

Re: Python XMLRPC question

2009-10-13 Thread Falcolas
On Oct 13, 12:47 pm, prasanna 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 least > redirect i

Re: efficient running median

2009-10-13 Thread Paul Rubin
sturlamolden 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) time. That ma

Reply Delays

2009-10-13 Thread Ned Deily
In article <7f014ea60910130325n34156771r7f79eed588eaa...@mail.gmail.com>, Chris Colbert 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 places. It's av

Re: Python XMLRPC question

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 16:55:09 -0300, Falcolas escribió: On Oct 13, 12:47 pm, prasanna 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 origi

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 > 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 may become a reptile ;

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

2009-10-13 Thread Gabriel Genellina
En Tue, 13 Oct 2009 16:32:07 -0300, MalC0de 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 * 24 * 60 * 60) f

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

2009-10-13 Thread Buck
On Oct 13, 9:37 am, Ethan Furman 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 thing by "zero

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

Re: setting variables in the local namespace

2009-10-13 Thread Carl Banks
On Oct 13, 12:23 pm, Mick Krippendorf wrote: > 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 > > m

MUD Game Programmming - Python Modules in C++

2009-10-13 Thread Christopher Lloyd
Hello all, I'm new to Python and new to this list, although I've done some digging in the archives and already read up on the problem I'm about to describe. I'm a relatively inexperienced programmer, and have been learning some basic C++ and working through the demos in Ron Penton's "MUD Game P

  1   2   >