Re: Seeding the rand() Generator

2009-08-03 Thread Fred Atkinson
On Mon, 3 Aug 2009 20:00:08 -0700 (PDT), Carl Banks wrote: >Your question is a MySQL question, not a Python question. I don't >know off hand how to seed the RNG in MySQL, and, since this is a >Python group and not a MySQL group, I don't care to look it up. But >if you were able to produce the M

Re: Which GUI framework to use?

2009-08-03 Thread Diez B. Roggisch
koranthala schrieb: Hi, I am creating a very minimal application (a networking app). I have written the application using Twisted. Now, I need to put a GUI wrapper on the application. The application needs a login screen and also it needs to be minimized to system tray. If I right cli

Re: Python docs disappointing - group effort to hire writers?

2009-08-03 Thread alex23
On Aug 4, 3:55 pm, David Lyon wrote: > It isn't totally about the writers... > Peoples egos are also at stake - it seems. Citation please. > If "Fred X wrote Doc Y".. they don't want their name taken off.. So > they generally speaking don't want the docs changed. Ditto. > If you talk too much

Re: Is python buffer overflow proof?

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 21:34:15 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> > The Python interpreter is written in C. Python extension modules are >> > written in C (or something similar). If you find an unprotected >> > buffer in this C code, you can possibly overflow this buffer. >> >>

Re: Python docs disappointing - group effort to hire writers?

2009-08-03 Thread David Lyon
It isn't totally about the writers... Peoples egos are also at stake - it seems. If "Fred X wrote Doc Y".. they don't want their name taken off.. So they generally speaking don't want the docs changed. If you talk too much about docs.. you can be told you're OT.. even in a thread about docs...

Re: no-clobber dicts?

2009-08-03 Thread alex23
Steven D'Aprano wrote: > I also have a series of unit tests for it if you're interested in them. That's several times today that kj has asked a question and you've responded with ready-to-go code. If this was Stackoverflow, I'd accuse you of reputation-whoring... You _can_ just post your cool co

Re: Is python buffer overflow proof?

2009-08-03 Thread John Nagle
Gabriel Genellina wrote: En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden escribió: On 2 Aug, 15:50, Jizzai wrote: Is a _pure_ python program buffer overflow proof? For example in C++ you can declare a char[9] to hold user input. If the user inputs 10+ chars a buffer overflow occurs. Sh

Re: Problem in installing PyGreSQL

2009-08-03 Thread David Lyon
On Tue, 4 Aug 2009 09:15:47 +0530, "Thangappan.M" wrote: > I want to access the database related stuffs in python.So I found the > PyGreSQL module in net. > Then I tried to download the module.But I am not able to download it. Did none of the links here work? http://www.pygresql.org/readme.html#

Re: Is python buffer overflow proof?

2009-08-03 Thread Paul Rubin
Steven D'Aprano writes: > > The Python interpreter is written in C. Python extension modules are > > written in C (or something similar). If you find an unprotected buffer > > in this C code, you can possibly overflow this buffer. > > How are C extension modules "_pure_ python"? A lot of basic

Re: Problem in installing PyGreSQL

2009-08-03 Thread Philip Semanchuk
On Aug 3, 2009, at 11:45 PM, Thangappan.M wrote: Dear all, I want to access the database related stuffs in python.So I found the PyGreSQL module in net. Then I tried to download the module.But I am not able to download it. I am not a super user. I am using Linux debian machine Python version

Re: Announcing PythonTurtle

2009-08-03 Thread John Posner
... I would also venture to say a key-map of sorts that is available thru the help menu where one could push an "Up" button, or a "rotate" button, and have the proper command inserted in the prompt, and then have the command execute, may also help make the connections here, a sort of *real* Visu

Which GUI framework to use?

2009-08-03 Thread koranthala
Hi, I am creating a very minimal application (a networking app). I have written the application using Twisted. Now, I need to put a GUI wrapper on the application. The application needs a login screen and also it needs to be minimized to system tray. If I right click the image on system

Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 8:53 pm, Asun Friere wrote: > On Aug 4, 6:35 am, r wrote: > > [snip] > > > > > I can remember the first time i used turtle (in python stdlib) and i > > kept saying to myself... > > >     "Were the heck is this damn turtle?!?!" (>_<) > > > :-) > > In Python2.6, try this: > > > > >>> turt

