Re: Monkeypatching an object to become callable

2009-08-13 Thread Gabriel Genellina
En Tue, 11 Aug 2009 20:21:16 -0300, Nikolaus Rath escribió: Bruno Desthuilliers writes: 7stud a écrit : (snip) class Wrapper(object): def __init__(self, obj, func): self.obj = obj self.func = func def __call__(self, *args): return self.func(*args) def

Re: httplib incredibly slow :-(

2009-08-13 Thread Chris Withers
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 :-( Why not? http://users.ugent.be/~bpuype/wget/ http://curl.haxx.se/download.html Fair

loops for ffmpeg CLI in python

2009-08-13 Thread fakhar Gillani
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 bulid a loop for the command below where i just want to vary the -

Unsigned char array to an unsigned longlong array

2009-08-13 Thread Francis Brissette
Hello, I'm using Python 2.6.2. Is there a way to have an Array of unsigned longlong (C Type: unsigned longlong, Minimum size if bytes: 8) ? I found a page on the internet (http://mail.python.org/pipermail/patches/2005-April/017430.html), but I'm not quite sure if it is available. What I want

Re: Character encoding & the copyright symbol

2009-08-13 Thread Ben Finney
Dave Angel writes: > But I wanted to comment on the (c) remark. If you're in the US, > that's the wrong abbreviation for copyright. The only recognized > abbreviation is (copr). More reading on this: http://en.wikipedia.org/wiki/Universal_Copyright_Convention> http://en.wikipedia.org/

Re: hashability

2009-08-13 Thread Steven D'Aprano
On Wed, 12 Aug 2009 00:33:01 -0700, James Stroud wrote: > Tell that to two different machines on two different days. Then bet the > life of yourself and your nearest and dearest family on that fact and > see whether you really want to take a hash value for granted. As far as I know, Python doesn

Re: Unrecognized escape sequences in string literals

2009-08-13 Thread Douglas Alan
On Aug 12, 7:19 pm, Steven D'Aprano wrote: > You are making an unjustified assumption: \y is not an error. You are making in an unjustified assumption that I ever made such an assumption! My claim is and has always been NOT that \y is inately an error, but rather that treating unrecognized esca

Re: resume upload wsgi script

2009-08-13 Thread Diez B. Roggisch
gert schrieb: On Aug 10, 10:39 am, "Diez B. Roggisch" wrote: 250KB :) So why do you bother? Its just HTTP1.1 has everything for making ftp like file transfers possible. When I write it to a file then I am back at square one because I still need to load it completely to get it into a blob. W

Re: Nice copy in interactive terminal

2009-08-13 Thread Elias Fotinis (eliasf)
"casebash" wrote: I've been wondering for a while if there exists an interactive terminal which has nice copy feature (ie. I can copy code without getting the >>> in front of every line). It would help if we knew what platform you're interested in -- your User-Agent is G2/1.0, but I don't know

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[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

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

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

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

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

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

[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

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

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

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  

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

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

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

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

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

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

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

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

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:

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

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

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

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

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

  1   2   >