Re: implementing descriptors

2009-08-13 Thread Raymond Hettinger
[David] > I am new to Python and I have a question about descriptors.  If I have > a class as written below, is there a way to use descriptors to be > certain that the datetime in start is always before the one in end? > > class foo(object): >    def __init__(self,a = None,b = None) >       self.st

Re: trouble with reload

2009-08-13 Thread Carl Banks
On Aug 13, 10:36 pm, "Dr. Phillip M. Feldman" wrote: > Actually, I've tried both of these, and I get (different) errors in both > cases: > > In [1]: from mymath import * > > In [2]: reload(mymath) > NameError: name 'mymath' is not defined > > In [3]: reload('mymath') > TypeError: reload() argument

OptionParser How to: prog [options] [arguments]

2009-08-13 Thread Steven Woody
Hi, I am using OptionParser, but I've not managed figure out a way to support what I wanted command line format "prog [options] [arguments]". E.g., "svn ls -r123 http://hello.world";. Can I do this using OptionParser? Thanks. -- Life is the only flaw in an otherwise perfect nonexistence --

Re: coding for multiple versions of python

2009-08-13 Thread Martin v. Löwis
> I'm guessing I need to configure cvs to copy files to both locations > whenever I commit. Does that sound right? Is there a better way I'm not > thinking of? If the set of files doesn't change too often, you can use symlinks. That's how Debian currently installs Python packages for multiple ve

Re: trouble with reload

2009-08-13 Thread Dr. Phillip M. Feldman
Actually, I've tried both of these, and I get (different) errors in both cases: In [1]: from mymath import * In [2]: reload(mymath) NameError: name 'mymath' is not defined In [3]: reload('mymath') TypeError: reload() argument must be module Rami Chowdhury wrote: > > Could you please clarify

Re: i Don't get why it makes trouble

2009-08-13 Thread Scott David Daniels
azrael wrote: ... A lot of people a not aware of SQL injection. My friend from college asked me and a couple of other guys for Pen testing of an website. His SQL injection mistake made him an epic fail. And some people are unaware of the unofficial official Python citation for SQL injection exp

Re: Format Code Repeat Counts?

2009-08-13 Thread Scott David Daniels
MRAB wrote: The shortest I can come up with is: "[" + "][".join(letters) + "]" Maybe a golf shot: "][".join(letters).join("[]") --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Re: i Don't get why it makes trouble

2009-08-13 Thread Stephen Hansen
> > Currently I am working on just a prototype to show what is possible to > be done to get me some fundings for my future work. after that I will > get over to an SQL Alchemy. It's ORM will take over this business for > me. > > A lot of people a not aware of SQL injection. My friend from college >

Re: PIL and Python

2009-08-13 Thread Nobody
On Thu, 13 Aug 2009 16:38:07 -0700, Martin wrote: >> I want use python to change the "note" from .jpeg files . >> What is the functions on PIL how make this ? > > What do u mean by the note? I think he means the EXIF data. -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble with reload

2009-08-13 Thread Terry Reedy
Dr. Phillip M. Feldman wrote: According to the Python documentation, 'reload' reloads a previously imported module (so that changes made via an external editor will be effective). But, when I try to use this command, I get the following error message: TypeError: reload() argument must be modul

Re: i Don't get why it makes trouble

2009-08-13 Thread Terry Reedy
azrael wrote: Thanks Worked fine for me. I was a freakin idiot. I forgot about using a tuple. damn lists :D The special casing of tuples versus other sequence objects with % formatting, and the forgetting and mistake making of multiple people is one of the reasons for the new .format system.

Re: coding for multiple versions of python

2009-08-13 Thread Chris Rebert
On Thu, Aug 13, 2009 at 12:57 PM, Tim Arnold wrote: > Hi, > I've got a python based system that has to run on hp unix and red hat linux. > The Python version on the HP is 2.4 and the version on the Linux box is 2.6. > There's nothing I can do about that. > > I think that means I must have two diffe

Re: coding for multiple versions of python