Re: kw param question

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 19:59:23 +, kj wrote: > I want to write a decorator that, among other things, returns a function > that has one additional keyword parameter, say foo=None. > > When I try > > def my_decorator(f): > # blah, blah > def wrapper(*p, foo=None, **kw): > x = f(*p

Problem in installing PyGreSQL

2009-08-03 Thread Thangappan.M
Dear all, I want to access the database related stuffs in python.So I found the PyGreSQL module in net. Then I tried to download the module.But I am not able to download it. I am not a super user. I am using Linux debian machine Python version is 2.4.4 -- Regards, Thangappan.M -- http://mail.p

Re: Is python buffer overflow proof?

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 14:04:53 -0700, sturlamolden wrote: > On 2 Aug, 15:50, Jizzai wrote: > >> Is a _pure_ python program buffer overflow proof? >> >> For example in C++ you can declare a char[9] to hold user input. If the >> user inputs 10+ chars a buffer overflow occurs. > > Short answer: NO >

Re: Generate a new object each time a name is imported

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 16:38:43 +0200, Jean-Michel Pichavant wrote: > So what's the purpose of making > >>from Module import factory as a >>from Module import factory as b > > return 2 different objects ? If I had to write this code I would expect > 'a is b' to return 'True'. > > This is no "don'

Re: no-clobber dicts?

2009-08-03 Thread Steven D'Aprano
On Mon, 03 Aug 2009 21:07:32 +, kj wrote: > I use the term "no-clobber dict" to refer to a dictionary D with the > especial property that if K is in D, then > > D[K] = V > > will raise an exception unless V == D[K]. In other words, D[K] can be > set if K doesn't exist already among D's ke

Re: file comparison

2009-08-03 Thread Dave Angel
learner learner wrote: Firstly thanks for showing the interest. I shall elobarate more on the problem: file-1.txt -- hai how r u file-2.txt --- r hai u The two files have some lines in common. For eg: File-1.txt-first line-"hai" does not match with File-2.txt-first li

Re: RUBY vs COMMON LISP

2009-08-03 Thread fft1976
On Aug 3, 8:02 pm, Carl Banks wrote: > On Aug 3, 7:51 pm, fft1976 wrote: > > > > > On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) > > wrote: > > > > fft1976 writes: > > > > By the way, here is in 1 line of BF, a complete BF reader that is able > > > > to > > > > read all the B

Re: RUBY vs COMMON LISP

2009-08-03 Thread Carl Banks
On Aug 3, 7:51 pm, fft1976 wrote: > On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) > wrote: > > > > > > > fft1976 writes: > > > By the way, here is in 1 line of BF, a complete BF reader that is able > > > to > > > read all the BF syntax needed to write it: > > > > ,+[-.,+] > >

Re: Seeding the rand() Generator

2009-08-03 Thread Carl Banks
On Aug 3, 8:12 pm, Fred Atkinson wrote: > On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks > > wrote: > >         I appreciate the response.   > >         I am executing a statement to retrieve one record at random.   > >         An example would be: SELECT first, second, third, fourth, > fift

Re: Newbie Question regarding __init__()

2009-08-03 Thread Dave Angel
Simon wrote: On Aug 2, 5:51 am, Dave Angel wrote: I don't understand your comparison to Foxpro. read on. As your code was last posted, you don't need a return value from init_Exec() Every function that doesn't have an explicit return will return None. And None is interpreted as False in

Re: RUBY vs COMMON LISP

2009-08-03 Thread fft1976
On Aug 3, 1:19 am, p...@informatimago.com (Pascal J. Bourguignon) wrote: > fft1976 writes: > > By the way, here is in 1 line of BF, a complete BF reader that is able > > to > > read all the BF syntax needed to write it: > > > ,+[-.,+] > > > Here's how to try it: > > > $ sudo apt-get install bf > >

[OT] Re: Ordering of dict keys & values

2009-08-03 Thread Benjamin Kaplan
On Mon, Aug 3, 2009 at 9:18 PM, Gabriel Genellina wrote: > > [1] If you don't know what "SQL injection" means, see http://xkcd.com/327/ I love how XKCD is one of the preferred learning tools (along with Wikipeida) for people on this list. I think Randall Munroe should make a comic about it. :) --

Re: Seeding the rand() Generator

2009-08-03 Thread Fred Atkinson
On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks wrote: I appreciate the response. I am executing a statement to retrieve one record at random. An example would be: SELECT first, second, third, fourth, fifth, sixth from sometable order by rand() limit 1 I

Re: Announcing PythonTurtle

2009-08-03 Thread Asun Friere
On Aug 4, 6:35 am, r wrote: [snip] > > I can remember the first time i used turtle (in python stdlib) and i > kept saying to myself... > >     "Were the heck is this damn turtle?!?!" (>_<) > > :-) In Python2.6, try this: >>> turtle.shape('turtle') -- http://mail.python.org/mailman/listinfo/py

Re: merge two png pic

2009-08-03 Thread cocobear
On Jul 31, 2:52 pm, Peter Otten <__pete...@web.de> wrote: > cocobear wrote: > > On Jul 29, 9:20 am, cocobear wrote: > >> Thistwopngfile has their own palette > > >> >>> im1.mode > >> 'P' > >> >>> im.mode > >> 'P' > >> >>> im.getpalette == im1.getpalette > > >> False > > >> I can use this code tome

Re: Is python buffer overflow proof?

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 18:04:53 -0300, sturlamolden escribió: On 2 Aug, 15:50, Jizzai wrote: Is a _pure_ python program buffer overflow proof? For example in C++ you can declare a char[9] to hold user input. If the user inputs 10+ chars a buffer overflow occurs. Short answer: NO Bounds ch

Re: Ordering of dict keys & values

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:47:23 -0300, Wells Oliver escribió: I understand that the keys in a dictionary are ordered not randomly but something practically close to it, but if I create a SQL query like so: query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), ','.join(stats.v

Re: easy_install: unresolved external symbol

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 17:39:44 -0300, Bart Smeets escribió: I keep getting errors when trying to use easy_install to install bbfreeze or cxfreeze (same errors). This is the output: http://pastebin.com/m65ba474d Can't you use the binary packages? -- Gabriel Genellina -- http://mail.python.

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-03 Thread Gabriel Genellina
En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife escribió: I have installed python 2.6.2 in windows xp professional machine. I have set the following environment variables -- PYTHONPATH. It points to following windows folders: python root folder, the lib folder and lib-tk folder. Why? Did yo

Extracting text from html

2009-08-03 Thread VanL
Hello all, Does anyone know of a good tool to get a minimally-formatted text document out of an html document? Something along the lines of what you would get with a lynx -dump, but in Python. I have lxml installed, so I can roll my own if I need to. However, this seemed like the sort of thi

Re: Announcing PythonTurtle

2009-08-03 Thread Mensanator
On Aug 3, 8:18 am, cool-RR wrote: > Hello, > > I wanted to announce that I have just released my little side project, > PythonTurtle. > Here is its website:http://pythonturtle.com > > Its goal is to be the lowest-threshold way to learn (or teach) Python. > You can read more about it and download i

Re: Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread MRAB
KB wrote: On Aug 3, 3:54 pm, KB wrote: Hi, I am trying to download from a URL, a CSV using the following: import re import urllib, urllib2, cookielib import mechanize import csv import numpy import os def return_ranking(): cj = mechanize.MSIECookieJar(delayload=True) cj.load

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 5:00 pm, Chris Rebert wrote: > On Mon, Aug 3, 2009 at 2:47 PM, r wrote: [snip] > > Not sure if something like this already exists, but it would be > > trivial to implement by overriding dict.__setitem__() > > That is, if you don't care about .update() not preserving the > invariant. Othe

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread greg
John Nagle wrote: Mesa used tuples for subroutine arguments in a very straightforward way. Every function took one tuple as an argument Python doesn't go that far. I believe that a very early version of Python did do something like that, but it was found to be a bad idea, because there was

Re: Executing remote command with paramiko

2009-08-03 Thread Piet van Oostrum
> Hussein B (HB) wrote: >HB> Hey, >HB> I'm trying to run a sudo guarded command over SSH using paramiko >HB> +++ >HB> s = paramiko.SSHClient() >HB> s.load_system_host_keys() >HB> s.connect(hostname, port, username, passwd) >HB> stdin, stdout, stderr = s.exec_command('sudo -s')

Re: Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread KB
On Aug 3, 3:54 pm, KB wrote: > Hi, > > I am trying to download from a URL, a CSV using the following: > > import re > import urllib, urllib2, cookielib > import mechanize > import csv > import numpy > import os > > def return_ranking(): > >         cj = mechanize.MSIECookieJar(delayload=True) >  

Problem with reading CSV file from URL, last record truncated.

2009-08-03 Thread KB
Hi, I am trying to download from a URL, a CSV using the following: import re import urllib, urllib2, cookielib import mechanize import csv import numpy import os def return_ranking(): cj = mechanize.MSIECookieJar(delayload=True) cj.load_from_registry() # finds cookie index fil

Re: Obtaining Python version

2009-08-03 Thread Jan Kaliszewski
04-08-2009 o 00:19:22 John Nagle wrote: This works, but it seems too cute: >>> pyver = map(int,sys.version.split()[0].split('.')) >>> print(pyver) [2, 6, 1] Is it guaranteed that the Python version string will be in a form suitable for that? In other words, does "sys.version" begin N.N.N

Re: Announcing PythonTurtle

2009-08-03 Thread r
On Aug 3, 5:03 pm, cool-RR wrote: [snip] > Thanks for the compliments; The things you mentioned you liked are all > things that I was specifically thinking about when I decided to make > PythonTurtle. Well, maybe minus the screenshot :) I *may* get roasted for this comment, but i think a turtle m