2009-08-13 Thread akonsu
On Aug 13, 12:57 pm, "Tim Arnold" wrote: > Hi, > I've got a python based system that has to run on hp unix and red hat linux. > The Python version on the HP is 2.4 and the version on the Linux box is 2.6. > There's nothing I can do about that. > > I think that means I must have two different libra

coding for multiple versions of python

2009-08-13 Thread Tim Arnold
Hi, I've got a python based system that has to run on hp unix and red hat linux. The Python version on the HP is 2.4 and the version on the Linux box is 2.6. There's nothing I can do about that. I think that means I must have two different libraries since the pyc files are not cross-version com

Re: Programming by Contract

2009-08-13 Thread Scott David Daniels
Charles Yeomans wrote: On Aug 11, 2009, at 3:30 PM, Ethan Furman wrote: Ethan Furman wrote: Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very brief look at pycontract (http://www.wayforward.net/pycontract/) and now I have at least

Re: fileinput

2009-08-13 Thread naaman
On Aug 13, 7:50 am, Dave Angel wrote: > naaman wrote: > > On Aug 12, 1:35 pm, Dave Angel wrote: > > >> naaman wrote: > > >>> I'm writing my first Python script and > >>> I want to use fileinput to open a file in r+ mode. > >>> Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. > >>> A

Re: fileinput

2009-08-13 Thread naaman
On Aug 13, 1:20 am, "Gabriel Genellina" wrote: > En Wed, 12 Aug 2009 01:27:47 -0300, naaman escribió: > > > I'm writing my first Python script and > > I want to use fileinput to open a file in r+ mode. > > Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. > > ANy ideas? > > Don't use

Re: Delegate attribute requests to object

2009-08-13 Thread Gabriel Genellina
En Thu, 13 Aug 2009 12:50:47 -0300, Evan Kroske escribió: I'm trying to use the decorator pattern in a program I'm developing. I want to create a decorator object that works like the object it's decorating except for a few functions. However, I'd rather not hard-code all the identical funct

problem with interface of operator.itemgetter

2009-08-13 Thread dou dou
I have a function to do some thing like LEFT JOIN in SQL, the function use the itemgetter to get the "ON" and "SELECT" parameters of the two table(list of list), the problem is that itemgetter may return a value or a tuple of values, because of the inconsistent return type of itemgetter, I have to

Re: fileinput

2009-08-13 Thread naaman
On Aug 13, 7:50 am, Dave Angel wrote: > naaman wrote: > > On Aug 12, 1:35 pm, Dave Angel wrote: > > >> naaman wrote: > > >>> I'm writing my first Python script and > >>> I want to use fileinput to open a file in r+ mode. > >>> Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. > >>> A

something like perl's Mail::GPG ?

2009-08-13 Thread akonsu
hello, i am looking for a module with functionality similar to that of the Perl's Mail::GPG package. I need to verify multipart emails that are PGP-signed. thanks for any advice konstantin -- http://mail.python.org/mailman/listinfo/python-list

Re: csv.DictWriter.write_header()

2009-08-13 Thread Chris Rebert
On Wed, Aug 12, 2009 at 4:45 PM, Alan G Isaac wrote: > Given a csv.DictWriter instance `dw` > I think it would be nice to be able to > say dw.write_header() > instead of > dw.writer.writerow(dw.fieldnames) > > Good idea? Maybe. You could file a bug: http://bugs.python.org/ Cheers, Chris -- http:

Re: i Don't get why it makes trouble

2009-08-13 Thread azrael
On 14 kol, 00:14, Philip Semanchuk wrote: > On Aug 13, 2009, at 6:00 PM, azrael wrote: > > > > > > > On 13 kol, 22:09, Philip Semanchuk wrote: > >> On Aug 13, 2009, at 2:56 PM, azrael wrote: > > >> j > >>> [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] > >> len(j) > >>>

new version TimingAnalyzer

2009-08-13 Thread timinganalyzer
Hi All, 1.Added a new User Delay and Constraint Editor panel. You can add, delete, or update User Delays or Constraints. 2 .These User Delays and User Constraints are saved at the top of the .tim file. 3.Changing a User Delay or User Constraint updates every one of the same type in the di

A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-13 Thread Xah Lee
• A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode http://xahlee.org/UnixResource_dir/writ/emacs_whitespace-mode_problems.html plane text version follows: -- A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode Xah Lee

Re: fileinput

2009-08-13 Thread naaman
On Aug 13, 7:50 am, Dave Angel wrote: > naaman wrote: > > On Aug 12, 1:35 pm, Dave Angel wrote: > > >> naaman wrote: > > >>> I'm writing my first Python script and > >>> I want to use fileinput to open a file in r+ mode. > >>> Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. > >>> A

Re: Python "and" behavior

2009-08-13 Thread MRAB
Gary Herron wrote: goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boolean operators don't

Re: Python "and" behavior

2009-08-13 Thread Stephen Hansen
> > Could you explain or link me to an explanation of this? Been using > Python for a while but not sure I understand what's happening below. > Thanks. > > >>> ss=1 and "f" > >>> ss > 'f' > >>> ss=0 and "f" > >>> ss > 0 > >>> The "and" and "or" operators in Python are actually not tru

Re: Python "and" behavior

2009-08-13 Thread Mensanator
On Aug 13, 7:36 pm, goldtech wrote: > Could you explain or link me to an explanation of this? Been using > Python for a while but not sure I understand what's happening below. > Thanks. > > > > > > >>> ss=1 and "f" > >>> ss > 'f' > >>> ss=0 and "f" > >>> ss > 0 Does this help? >>> s

Re: Python "and" behavior

2009-08-13 Thread Gary Herron
goldtech wrote: Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. ss=1 and "f" ss 'f' ss=0 and "f" ss 0 Python's Boolean operators don't turn arbitrary valu

Python "and" behavior

2009-08-13 Thread goldtech
Could you explain or link me to an explanation of this? Been using Python for a while but not sure I understand what's happening below. Thanks. >>> ss=1 and "f" >>> ss 'f' >>> ss=0 and "f" >>> ss 0 >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: need help calculating point between two coordinates.

2009-08-13 Thread Dave Angel
PeteDK wrote: Hi there I'am working on a route comparison tool for carpools. The route comparison is based on 'steps' retrieved from google maps GDirection. These steps vary in length and i use the coordinates at the beginning of each "step". However, sometimes the distance of these steps is to

Re: implementing descriptors

2009-08-13 Thread Emile van Sebille
On 8/13/2009 3:17 PM dippim said... I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in start is always before the one in end? class foo(object): def __init__(self,a = None,b = No

Re: PIL and Python

2009-08-13 Thread Martin
On Aug 13, 1:55 pm, "catalinf...@gmail.com" wrote: > Hello ! > I want use python to change the "note" from .jpeg files . > What is the functions on PIL how make this ? > Thank you ! What do u mean by the note? -- http://mail.python.org/mailman/listinfo/python-list

Re: implementing descriptors

2009-08-13 Thread Mark Lawrence
dippim wrote: I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in start is always before the one in end? class foo(object): def __init__(self,a = None,b = None) self.start =

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread David
On 13 août, 21:28, Dave Angel wrote: > David wrote: > > Thanks all for your answers. As suggested by Dave and Frank, I am > > indeed looking for the main program to continue running in the > > background (I have several functions I want to launch, each at a > > predefined time interval). I like Fr

implementing descriptors

2009-08-13 Thread dippim
I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in start is always before the one in end? class foo(object): def __init__(self,a = None,b = None) self.start = a self.en

Re: i Don't get why it makes trouble

2009-08-13 Thread Philip Semanchuk
On Aug 13, 2009, at 6:00 PM, azrael wrote: On 13 kol, 22:09, Philip Semanchuk wrote: On Aug 13, 2009, at 2:56 PM, azrael wrote: j [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] len(j) 5 h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, d.id_drzava, v.id_v

Idle text wrap

2009-08-13 Thread goldtech
Hi, I'm using Idle interactive shell. Actually Idle-Spoon which has a few nice extensions and Python 2.6 on Linux. When I print str_value + "\n" Where str_value is for example a string of 120 chars. I notice that the lines seem to get hard wrapped at around 80. Is there a way I can config it t

Re: i Don't get why it makes trouble

2009-08-13 Thread azrael
On 13 kol, 22:09, Philip Semanchuk wrote: > On Aug 13, 2009, at 2:56 PM, azrael wrote: > > j > > [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] > len(j) > > 5 > h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija,   > d.id_drzava, v.id_valuta FROM  

Re: get output of du / ls command - currently ugly code ...

2009-08-13 Thread Esmail
Albert Hopkins wrote: I don't know about "easier", but a more elegant way is to not use os.popen() and to use Python's functions os.path.getsize (or os.stat) and os.walk (or os.path.walk) to achieve this. In fact if you look at the docstring for os.walk there is an example that almost does what

need help calculating point between two coordinates.

2009-08-13 Thread PeteDK
Hi there I'am working on a route comparison tool for carpools. The route comparison is based on 'steps' retrieved from google maps GDirection. These steps vary in length and i use the coordinates at the beginning of each "step". However, sometimes the distance of these steps is too long(ex. drivi

[RELEASED] Python 3.1.1 Release Candidate

2009-08-13 Thread Benjamin Peterson
On behalf of the Python development team, I'm pleased to announce the first release candidate of Python 3.1.1. This bug fix release fixes many normal bugs and several critical ones including potential data corruption in the io library. The final version should be out within the next week. Python

Re: i Don't get why it makes trouble

2009-08-13 Thread Benjamin Kaplan
On Thu, Aug 13, 2009 at 4:09 PM, Philip Semanchuk wrote: > > On Aug 13, 2009, at 2:56 PM, azrael wrote: > > j > [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] >> >>> len(j) > 5 >> >>> h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, > d.id_dr

Re: get output of du / ls command - currently ugly code ...

2009-08-13 Thread Albert Hopkins
On Thu, 2009-08-13 at 15:28 -0400, Esmail wrote: > Hi all, > > Essentially all I want to know the size of a directory, and the size > of a zipped tarball so that I can compute/report the compression ratio. > > The code I have seems hideous, but it seems to work. Surely there is an > easier,more e

Re: get output of du / ls command - currently ugly code ...

2009-08-13 Thread Esmail
re...@yahoo.co.uk wrote: On Aug 13, 8:28 pm, Esmail wrote: Hi all, Essentially all I want to know the size of a directory, and the size of a zipped tarball so that I can compute/report the compression ratio. dir_size = os.popen('du -sk somename') data = dir_size.readlines()

Re: i Don't get why it makes trouble

2009-08-13 Thread Philip Semanchuk
On Aug 13, 2009, at 2:56 PM, azrael wrote: j [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] len(j) 5 h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, d.id_drzava, v.id_valuta FROM ulica as u, opcina as o, zupanija as z, drzava as d, valuta as v WHERE

Re: get output of du / ls command - currently ugly code ...

2009-08-13 Thread re...@yahoo.co.uk
On Aug 13, 8:28 pm, Esmail wrote: > Hi all, > > Essentially all I want to know the size of a directory, and the size > of a zipped tarball so that I can compute/report the compression ratio. > > The code I have seems hideous, but it seems to work. Surely there is an > easier,more elegant way to do

Re: Help newbie with how to call a source command

2009-08-13 Thread Dave Angel
Joni Lee wrote: Hi all, I'm landing here because I need some help that I couldn't get through it. Question 1. I want to call a source command from python script. It will source some variables enviroment for further commands. I tried the following which did not work os.sys('source '+source_tex

Re: i Don't get why it makes trouble

2009-08-13 Thread azrael
On 13 kol, 21:12, "Jan Kaliszewski" wrote: > Me wrote: > > 13-08-2009 azrael wrote: > > > j > >> [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] > > len(j) > >> 5 > > h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija,   > > d.id_drzava, v.id_valuta FR

get output of du / ls command - currently ugly code ...

2009-08-13 Thread Esmail
Hi all, Essentially all I want to know the size of a directory, and the size of a zipped tarball so that I can compute/report the compression ratio. The code I have seems hideous, but it seems to work. Surely there is an easier,more elegant way to do this? dir_size = os.popen('du -sk somena

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Dave Angel
David wrote: Thanks all for your answers. As suggested by Dave and Frank, I am indeed looking for the main program to continue running in the background (I have several functions I want to launch, each at a predefined time interval). I like Frank's solution, on the paper it seems it would do what

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Falcolas
On Aug 12, 3:09 pm, David wrote: > Hi all, I'm trying to launch a function at regular time intervals but > cannot find the way to do it. Here is the code I wrote (time_interval > is a user defined variable in seconds): > [snip] > Has anyone run into a similar problem (and solved it) ? > > Thanks f

Re: trouble with reload

2009-08-13 Thread David C Ullrich
On Thu, 13 Aug 2009 12:05:26 -0700, Dr. Phillip M. Feldman wrote: > According to the Python documentation, 'reload' reloads a previously > imported module (so that changes made via an external editor will be > effective). But, when I try to use this command, I get the following > error message: >

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Dave Angel
Grant Edwards wrote: On 2009-08-13, Dave Angel wrote: Grant Edwards wrote: interval = 5.0 # interval in seconds next = time.time() while True: now = time.time() if now < next: time.sleep(now-next) print "call_the_function()"

Re: i Don't get why it makes trouble

2009-08-13 Thread Jan Kaliszewski
Me wrote: 13-08-2009 azrael wrote: j [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] len(j) 5 h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, d.id_drzava, v.id_valuta FROM ulica as u, opcina as o, zupanija as z, drzava as d, valuta as v WHERE u.nazi

Re: trouble with reload

2009-08-13 Thread Rami Chowdhury
Could you please clarify how you're calling it? E.g. reload('foo') or reload(foo) ? On Thu, 13 Aug 2009 12:05:26 -0700, Dr. Phillip M. Feldman wrote: According to the Python documentation, 'reload' reloads a previously imported module (so that changes made via an external

Re: i Don't get why it makes trouble

2009-08-13 Thread Jan Kaliszewski
13-08-2009 azrael wrote: j [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] len(j) 5 h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, d.id_drzava, v.id_valuta FROM ulica as u, opcina as o, zupanija as z, drzava as d, valuta as v WHERE u.naziv = '%s' AND

trouble with reload

2009-08-13 Thread Dr. Phillip M. Feldman
According to the Python documentation, 'reload' reloads a previously imported module (so that changes made via an external editor will be effective). But, when I try to use this command, I get the following error message: TypeError: reload() argument must be module Any suggestions will be appre

[ANN] pyjamas 0.6pre3 released

2009-08-13 Thread Luke Kenneth Casson Leighton
much as we'd very much like to declare a 0.6 stable release, really really soon and move forward, the ChangeLog just keeps growing (133 and counting) with the bugfixes, testing and contributions since 0.5p1. pyjamas is a port of GWT to python, and includes a python-to-javascript compiler and a wid

i Don't get why it makes trouble

2009-08-13 Thread azrael
>>> j [u'Tata', u'Oriovac', u'PrimorskoGoranska', u'hrvatska', u'Kuna'] >>> len(j) 5 >>> h = """SELECT distinct u.id_ulica, o.id_opcina, z.id_zupanija, d.id_drzava, >>> v.id_valuta FROM ulica as u, opcina as o, zupanija as z, drzava as d, >>> valuta as v WHERE u.naziv = '%s' AND o.naziv = '%s

Re: Delegate attribute requests to object

2009-08-13 Thread Rami Chowdhury
Oops, my apologies, it's the __getattribute__ method you want to call on self.decorated (because __getattr__ won't be there unless you define it specifically) So it should go: def __getattr__(self, request): return self.decorated.__getattribute__(request) On Thu, 13 Aug 2009 11:00

Re: How to address a global variable in a function

2009-08-13 Thread Aahz
In article <82c2f2e7-ed3e-482b-9318-d5539a2a9...@y10g2000prg.googlegroups.com>, n179911 wrote: > >I have a global variable > >// line 8 >tx = 0 > >and then I have this function (start in line 12): >def handleTranslate(result): > print line > txStr, tyStr = result.group(1), result.gro

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Ethan Furman
Ethan Furman wrote: Erik Bernoth wrote: Hi List, look at the following code: def evens(): # iterator returning even numbers i = 0 while True: yield i i += 2 # now get all the even numbers up to 15 L = [n for n in evens() if n < 15] Isn't it strange, that this cod

Help newbie with how to call a source command

2009-08-13 Thread Joni Lee
Hi all,   I'm landing here because I need some help that I couldn't get through it. Question 1. I want to call a source command from python script. It will source some variables enviroment for further commands. I tried the following which did not work os.sys('source '+source_text) call(['source'

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Ethan Furman
Erik Bernoth wrote: Hi List, look at the following code: def evens(): # iterator returning even numbers i = 0 while True: yield i i += 2 # now get all the even numbers up to 15 L = [n for n in evens() if n < 15] Isn't it strange, that this code runs (in a lazy lang

Re: Delegate attribute requests to object

2009-08-13 Thread Rami Chowdhury
More information at http://www.python.org/doc/2.5.2/ref/attribute-access.html if you need it :-) On Thu, 13 Aug 2009 10:13:47 -0700, Evan Kroske wrote: I don't want to inherit from the classes I'm decorating because they have a common superclass. I can make a generic decorator that I can

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread MRAB
David wrote: Thanks all for your answers. As suggested by Dave and Frank, I am indeed looking for the main program to continue running in the background (I have several functions I want to launch, each at a predefined time interval). I like Frank's solution, on the paper it seems it would do what

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-13 Thread RJ
A basic question in this thread is: Who will host the doc-wiki/whatever and how will it be linked to? If not hosted at python.org it can still be linked to from their docs, if allowed, possibly with 3rd level domain and re-direct. I host a number of commercial servers but I don't expect Guido to

Re: httplib incredibly slow :-(

2009-08-13 Thread Aahz
In article , Chris Withers wrote: >Aahz wrote: >> In article , >> Chris Withers wrote: >>> >>> Does anyone know of an alternative library for creating http requests >>> and getting their responses that's faster but hopefully has a similar >>> interface? >> >> PyCurl > >This seems to be a wra

Re: Database query execution times in Python?

2009-08-13 Thread Aahz
In article , pwnedd wrote: > >I've been writing some code using libraries based on the Python Database API >2.0 (MySQLdb & pg), and so far things are working really well. There is one >thing that I have not been able to figure out how to do, however: > >Retrieve the time is took a given query to

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Grant Edwards
On 2009-08-13, Dave Angel wrote: > Grant Edwards wrote: >> On 2009-08-13, Dave Angel wrote: >>> The general outline is something like (untested): >>> >>> times_called = 0 #number of times function has been called >>> start_time = now >>> while True: >>> elapsed = now - start_time

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-13 Thread Steven D'Aprano
On Wed, 12 Aug 2009 20:23:27 -0700, rurpy wrote: >> That's no different from *any* major refactoring. The exact same >> problem exists for code as well as documentation. It's a solved problem >> for code, and it's a solved problem for documentation. > > Huh? I don't buy this at all. Code refact

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread David
Thanks all for your answers. As suggested by Dave and Frank, I am indeed looking for the main program to continue running in the background (I have several functions I want to launch, each at a predefined time interval). I like Frank's solution, on the paper it seems it would do what I am looking f

Re: Delegate attribute requests to object

2009-08-13 Thread Rami Chowdhury
Perhaps I'm misunderstanding something, but I don't think that's really typical decorator behavior? Typically decorators, as I understand them, take an instance argument -- so you wouldn't be saying def __init__(self): self.decorated = Decorated() you'd be saying

Interface to Exchange Calendar via web services

2009-08-13 Thread John Gordon
I have a python app that needs to look up a person's Exchage Calendar entries to see if they are currently available. Does anyone have any code examples for communicating with EWS (Exchange Web Services)? I've found some code in Java and CSharp to do this, but none in python so far. Thanks! --

Re: Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Dave Angel
Grant Edwards wrote: On 2009-08-13, Dave Angel wrote: I'm assuming you want to call it every time_interval seconds, on average, with a little jitter allowed on each call, but keeping correct long term. In other words, if one call is a little late, you want the next one to still happen as

Delegate attribute requests to object

2009-08-13 Thread Evan Kroske
I'm trying to use the decorator pattern in a program I'm developing. I want to create a decorator object that works like the object it's decorating except for a few functions. However, I'd rather not hard-code all the identical functionality from the decorated object into the decorator object. Is t

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

2009-08-13 Thread Mark Lawrence
Gabriel Genellina wrote: [snip] Here are couple of links that discusses setting PYTHONPATH environment variable. http://docs.python.org/using/windows.html Ouch, that document should be reworked and updated! I don't understand this comment, given that the PEP370 Implementation section 2nd parag

Re: loops for ffmpeg CLI in python

2009-08-13 Thread Albert Hopkins
On Wed, 2009-08-12 at 11:29 +0200, fakhar Gillani wrote: > > Hi, > > I am a begineer in Python. Actually I am encoding video files with > different bitrates using ffmpeg CLI. I wanted to ask you that how can > I make loops so that I can vary the bitrates in the CLI of ffmpeg?? > > I want to b

Tkinter Menu in Frame

2009-08-13 Thread Sparky
Hello! I am trying to figure out if it is possible to place a Tkinter menu within a frame. This would be instead of having the menu-bar at the top of the window. Thanks, Sam -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Dave Angel
Antoine Pitrou wrote: Erik Bernoth googlemail.com> writes: Isn't it strange, that this code runs (in a lazy language) for eternity? Python is a not a lazy language. `and` and `or` are particular, they are language constructs (*), not operators, that's why they can decide whether or

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-13 Thread Paul Boddie
On 13 Aug, 16:05, ru...@yahoo.com wrote: > > All the above not withstanding, I too think a wiki is worth > trying.  But without doing a lot more than just "setting up > a wiki", I sadly believe even a python.org supported wiki > is doomed to failure. The ones on python.org seem to function reasona

IFL 2009: Final Call for Papers and Participation

2009-08-13 Thread IFL 2009
Call for Papers and ParticipationIFL 2009Seton Hall UniversitySouth Orange, NJ, USAhttp://tltc.shu.edu/blogs/projects/IFL2009/Register at: http://tltc.shu.edu/blogs/projects/IFL2009/registration.html* NEW *Registration and talk submission deadline fast approaching: August 23, 2009**

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-13 Thread rurpy
On 08/12/2009 12:27 PM, Raymond Hettinger wrote: > On Aug 12, 3:32 am, Paul Boddie wrote: >> Maybe the problem is that although everyone welcomes contributions and >> changes (or says that they do), the mechanisms remain largely beyond >> criticism. > > FWIW, I support the idea the regular docs in

Re: Networked Broadcast Messaging

2009-08-13 Thread Greg Taylor
On Aug 11, 9:18 pm, David Bolen wrote: > > If you want better guarantees, you might look into a distributed > message bus like Spread (http://www.spread.org/) or perhaps a > messaging protocol like XMPP (http://xmpp.org/) through its PubSub > extension.  Both have Python interfaces, though I have

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Antoine Pitrou
Erik Bernoth googlemail.com> writes: > > Isn't it strange, that this code runs (in a lazy language) for eternity? Python is a not a lazy language. `and` and `or` are particular, they are language constructs (*), not operators, that's why they can decide whether or not to evaluate their second te

Re: How to launch a function at regular time intervals ?

2009-08-13 Thread Grant Edwards
On 2009-08-13, Dave Angel wrote: > I'm assuming you want to call it every time_interval seconds, on > average, with a little jitter allowed on each call, but keeping correct > long term. In other words, if one call is a little late, you want the > next one to still happen as close to on-time

PIL and Python

2009-08-13 Thread catalinf...@gmail.com
Hello ! I want use python to change the "note" from .jpeg files . What is the functions on PIL how make this ? Thank you ! -- http://mail.python.org/mailman/listinfo/python-list

Re: httplib incredibly slow :-(

2009-08-13 Thread David Robinow
On Thu, Aug 13, 2009 at 3:20 AM, Chris Withers wrote: > David Robinow wrote: >> >> On Wed, Aug 12, 2009 at 12:37 PM, Chris Withers >> wrote: >>> >>> David Stanek wrote: Also on the same box where you run this script can you test with curl or wget? >>> >>> It's a Windows box, so no :-

Re: best practice for documenting a project? pydoc?

2009-08-13 Thread Esmail
Hello Jean-Michel, Thanks for your post. Based on it, and the ones received so far I will give epydoc a closer look. I don't need something superfancy (at least at the moment), just something that helps me document my code more in an organized way and helps me sift through the various classes/met

Re: csv.DictWriter.write_header()

2009-08-13 Thread John Machin
On Aug 13, 1:15 pm, Alan G Isaac wrote: > > On Aug 13, 6:45 am, Alan G Isaac wrote: > >> Given a csv.DictWriter instance `dw` > >> I think it would be nice to be able to > >> say dw.write_header() > >> instead of > >> dw.writer.writerow(dw.fieldnames) > > >> Good idea? > > On 8/12/2009 10:24 PM J

Re: Re: fileinput

2009-08-13 Thread Dave Angel
naaman wrote: On Aug 12, 1:35 pm, Dave Angel wrote: naaman wrote: I'm writing my first Python script and I want to use fileinput to open a file in r+ mode. Tried fileinput.input(sys.argv[1:],"r+") but that didn't work. ANy ideas? Need to find and overwrite a line in a file sever

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread MRAB
Erik Bernoth wrote: Hi List, look at the following code: def evens(): # iterator returning even numbers i = 0 while True: yield i i += 2 # now get all the even numbers up to 15 L = [n for n in evens() if n < 15] Isn't it strange, that this code runs (in a lazy lang

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread David House
2009/8/13 Erik Bernoth : > after 14 it is not nessesary to evaluate evens() any further. How does Python know this? I.e. how does it know that evens() will always yield things in ascending order? For example, I could write an iterator like this: def my_iter(): for i in [0,2,4,6,8,10,12,14,16,

Re: what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Brian Allen Vanderburg II
Erik Bernoth wrote: Hi List, look at the following code: def evens(): # iterator returning even numbers i = 0 while True: yield i i += 2 # now get all the even numbers up to 15 L = [n for n in evens() if n < 15] Isn't it strange, that this code runs (in a lazy lang

Re: subprocess + python-daemon - bug/problem?

2009-08-13 Thread Ben Finney
Ben Finney writes: > My first thought was perhaps it's related to the fact that the process > has no stdout? But setting ‘stdout’ and ‘stderr’ to the same file:: > > #! /usr/bin/python > > import daemon > import subprocess > > fake_console = open("fake_console.txt", "w+") >

Re: Scraping Wikipedia with Python

2009-08-13 Thread Andre Engels
On Tue, Aug 11, 2009 at 8:53 PM, David C Ullrich wrote: > Try reading a little there! Starting there I went to > > http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot > > where I found a section on existing bots, comments on how the "scraping" > is not what you want, and even a Python section wi

what is it, that I don't understand about python and lazy evaluation?

2009-08-13 Thread Erik Bernoth
Hi List, look at the following code: def evens(): # iterator returning even numbers i = 0 while True: yield i i += 2 # now get all the even numbers up to 15 L = [n for n in evens() if n < 15] Isn't it strange, that this code runs (in a lazy language) for eternity? I

Re: Unsigned char array to an unsigned longlong array

2009-08-13 Thread Gabriel Genellina
En Tue, 11 Aug 2009 23:22:27 -0300, Jus escribió: Is there a way to have an Array of unsigned longlong (C Type: unsigned longlong, Minimum size if bytes: 8) ? What I want to do is to store an array of bytes in an array of longlongs. To workaround this issue, I have tried to use the double arr

  1   2   >