Re: Obtaining Python version

2009-08-03 Thread André
On Aug 3, 7:19 pm, John Nagle wrote: > This works, but it seems too cute: > >  >>> pyver = map(int,sys.version.split()[0].split('.')) >  >>> print(pyver) > [2, 6, 1] > You can also do: >>> import sys >>> sys.version_info (2, 5, 2, 'final', 0) or >>> sys.version_info[:3] (2, 5, 2) > Is it guara

Re: fast video encoding

2009-08-03 Thread Rhodri James
On Sun, 02 Aug 2009 03:44:17 +0100, sturlamolden wrote: On 29 Jul, 10:14, gregorth wrote: for a scientific application I need to save a video stream to disc for further post processing. I have worked a bit on this as well. There are two things that make scientific applications different

Obtaining Python version

2009-08-03 Thread John Nagle
This works, but it seems too cute: >>> pyver = map(int,sys.version.split()[0].split('.')) >>> print(pyver) [2, 6, 1] Is it guaranteed that the Python version string will be in a form suitable for that? In other words, does "sys.version" begin N.N.N other stuff in all versions, and will it sta

Re: socket policy flash help

2009-08-03 Thread NighterNet
On Aug 2, 12:25 pm, Piet van Oostrum wrote: > > NighterNet (N) wrote: > >N> Here the full code. > >N> flashpolicy.xml > >N> [[[ > >N> > >N> > >N>     > >N> > >N> ]]] > >N> flashpolicytest_server3x.py > >N> [[[ > >N> #!/usr/local/bin/python > >N> ''' > >N> Still under testing... > >N> pytho

Re: RE Question

2009-08-03 Thread Victor Subervi
That worked. Thank you again :) Victor On Mon, Aug 3, 2009 at 12:13 AM, Gabriel Genellina wrote: > En Sun, 02 Aug 2009 18:22:20 -0300, Victor Subervi < > victorsube...@gmail.com> escribió: > > > How do I search and replace something like this: >> aLine = re.sub('[<]?[p]?[>]?> a-zA-Z0-9"\'=:]*>[<

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 11:35 pm, r wrote: > Hello, > I wanted to announce that I have just released my little side > project, > PythonTurtle. > [snip] > > I think it looks great --haven't download the source yet-- but i > really like the screenshot. This will be more "inviting" to the new, > inexperianced user

Re: Registation is open for the 9th PyWeek game programming challenge!

2009-08-03 Thread Greg Ewing
Richard Jones wrote: The ninth PyWeek challenge will run between: Sunday 30th August to Sunday 6th September (00:00UTC to 00:00UTC) Yow, hard on the heels of Pyggy! I'd hoped there might be a bit more breathing room, sorry about that! Hope the Pyggy entrants aren't feeling too burned out to

Re: no-clobber dicts?

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 2:47 PM, r wrote: > On Aug 3, 4:07 pm, kj wrote: >> I use the term "no-clobber dict" to refer to a dictionary D with >> the especial property that if K is in D, then >> >>   D[K] = V >> >> will raise an exception unless V == D[K].  In other words, D[K] >> can be set if K doe

Re: no-clobber dicts?

2009-08-03 Thread r
On Aug 3, 4:07 pm, kj wrote: > I use the term "no-clobber dict" to refer to a dictionary D with > the especial property that if K is in D, then > >   D[K] = V > > will raise an exception unless V == D[K].  In other words, D[K] > can be set if K doesn't exist already among D's keys, or if the > ass

Trying to get ABC to work

2009-08-03 Thread Boris Arloff
Hi,   Looking for ideas on getting Abstract Base Classes to work as intended within a metaclass.   I was wondering if I could use an abc method within a metaclass to force a reimplementation when a class is instantiated from the metaclass.  It seems like I cannot do so.  I implemented the follow

WindowsError: exception: access violation writing 0x00000000

2009-08-03 Thread Sparky
Hello! I am using cTypes on Windows to interface with a dll and I keep getting an error when I execute this method: def eDigitalIn(self, channel, idNum = None, demo = 0, readD=0): """ Name: U12.eAnalogIn(channel, idNum = None, demo = 0, readD=0) Args: See section 4.4 of the

Re: Ordering of dict keys & values

2009-08-03 Thread Chris Rebert
On Mon, Aug 3, 2009 at 1:47 PM, Wells Oliver wrote: > I understand that the keys in a dictionary are ordered not randomly but > something practically close to it, but if I create a SQL query like so: > > query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), > ','.join(stats.value

no-clobber dicts?

2009-08-03 Thread kj
I use the term "no-clobber dict" to refer to a dictionary D with the especial property that if K is in D, then D[K] = V will raise an exception unless V == D[K]. In other words, D[K] can be set if K doesn't exist already among D's keys, or if the assigned value is equal to the current valu

Re: Is python buffer overflow proof?

2009-08-03 Thread sturlamolden
On 2 Aug, 15:50, Jizzai wrote: > Is a _pure_ python program buffer overflow proof? > > For example in C++ you can declare a char[9] to hold user input. > If the user inputs 10+ chars a buffer overflow occurs. Short answer: NO Bounds checking on sequence types is a protection against buffer over

Re: iterate lines with regex

2009-08-03 Thread Carl Banks
On Aug 3, 11:44 am, Robert Kern wrote: > On 2009-08-03 12:29, MRAB wrote: > > > > > > > Robert Kern wrote: > > [snip] > > >> for line in readThis: > >> key_match = key.search(line) > >> if key_match is not None: > >> this_key = key_match.group(1) > >> # ... do something with this_key > >> map_matc

Re: kw param question

2009-08-03 Thread kj
In Albert Hopkins writes: >On Mon, 2009-08-03 at 19:59 +, kj wrote: >> >> I want to write a decorator that, among other things, returns a >> function that has one additional keyword parameter, say foo=None. >> >> When I try >> >> def my_decorator(f): >> # blah, blah >> def wrappe

Re: Newbie Question regarding __init__()

2009-08-03 Thread Simon
On Aug 2, 5:51 am, Dave Angel wrote: > Simon wrote: > > Okay I will fix my code and include "self" and see what happens.  I > > know I tried that before and got another error which I suspect was > > another newbie error. > > > The idea behind the init_Pre is that I can put custom code here to > >

Ordering of dict keys & values

2009-08-03 Thread Wells Oliver
I understand that the keys in a dictionary are ordered not randomly but something practically close to it, but if I create a SQL query like so: query = 'INSERT INTO Batting (%s) VALUES(%s)' % (','.join(stats.keys()), ','.join(stats.values())) Can I at least rely on the value being in the same ind

easy_install: unresolved external symbol

2009-08-03 Thread Bart Smeets
Hello, I keep getting errors when trying to use easy_install to install bbfreeze or cxfreeze (same errors). This is the output: http://pastebin.com/m65ba474d The error message unresolved external symbol keeps popping up. I have no idea how to solve this. Can anyone give me a hint? Thanks in adv

Re: Announcing PythonTurtle

2009-08-03 Thread r
Hello, I wanted to announce that I have just released my little side project, PythonTurtle. [snip] I think it looks great --haven't download the source yet-- but i really like the screenshot. This will be more "inviting" to the new, inexperianced users. I like the idea of packaging up the command

Re: kw param question

2009-08-03 Thread Albert Hopkins
On Mon, 2009-08-03 at 19:59 +, kj wrote: > > I want to write a decorator that, among other things, returns a > function that has one additional keyword parameter, say foo=None. > > When I try > > def my_decorator(f): > # blah, blah > def wrapper(*p, foo=None, **kw): > x = f(*

Re: M2Crypto: X509.X509_Extension_Stack() throws AssertionError

2009-08-03 Thread Heikki Toivonen
Matthias Güntert wrote: > Why is the following code snippet throwing an AssertionError? Is that > behavior a bug within X509.X509_Extension_Stack()? How would you suggest > popping every element from the stack? > > cert_extension_2 = X509.new_extension("keyUsage", "10100") Maybe your

kw param question

2009-08-03 Thread kj
I want to write a decorator that, among other things, returns a function that has one additional keyword parameter, say foo=None. When I try def my_decorator(f): # blah, blah def wrapper(*p, foo=None, **kw): x = f(*p, **kw) if (foo): # blah, blah else

Re: .dbf tables and Null

2009-08-03 Thread Ethan Furman
John Machin wrote: On Aug 1, 3:41 am, Ethan Furman wrote: Mornin'! and a good one, too, I hope. Question for you... First part of the question: What is the general value in having Null capability for fields? In general, in any database system, so that one can distinguish between "the cu

Online payment module

2009-08-03 Thread Sam Tregar
Hello all. I'm considering building a module to provide a cross-payment-gatewat API for making online payments. In the Perl world we have a module like this called Business::OnlinePayment ( http://search.cpan.org/~jasonk/Business-OnlinePayment-2.01/OnlinePayment.pm). Is there anything like this

"MAGZINES IN URDU" "PAKISTANI MAGZINES" PAKISTAN" "PAKISTAN" "PAKISTANI NEWSPAPERS" "tHE eXPRTESS" "JANG NEWS" "WAQT" "DAWN" ON www.pak-web-pages.blogspot.com

2009-08-03 Thread saima81
"MAGZINES IN URDU" "PAKISTANI MAGZINES" PAKISTAN" "PAKISTAN" "PAKISTANI NEWSPAPERS" "tHE eXPRTESS" "JANG NEWS" "WAQT" "DAWN" ON www.pak-web-pages.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Can python do something like the onclick events in javascript ?

2009-08-03 Thread Benjamin Kaplan
On Mon, Aug 3, 2009 at 2:39 PM, Leo Brugud wrote: > I'm trying to use python to build a simple web page that make use of > the onclick behavior, instead of requiring users > to click the 'submit' button. > > I realize in javascript there are onclick, onchange events. Is python > capable of doing t

Re: Can python do something like the onclick events in javascript ?

2009-08-03 Thread Diez B. Roggisch
Leo Brugud schrieb: I'm trying to use python to build a simple web page that make use of the onclick behavior, instead of requiring users to click the 'submit' button. If that's the only reason, don't use JS for that, it's annoying. I realize in javascript there are onclick, onchange events.

Re: iterate lines with regex

2009-08-03 Thread Robert Kern
On 2009-08-03 12:29, MRAB wrote: Robert Kern wrote: [snip] for line in readThis: key_match = key.search(line) if key_match is not None: this_key = key_match.group(1) # ... do something with this_key map_match = map.search(line) if map_match is not None: this_map = map_match.group(1) # ... do so

Can python do something like the onclick events in javascript ?

2009-08-03 Thread Leo Brugud
I'm trying to use python to build a simple web page that make use of the onclick behavior, instead of requiring users to click the 'submit' button. I realize in javascript there are onclick, onchange events. Is python capable of doing the same? Thanks in Advance -- http://mail.python.org/mailman

Re: urllib2.urlopen timeout

2009-08-03 Thread Ben Charrow
Zdenek Maxa wrote: > Hi, > > I would like to ask how I should set timeout for a call: > > f = urllib2.urlopen(url) > > > I know that Python 2.6 offers > urllib2.urlopen(url[, data][, timeout]) > which would elegantly solved my problem, but I have to stick to Python 2.5. > There are three sol

Re: Compiling regex inside function?

2009-08-03 Thread Duncan Booth
alex23 wrote: > The docs say: > The compiled versions of the most recent patterns passed to re.match > (), re.search() or re.compile() are cached, so programs that use only > a few regular expressions at a time needn’t worry about compiling > regular expressions. > > (But they don't say how few

Re: heapq "key" arguments

2009-08-03 Thread Raymond Hettinger
[Joshua Bronson]: > According tohttp://docs.python.org/library/heapq.html, Python 2.5 > added an optional "key" argument to heapq.nsmallest and > heapq.nlargest. I could never understand why they didn't also add a > "key" argument to the other relevant functions (heapify, heappush, > etc). The pro

Re: Run pyc file without specifying python path ?

2009-08-03 Thread Dave Angel
Barak, Ron wrote: -Original Message- From: Dave Angel [mailto:da...@ieee.org] Sent: Sunday, August 02, 2009 12:36 To: Barak, Ron Cc: 'python-list@python.org' Subject: Re: Run pyc file without specifying python path ? Barak, Ron wrote: Hi Dave, It seems like I don't understand y

Re: iterate lines with regex

2009-08-03 Thread MRAB
Robert Kern wrote: [snip] for line in readThis: key_match = key.search(line) if key_match is not None: this_key = key_match.group(1) # ... do something with this_key map_match = map.search(line) if map_match is not None: this_map = map_match.group(1)

Re: Queryable Daemon

2009-08-03 Thread Nobody
On Sun, 02 Aug 2009 19:36:08 -0600, Michael Torrie wrote: > Another possibility is shared memory segments. I'm not sure how > security is done in this case. Shared memory segments have an owner, group, and the standard ugo=rwx permissions (execute permission is present but ignored); see the shmg

Re: RE Question

2009-08-03 Thread Gabriel Genellina
En Sun, 02 Aug 2009 18:22:20 -0300, Victor Subervi escribió: How do I search and replace something like this: aLine = re.sub('[<]?[p]?[>]?[<]?[b]?[>]?', '', aLine) where RE *only* looks for the possibility of "" at the beginning of the string; that is, not the individual components as I hav

Re: iterate lines with regex

2009-08-03 Thread Robert Kern
On 2009-08-01 14:39, Michael Savarese wrote: I'm a python newbie and I'm trying to test several regular expressions on the same line before moving on to next line. it seems to move on to next line before trying all regular expressions which is my goal. it only returns true for first regular expr

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread alex23
John Nagle wrote: > Every function returned a tuple as an argument. This had a nice > symmetry; function outputs and function inputs had the same form.   > Mesa was the first language to break through the "single return > value" syntax problem. > >     Python doesn't go that far. I assume here y

Re: Compiling regex inside function?

2009-08-03 Thread alex23
Anthra Norell wrote: > def entries (l): >         r = re.compile ('([0-9]+) entr(y|ies)') >         match = r.search (l) >         if match: return match.group (1) > > So the question is: does "r" get regex-compiled once at py-compile time > or repeatedly at entries() run time? The docs say: The

Re: heapq "key" arguments

2009-08-03 Thread Raymond Hettinger
[Duncan Booth] > The documentation doesn't say anything directly about stability, but the > implementation is actually stable. You can probably assume it must be at > least for nlargest and nsmallest otherwise the stated equivalence wouldn't > hold: > > e.g. nsmallest documentation says: > >      

Re: Help understanding the decisions *behind* python?

2009-08-03 Thread John Nagle
Dave Angel wrote: sturlamolden wrote: On 20 Jul, 18:27, Phillip B Oldham wrote: Tuples are used for passing arguments to and from a function. Common use of tuples include multiple return values and optional arguments (*args). That's from Mesa, the Xerox PARC language of the 1970s. Mesa

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Sandhya Prabhakaran
Oh yes indeed! Now that works :D Thanks a lot !! 2009/8/3 Kushal Kumaran > > On Mon, Aug 3, 2009 at 8:47 PM, Sandhya > Prabhakaran wrote: > > Hi, > > > > I have a string as str='123ACTGAAC'. > > > > I need to extract the numeric part from the alphabetic part which I > > did using >

Re: Announcing PythonTurtle

2009-08-03 Thread cool-RR
On Aug 3, 7:04 pm, "Colin J. Williams" wrote: > cool-RR wrote: > > Hello, > > > I wanted to announce that I have just released my little side project, > > PythonTurtle. > > Here is its website: > >http://pythonturtle.com > > > Its goal is to be the lowest-threshold way to learn (or teach) Python.

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread alex23
Sandhya Prabhakaran wrote: > I have a string as str='123ACTGAAC'. You shouldn't use 'str' as a label like that, it prevents you from using the str() function in the same body of code. > How do I blank out the initial numeric part so as to get just the > alphabetic part. The string is always in t

urllib2.urlopen timeout

2009-08-03 Thread Zdenek Maxa
Hi, I would like to ask how I should set timeout for a call: f = urllib2.urlopen(url) I am using Python 2.5. I have already tried socket.setdefaulttimeout(3). However, this adversely affects other connections the application makes, since it seems to affect all socket connections. I know that Py

Re: Python docs disappointing

2009-08-03 Thread Ethan Furman
Carl Banks wrote: On Jul 31, 1:55 pm, Mark Lawrence wrote: Apart from that what have the Pythonistas ever done for us? Nothing!:) Please don't feed the trolls. And if you do feed the trolls don't smile at them. Carl Banks And if you do smile at them, don't show your teeth! ~Ethan~ --

ANNOUNCE: AwstatsReader 0.01

2009-08-03 Thread Joshua J. Kugler
ABOUT THE MODULE AwstatsReader is an attempt at a pythonic interface to AWStats data cache files.  Using it, you can access year, month, and individual data points via dictionary-like accessors. Download here: http://azariah.com/open_source.html ABOUT THE AUTHOR

Re: Announcing PythonTurtle

2009-08-03 Thread Colin J. Williams
cool-RR wrote: Hello, I wanted to announce that I have just released my little side project, PythonTurtle. Here is its website: http://pythonturtle.com Its goal is to be the lowest-threshold way to learn (or teach) Python. You can read more about it and download it on the website. Ram. It lo

Re: Compiling regex inside function?

2009-08-03 Thread Diez B. Roggisch
Anthra Norell wrote: > Hi all, > >I have a regex that has no use outside of a particular function. From > an encapsulation point of view it should be scoped as restrictively as > possible. Defining it inside the function certainly works, but if > re.compile () is run every time the function i

Re: New implementation of re module

2009-08-03 Thread MRAB
John Machin wrote: On Jul 28, 2:34 am, MRAB wrote: Hi all, I've been working on a new implementation of the re module. The details are athttp://bugs.python.org/issue2636, specifically fromhttp://bugs.python.org/issue2636#msg90954. I've included a .pyd file for Python 2.6 on Windows if you wan

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread Kushal Kumaran
On Mon, Aug 3, 2009 at 8:47 PM, Sandhya Prabhakaran wrote: > Hi, > > I have a string as str='123ACTGAAC'. > > I need to extract the numeric part from the alphabetic part which I > did using numer=re.findall(r'\d+',str) numer > 123 > The docs for re.findall say that it returns a list of mat

Re: Queryable Daemon

2009-08-03 Thread Michael Torrie
Justin DeCell wrote: > I was hoping for a little help with a project I'm working on. I'm > writing a daemon in python that I want to be queryable (i.e. I should > be able to run foo -s and it will report some internal information > about the foo daemon if it's running) but I can't figure out

Re: Generate a new object each time a name is imported

2009-08-03 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: I would like to generate a new object each time I import a name from a module, rather than getting the same object each time. For example, currently I might do something like this: # Module count = 0 def factory(): # Generate a unique object each time this is called

M2Crypto: X509.X509_Extension_Stack() throws AssertionError

2009-08-03 Thread Matthias Güntert
Hello python-list members Why is the following code snippet throwing an AssertionError? Is that behavior a bug within X509.X509_Extension_Stack()? How would you suggest popping every element from the stack? Regards, Matthias Güntert - from M2Crypt

Re: Extract the numeric and alphabetic part from an alphanumeric string

2009-08-03 Thread MRAB
Sandhya Prabhakaran wrote: Hi, I have a string as str='123ACTGAAC'. I need to extract the numeric part from the alphabetic part which I did using numer=re.findall(r'\d+',str) numer 123 [snip] I get: ['123'] which is a _list_ of the strings found. -- http://mail.python.org/mailman/listinf

Compiling regex inside function?

2009-08-03 Thread Anthra Norell
Hi all, I have a regex that has no use outside of a particular function. From an encapsulation point of view it should be scoped as restrictively as possible. Defining it inside the function certainly works, but if re.compile () is run every time the function is called, it isn't such a good

Re: Printing with colors in a portable way

2009-08-03 Thread Jean-Michel Pichavant
Nobody wrote: On Thu, 30 Jul 2009 15:40:37 -0700, Robert Dailey wrote: Anyone know of a way to print text in Python 3.1 with colors in a portable way? In other words, I should be able to do something like this: print_color( "This is my text", COLOR_BLUE ) And this should be portable (i.e.

  1   2   >