Re: Calculate an age

2007-12-11 Thread Gabriel Genellina
En Sat, 08 Dec 2007 14:37:13 -0300, Pierre Quentel <[EMAIL PROTECTED]> escribió: > I understand that there is no possible conversion from a number of > days to a (X,Y,Z) tuple of (years,months,days), and the reverse. But > the difference between 2 dates can be unambiguously expressed as > (X,Y,Z

Re: GUI development with 3D view

2007-12-11 Thread Glenn Hutchings
On Dec 11, 1:58 am, gsal <[EMAIL PROTECTED]> wrote: > If all you need to do is display a bunch of arrows, as you mention, > the easiest thing to do might be to use Visual Python. It is > extremely easy to use. Another option, if your app is data-driven, is to check out the Visualization Toolkit (

Re: Are Python deques linked lists?

2007-12-11 Thread Peter Otten
Duncan Booth wrote: > Peter Otten <[EMAIL PROTECTED]> wrote: >> However, you will get into trouble if you try to run two simultaneous >> iterations over the same LinkedList, so there is room for another >> exercise ;) That was a bit vague; I saw the shared _cursor attribute but didn't dig deepe

Re: dictionary of dictionaries

2007-12-11 Thread Marc 'BlackJack' Rintsch
On Mon, 10 Dec 2007 23:51:00 -0800, kettle wrote: > On Dec 10, 6:58 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> Well, there's also dict.setdefault() >> >> >>> pairs = ["ab", "ab", "ac", "bc"] >> >>> outer = {} >> >>> for a, b in pairs: >> >> ... inner = outer.setdefault(a, {}) >> ... inn

Re: Dumb newbie back in shell

2007-12-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (Martin, please, don't top post - fixed) > > Peter Otten wrote: >> MartinRinehart wrote: >> >>> However, here's the little tester I wrote: >>> >>> # t.py - testing >>> >>> global g >>> g = 'global var, here' >>> >>> def f(): >>> print g >>> >>> f() >>> >>> It prints

Re: Is a "real" C-Python possible?

2007-12-11 Thread Duncan Booth
sturlamolden <[EMAIL PROTECTED]> wrote: > On 9 Des, 23:34, Christian Heimes <[EMAIL PROTECTED]> wrote: > >> >http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-pyth >> >... >> >> The Ruby developers are allowed to be proud. They were able to >> optimize some aspects of the implemen

Re: dictionary of dictionaries

2007-12-11 Thread Kay Schluehr
On Dec 9, 9:35 am, kettle <[EMAIL PROTECTED]> wrote: > Hi, > I'm wondering what the best practice is for creating an extensible > dictionary-of-dictionaries in python? > > In perl I would just do something like: > > my %hash_of_hashes; > for(my $i=0;$i<10;$i++){ > for(my $j=0;$j<10;$j++){ >

dpap implementation in python

2007-12-11 Thread Andy Cheesman
Hi people Is there a dpap implementation for python? All I can seem to find is perl based? (dpap is used to share photos in iphoto) Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: Are Python deques linked lists?

2007-12-11 Thread Duncan Booth
Peter Otten <[EMAIL PROTECTED]> wrote: >> Only if you try to modify the list from both of them. > > One deletion is enough to trigger the assertion: Yes, but the assertion isn't intended to be the complete code. > > Or you just rule that delete(x) must occur "immediately" after x = > next().

Re: Any way to program custom syntax to python prompt? >> I want to edit matrices.

2007-12-11 Thread Ramsey Nasser
On 11 Dec 2007 04:14:09 GMT, Stargaming <[EMAIL PROTECTED]> wrote: > On Mon, 10 Dec 2007 16:54:08 -0800, mosi wrote: > > > Python matrices are usually defined with numpy scipy array or similar. > > e.g. > matrix1 = [[1, 2], [3, 4], [5, 6]] > > I would like to have easier way of defining matric

Re: Securely distributing python source code as an application?

2007-12-11 Thread Ben Finney
xkenneth <[EMAIL PROTECTED]> writes: > I'll shortly be distributing a number of python applications that > use proprietary. That's unfortunate. Hopefully it's not too late to avoid restricting yourself and your users in this way. > The software is part of a much larger system and it will need to

Re: Job Offer: Python Ninja or Pirate!

2007-12-11 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Just a few months ago, we found a few amazingly talented ninjas and > even a few swarthy pirates. The team is doing wonderfully, and we're > hoping to add a few more adventure-loving souls to our ranks. For job postings, please don't use the maili

Re: module level subclassing

2007-12-11 Thread Gabriel Genellina
En Mon, 10 Dec 2007 16:43:15 -0300, km <[EMAIL PROTECTED]> escribió: > Is there a way to access the classes defined in the __init__.py into the > modules files in the directory? > for example say i have a module (dir) M with contents __init__.py and > a.pyand > b.py > a.py and b.py would lik

Python 2.4.4 crashes inside a turbogears project

2007-12-11 Thread bulgaro
Hi everybody. I hope not to be OT but this is a python problem, not a turbogears one. I have a problem when starting a turbogears project. In my model.py i import an api to work with a db which imports a pyd library. It gives me this output: C:\Turbogears>python start-traffic.py dev.cfg 2007-12-11

simplejson setup problem

2007-12-11 Thread Robin Becker
I'm getting this error whilst building simplejson-1.7.3 with "setup.py install" on a win32 platform. ... creating build\bdist.win32\egg\EGG-INFO removing simplejson.egg-info\native_libs.txt copying simplejson.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying simplejson.egg-info\SOUR

pyTTS com_error

2007-12-11 Thread Dick
I am trying to get the pyTTS module working. I have Python 2.4, the Microsodt SAPI and pyTTS-3.0.win32-py2.4.exe installed. When I run this script: import pyTTS tts = pyTTS.Create() #set the speech rate tts.Rate = 4 #set the speech volume percentage (0-100%) tts.Volume = 40 #get a list of all

Re: xpath and current python xml libraries

2007-12-11 Thread Paul Boddie
On Dec 11, 2:03 am, [EMAIL PROTECTED] wrote: > PyXML seems to be long gone. Is lxml the way to go if i want to have > xpath supported? The libxml2dom package (which I maintain) also supports XPath and is also based on libxml2. If you want to migrate code from using PyXML without too much effort, i

GetPath to variable

2007-12-11 Thread Connolly
Hey there, new Python user here. Currently, I'm working on a project in Python for my college work, I chose to use Python since I heard of its great advantages, now for designing GUI's I'm using the wxPython package. What I'm trying to do at the moment is the following; A file directory browser

Re: xpath and current python xml libraries

2007-12-11 Thread anand nalya
Is there a package that supports XSLT 2? On 11/12/2007, Paul Boddie <[EMAIL PROTECTED]> wrote: > > On Dec 11, 2:03 am, [EMAIL PROTECTED] wrote: > > PyXML seems to be long gone. Is lxml the way to go if i want to have > > xpath supported? > > The libxml2dom package (which I maintain) also supports

Re: GetPath to variable

2007-12-11 Thread Bruno Desthuilliers
Connolly a écrit : > Hey there, new Python user here. > > Currently, I'm working on a project in Python for my college work, I chose > to use Python since I heard of its great advantages, now for designing GUI's > I'm using the wxPython package. > What I'm trying to do at the moment is the follo

Error accessing a java web service

2007-12-11 Thread anand nalya
Hi, I'm trying to access a web service written in java from python, but it is returning a NullPointerException. The parameter that I'm passing is somehow not reaching the server. Here is the code I'm using for invoking the service import SOAPpy from SOAPpy import SOAPProxy import fpconst import

Re: Job Offer: Python Ninja or Pirate!

2007-12-11 Thread Bruno Desthuilliers
kromakey a écrit : > On 10 Dec, 19:11, Stargaming <[EMAIL PROTECTED]> wrote: >> On Mon, 10 Dec 2007 16:10:16 +0200, Nikos Vergas wrote: >> >> [snip] >> Problem: In the dynamic language of your choice, write a short program that will: 1. define a list of the following user ids 42346,

Re: logging.py: mutiple system users writing to same file getting permission errors.

2007-12-11 Thread Vinay Sajip
On Dec 10, 8:34 pm, evenrik <[EMAIL PROTECTED]> wrote: > On Dec 7, 12:46 pm, Vinay Sajip <[EMAIL PROTECTED]> wrote: > > > > > On Dec 6, 6:35 pm, evenrik <[EMAIL PROTECTED]> wrote: > > > > An a redhat box I have root, apache and other normal users run code > > > that uses theloggingmodule to write t

Re: Are Python deques linked lists?

2007-12-11 Thread Neil Cerutti
On 2007-12-11, Duncan Booth <[EMAIL PROTECTED]> wrote: > There are lots of ways to handle this. You could save a > separate pointer for each iterator. In fact I would expect that > to handle all the possible variations of inserting and deleting > correctly you do need to keep all the pointers somew

Re: abusing exceptions for continuations

2007-12-11 Thread Lautaro Pecile
On Dec 10, 5:39 am, gangesmaster <[EMAIL PROTECTED]> wrote: > i've had this strange idea of using the exception's traceback (which > holds the stack frame) to enable functional continuations, meaning, > raise some special exception which will be caught by a reactor/ > scheduler/framework, which cou

How can you make pylint/pychecker "see" setattr

2007-12-11 Thread Emin.shopper Martinian.shopper
Dear Experts, Does anyone know how you can either make pylint "see" setattr or give it explicit information when you do a "compile time" call to setattr? For example, imagine that I have the following block of code class foo: def __init__(self): for i in [1,2,5]: setattr(s

Re: Dumb newbie back in shell

2007-12-11 Thread MartinRinehart
I'm less confused. If someone can explain the wisdom of this design, I'd be grateful. If someone can explain why the following compiles successfully, I'd be even more grateful: def get_toks( text ): global line_ptr, last_line while line_ptr < last_line: while char_ptr < len(text[l

TCP reset caused by socket.py

2007-12-11 Thread Object01
I've been working with the source code for Trac (http:// trac.edgewall.org/) lately and have run across a bizarre problem. It seems that all POST requests to Trac's standalone server (tracd) have a random chance of causing the server to issue a TCP RST packet that resets the connection. Running T

"do" as a keyword

2007-12-11 Thread cokofreedom
First off let me state that I really enjoy using Python. I am a 3rd year student and have been using python for 3 months, (thanks to trac!). I do not consider myself an experienced or clever programmer, but I am able to get by. Something I love about Python is that almost everything you do can be

Re: xpath and current python xml libraries

2007-12-11 Thread Dmitri Fedoruk
On Dec 11, 4:03 am, [EMAIL PROTECTED] wrote: > PyXML seems to be long gone. Is lxml the way to go if i want to have > xpath supported? Of course. Lxml proved itself as a very convenient xml & xslt processing tool. Dmitri -- http://mail.python.org/mailman/listinfo/python-list

Counter-spam: Change the subject

2007-12-11 Thread Paul McGuire
On Dec 11, 5:59 am, dfg <[EMAIL PROTECTED]> wrote: > Breakthrough - How To Turn Your Dull Website into Money Making Website I was surprised at how effectively the spam posting the other day, "Jesus in the Quran" was masked and defused by a reply titled "J in the Q". It seems this might be a simp

Re: Dumb newbie back in shell

2007-12-11 Thread J. Clifford Dyer
The code you just posted doesn't compile successfully. However, in your code, you probably have char_ptr defined at the module level, and you're confused because you didn't declare it as global. Am I right? My crystal ball has a smudge on it, but I think I can still see okay. You can still re

Re: Dumb newbie back in shell

2007-12-11 Thread Chris Mellon
On Dec 11, 2007 8:23 AM, J. Clifford Dyer <[EMAIL PROTECTED]> wrote: > The code you just posted doesn't compile successfully. > It *compiles* fine, but it'll raise an error when run. > However, in your code, you probably have char_ptr defined at the module > level, and you're confused because yo

Re: Dumb newbie back in shell

2007-12-11 Thread Bruno Desthuilliers
J. Clifford Dyer a écrit : > The code you just posted doesn't compile successfully. > > However, in your code, you probably have char_ptr defined at the > module level, and you're confused because you didn't declare it as > global. Am I right? My crystal ball has a smudge on it, but I think > I

Re: Dumb newbie back in shell

2007-12-11 Thread J. Clifford Dyer
On Tue, Dec 11, 2007 at 08:36:54AM -0600, Chris Mellon wrote regarding Re: Dumb newbie back in shell: > Delivered-To: [EMAIL PROTECTED] > Date: Tue, 11 Dec 2007 08:36:54 -0600 > From: "Chris Mellon" <[EMAIL PROTECTED]> > To: "python-list@python.org" > Subject: Re: Dumb newbie back in shell > In-R

Re: Dumb newbie back in shell

2007-12-11 Thread Bruno Desthuilliers
Chris Mellon a écrit : (snip) > What's probably happening is that line_ptr < last_line is not true Indeed. > and the body of the function isn't executed at all. The unbound local > exception is a runtime error that occurs when the local is accessed, > not when the function is compiled. Now sin

Re: Dumb newbie back in shell

2007-12-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Martin, would you _please_ learn to quote properly ? top-posting and keeping the whole text of the previous posts are two really annoying practices. TIA > I'm less confused. If someone can explain the wisdom of this design, > I'd be grateful. Since there's no disti

Re: "do" as a keyword

2007-12-11 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > First off let me state that I really enjoy using Python. I am a 3rd > year student and have been using python for 3 months, (thanks to > trac!). I do not consider myself an experienced or clever programmer, > but I am able to get by. > > Something I love about Python is

Re: "do" as a keyword

2007-12-11 Thread Neil Cerutti
On 2007-12-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > First off let me state that I really enjoy using Python. I am a > 3rd year student and have been using python for 3 months, > (thanks to trac!). I do not consider myself an experienced or > clever programmer, but I am able to get by. > >

Python-URL! - weekly Python news and links (Dec 11)

2007-12-11 Thread Gabriel Genellina
QOTW: "I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you." Randall Munroe title attribute embedded in source of http://xkcd.com/353/ "[M]ost undergraduate degrees in computer science these days are basically Java vocational training." - Alan Kay

Re: need the unsigned value from dl.call()

2007-12-11 Thread Larry Bates
eliss wrote: > I'm using dl.call() to call a C function in an external library. It's > working great so far except for one function, which returns an > unsigned int in the C version. However, in python it returns a signed > value to me. How can I get the unsigned value from this? I haven't > brushe

Re: Source formatting fixer?

2007-12-11 Thread Jesse Jaggars
Bret wrote: > Does anyone know of a package that can be used to "fix" bad formatting > in Python code? I don't mean actual errors, just instances where > someone did things that violate the style guide and render the code > harder to read. > > If nothing exists, I'll start working on some sed scri

Re: Is a "real" C-Python possible?

2007-12-11 Thread MonkeeSage
On Dec 11, 3:10 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > sturlamolden <[EMAIL PROTECTED]> wrote: > > On 9 Des, 23:34, Christian Heimes <[EMAIL PROTECTED]> wrote: > > >> >http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-pyth > >> >... > > >> The Ruby developers are allowed to be

Re: Dumb newbie back in shell

2007-12-11 Thread Chris Mellon
On Dec 11, 2007 8:51 AM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Chris Mellon a écrit : > (snip) > > What's probably happening is that line_ptr < last_line is not true > > Indeed. > > > and the body of the function isn't executed at all. The unbound local > > exception is a runtime error

Re: Are Python deques linked lists?

2007-12-11 Thread Duncan Booth
Neil Cerutti <[EMAIL PROTECTED]> wrote: > If you put an instrumented iterator through, say, reversed or > sorted, you'd lose the ability to use it to modify the list I think that is kind of irrelevant. reversed doesn't take an iterator, it requires a sequence and returns an iterator. sorted will

Re: need the unsigned value from dl.call()

2007-12-11 Thread Diez B. Roggisch
Larry Bates wrote: > eliss wrote: >> I'm using dl.call() to call a C function in an external library. It's >> working great so far except for one function, which returns an >> unsigned int in the C version. However, in python it returns a signed >> value to me. How can I get the unsigned value fro

Re: Are Python deques linked lists?

2007-12-11 Thread Neil Cerutti
On 2007-12-11, Duncan Booth <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: >> If you put an instrumented iterator through, say, reversed or >> sorted, you'd lose the ability to use it to modify the list > > I think that is kind of irrelevant. reversed doesn't take an > iterato

Re: Dumb newbie back in shell

2007-12-11 Thread Bruno Desthuilliers
Chris Mellon a écrit : > On Dec 11, 2007 8:51 AM, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Chris Mellon a écrit : >> (snip) >>> What's probably happening is that line_ptr < last_line is not true >> Indeed. >> >>> and the body of the function isn't executed at all. The unbound local >>>

PyErr_NoMemory and multiple sub-interpreters

2007-12-11 Thread Manlio Perillo
Hi. Is it safe to use PyErr_NoMemory in a multi sub-interpreters environment? I have some doubts since PyErr_NoMemory uses a global variable: PyExc_MemoryErrorInst Thanks Manlio Perillo -- http://mail.python.org/mailman/listinfo/python-list

Leo 4.4.5 final released

2007-12-11 Thread Edward K Ream
Leo 4.4.5 final is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo 4.4.5 fixes several long-delayed bug fixes and adds several new features. Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamle

Re: Is a "real" C-Python possible?

2007-12-11 Thread sturlamolden
On 11 Des, 10:10, Duncan Booth <[EMAIL PROTECTED]> wrote: > @memoize(3) > def fib(n): >if n == 0 or n == 1: > return n >else: > return fib(n-1) + fib(n-2) The thing I would do is: def fibo(n): while 1: try: return fibo.seq[n] except AttributeE

finding dir of main .py file

2007-12-11 Thread ron.longo
Is there any way that I can find the path of the main .py file of my application? For example, I have an application with some resources which are in a subdirectory: myPythonApp.py /resources image1 image2 etc. If i just do a call to os.getcwd() I get back

Matching XML Tag Contents with Regex

2007-12-11 Thread Chris
I'm trying to find the contents of an XML tag. Nothing fancy. I don't care about parsing child tags or anything. I just want to get the raw text. Here's my script: import re data = """ here's some text! here's some text! here's some text! """ tagName = 'div' pattern = re.compile('<%(tag

Re: Help needed with python unicode cgi-bin script

2007-12-11 Thread weheh
import sys if sys.platform == "win32": import os, msvcrt msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) "Jack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just want to make sure, how exactly are you doing that? > >> Thanks for the reply, Jack. I tried setting mode to

Re: "do" as a keyword

2007-12-11 Thread Tor Erik Sønvisen
> I also started to ponder about the "'do > something' if 'true' else 'do this'", and pondered if perhaps > this statement could do with the including of the keyword do. Python has support for this in versions >= 2.5: >>> a = range(0, 5) >>> b = range(5, 8) >>> min(a) if sum(a) < sum(b) else min(

Re: Matching XML Tag Contents with Regex

2007-12-11 Thread garage
> Is what I'm trying to do possible with Python's Regex library? Is > there an error in my Regex? Search for '*?' on http://docs.python.org/lib/re-syntax.html. To get around the greedy single match, you can add a question mark after the asterisk in the 'content' portion the the markup. This caus

Re: Counter-spam: Change the subject

2007-12-11 Thread Aahz
In article <[EMAIL PROTECTED]>, Paul McGuire <[EMAIL PROTECTED]> wrote: >On Dec 11, 5:59 am, dfg <[EMAIL PROTECTED]> wrote: >> >> Breakthrough - How To Turn Your Dull Website into Money Making Website > >I was surprised at how effectively the spam posting the other day, >"Jesus in the Quran" was m

Re: Job Offer: Python Ninja or Pirate!

2007-12-11 Thread George Sakkis
On Dec 10, 11:07 pm, Stargaming <[EMAIL PROTECTED]> wrote: > On Mon, 10 Dec 2007 19:27:43 -0800, George Sakkis wrote: > > On Dec 10, 2:11 pm, Stargaming <[EMAIL PROTECTED]> wrote: > >> On Mon, 10 Dec 2007 16:10:16 +0200, Nikos Vergas wrote: > > >> [snip] > > >> >> Problem: In the dynamic language o

Re: finding dir of main .py file

2007-12-11 Thread Rick Dooling
On Dec 11, 10:08 am, "ron.longo" <[EMAIL PROTECTED]> wrote: > Is there any way that I can find the path of the main .py file of my > application? > > For example, I have an application with some resources which are in a > subdirectory: > > myPythonApp.py > /resources > image1 >

problem parsing lines in a file

2007-12-11 Thread barronmo
I'm having difficulty getting the following code to work. All I want to do is remove the '0:00:00' from the end of each line. Here is part of the original file: 3,3,"Dyspepsia NOS",9/12/2003 0:00:00 4,3,"OA of lower leg",9/12/2003 0:00:00 5,4,"Cholera NOS",9/12/2003 0:00:00 6,4,"Open wound of ea

Re: Matching XML Tag Contents with Regex

2007-12-11 Thread harvey . thomas
On Dec 11, 4:05 pm, Chris <[EMAIL PROTECTED]> wrote: > I'm trying to find the contents of an XML tag. Nothing fancy. I don't > care about parsing child tags or anything. I just want to get the raw > text. Here's my script: > > import re > > data = """ > > > > here's some text! > > > here's som

Re: problem parsing lines in a file

2007-12-11 Thread Diez B. Roggisch
barronmo wrote: > I'm having difficulty getting the following code to work. All I want > to do is remove the '0:00:00' from the end of each line. Here is part > of the original file: > > 3,3,"Dyspepsia NOS",9/12/2003 0:00:00 > 4,3,"OA of lower leg",9/12/2003 0:00:00 > 5,4,"Cholera NOS",9/12/200

Re: finding dir of main .py file

2007-12-11 Thread Shane Geiger
Some usage of __file__ will always get what you want in various situations: print __file__ print modulename.__file__ print os.getcwd() + "/" + __file__ Rick Dooling wrote: > On Dec 11, 10:08 am, "ron.longo" <[EMAIL PROTECTED]> wrote: > >> Is there any way that I can find the path of t

Re: Help needed with python unicode cgi-bin script

2007-12-11 Thread weheh
Hi John: Thanks for responding. >Look at your file using > print repr(open('c:/test/spanish.txt','rb').read()) >If you see 'a\xf1o' then use charset="windows-1252" I did this ... no change ... still see 'a\xf1o' >else if you see 'a\xc3\xb1o' then use charset="utf-8" else >Based on your

Re: finding dir of main .py file

2007-12-11 Thread ron.longo
Nope, maybe I'm not explaining myself well. When I do os.getenv('HOME') I get back None. According to the docs, 'HOME' is the user's home directory on some platforms. Which is not what I want. What I want is the directory in which an application's main .py file resides. That is, when I type:

new desktops

2007-12-11 Thread lawry_jim
http://cheap-computers-new.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Matching XML Tag Contents with Regex

2007-12-11 Thread Chris
On Dec 11, 11:41 am, garage <[EMAIL PROTECTED]> wrote: > > Is what I'm trying to do possible with Python's Regex library? Is > > there an error in my Regex? > > Search for '*?' onhttp://docs.python.org/lib/re-syntax.html. > > To get around the greedy single match, you can add a question mark > afte

Why does producer delay halt shell pipe?

2007-12-11 Thread dwhall
I have 2 python scripts: examples of a producer and a filter, respectively: #! /usr/bin/env python import sys, time if __name__ == "__main__": while True: sys.stdout.write("hello.\r\n") time.sleep(0.01) #! /usr/bin/env python import sys

Block comments

2007-12-11 Thread MartinRinehart
Tomorrow is block comment day. I want them to nest. I think the reason that they don't routinely nest is that it's a lot of trouble to code. Two questions: 1) Given a start and end location (line position and char index) in an array of lines of text, how do you Pythonly extract the whole block com

Re: problem parsing lines in a file

2007-12-11 Thread Chris
On Dec 11, 7:25 pm, barronmo <[EMAIL PROTECTED]> wrote: > I'm having difficulty getting the following code to work. All I want > to do is remove the '0:00:00' from the end of each line. Here is part > of the original file: > > 3,3,"Dyspepsia NOS",9/12/2003 0:00:00 > 4,3,"OA of lower leg",9/12/200

Re: Dumb newbie back in shell

2007-12-11 Thread MartinRinehart
re top posting Thanks for explaining. google groups hides the quoted text, so I didn't see it. Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a �crit : > > Martin, would you _please_ learn to quote properly ? top-posting and > keeping the whole text of the previous posts are two really annoying

Re: problem parsing lines in a file

2007-12-11 Thread Matimus
> This result is a copy of "ProblemList" without any changes made. What > am I doing wrong? Thanks for any help. rstrip doesn't work the way you think it does >>> help(str.rstrip) Help on method_descriptor: rstrip(...) S.rstrip([chars]) -> string or unicode Return a copy of the strin

Re: Python 2.4.4 crashes inside a turbogears project

2007-12-11 Thread Terry Reedy
"bulgaro" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I hope not to be OT but this is a python problem, not a turbogears one. What you have shown is not a crash but a planned shutdown in response to an error. There is a difference ;-). It is almost certainly not a problem

Re: Matching XML Tag Contents with Regex

2007-12-11 Thread Diez B. Roggisch
Chris wrote: > On Dec 11, 11:41 am, garage <[EMAIL PROTECTED]> wrote: >> > Is what I'm trying to do possible with Python's Regex library? Is >> > there an error in my Regex? >> >> Search for '*?' onhttp://docs.python.org/lib/re-syntax.html. >> >> To get around the greedy single match, you can add

Re: a Python person's experience with Ruby

2007-12-11 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Lou Pecora a écrit : > > In article <[EMAIL PROTECTED]>, > > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > > > > >>>Thus: close; > >>>could replace close(); > > *Please* give proper attribution. I'd

Re: Newbie edit/compile/run cycle question

2007-12-11 Thread Bruno Desthuilliers
Jeremy C B Nicoll a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > >>Jeremy C B Nicoll a écrit : >> >>>Figuring out how IDLE works is a bit beyond me at this stage. >> >>Did you try out, or is it just an a priori ? > > > Sort of, no and yes... > > A few weeks ago I started tryi

Re: Why does producer delay halt shell pipe?

2007-12-11 Thread Nanjundi
On Dec 11, 1:05 pm, dwhall <[EMAIL PROTECTED]> wrote: > filters. Is there any way to write the filter to make this work? > > thanks, > > !!Dean turn off python buffering & it should work. export PYTHONUNBUFFERED=t n'joy -N -- http://mail.python.org/mailman/listinfo/python-list

Re: Block comments

2007-12-11 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Tomorrow is block comment day. I want them to nest. I think the reason > that they don't routinely nest is that it's a lot of trouble to code. Indeed. > Two questions: > > 1) Given a start and end location (line position and char index) in an > array of lines of tex

Building python 2.5.1 from source using MSVC 2005

2007-12-11 Thread black_13
How do i build python 2.5.1 from source using MSVC 2005? Are there instructions on doing this. thanks black_13 -- http://mail.python.org/mailman/listinfo/python-list

Help: Trouble with imp.load_module

2007-12-11 Thread David Hirschfield
I'm not entirely sure what's going on here, but I suspect it's related to my general lack of knowledge of the python import internals. Here's the setup: module: tester.py: - import imp def loader(mname, mpath): fp, pathname, description = imp.find_module(mname,[mpath]) tr

DNS servers in Python - which ones are a good base for work?

2007-12-11 Thread John Nagle
I need to do a non-standard DNS server in Python. This is for a spam blacklist type DNS server, not for IP lookup. "dnspython" seems to be client side only. Oak DNS is deprecated. Suggestions? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Is anyone happy with csv module?

2007-12-11 Thread massimo s.
Hi, I'm struggling to use the python in-built csv module, and I must say I'm less than satisfied. Apart from being rather poorly documented, I find it especially cumbersome to use, and also rather limited. What I dislike more is that it seems working by *rows* instead than by *columns*. So I have

Re: Is anyone happy with csv module?

2007-12-11 Thread Guilherme Polo
2007/12/11, massimo s. <[EMAIL PROTECTED]>: > Hi, > > I'm struggling to use the python in-built csv module, and I must say > I'm less than satisfied. Apart from being rather poorly documented, I > find it especially cumbersome to use, and also rather limited. What I > dislike more is that it seems

Re: Is a "real" C-Python possible?

2007-12-11 Thread John Nagle
sturlamolden wrote: > On 10 Des, 23:49, [EMAIL PROTECTED] (Aahz) wrote: > >> "Premature optimization is the root of all evil in programming." >> --C.A.R. Hoare (often misattributed to Knuth, who was himself quoting >> Hoare) We're ten years into Python, and it's still a naive interpreter. It'

Re: Is a "real" C-Python possible?

2007-12-11 Thread Paul Rudin
sturlamolden <[EMAIL PROTECTED]> writes: > On 10 Des, 23:49, [EMAIL PROTECTED] (Aahz) wrote: > >> "Premature optimization is the root of all evil in programming." >> --C.A.R. Hoare (often misattributed to Knuth, who was himself quoting >> Hoare) > > Oh, I was Hoare? Thanks. Anyway, it doesn't chan

Tuples !?!?

2007-12-11 Thread aaragao
Hi, Is the tuple comparison brooked in python ?!?!? Thanks. Try this and you will see funny things: # -*- coding: cp1252 -*- import random import csv import struct import array def gera_string(res): # acampo3 acampo3=((0,5,'muito reduzidos'),(6,20,'reduzidos'), (21,32,'satisfa

Re: DNS servers in Python - which ones are a good base for work?

2007-12-11 Thread Jean-Paul Calderone
On Tue, 11 Dec 2007 11:10:52 -0800, John Nagle <[EMAIL PROTECTED]> wrote: > I need to do a non-standard DNS server in Python. This >is for a spam blacklist type DNS server, not for IP lookup. >"dnspython" seems to be client side only. Oak DNS is >deprecated. Suggestions? > There's Twisted Nam

Re: newbie

2007-12-11 Thread Steven D'Aprano
On Mon, 10 Dec 2007 19:25:53 -0800, farsheed wrote: > On Dec 11, 5:03 am, "Whizzer" <[EMAIL PROTECTED]> wrote: >> Is OReilly's Learning Python a good place to start learning to program? >> I've been told Python is a good first language. >> >> Thanks for the advice. > > I learn it from python own

Re: Is a "real" C-Python possible?

2007-12-11 Thread Chris Mellon
On Dec 11, 2007 1:25 PM, John Nagle <[EMAIL PROTECTED]> wrote: > sturlamolden wrote: > > On 10 Des, 23:49, [EMAIL PROTECTED] (Aahz) wrote: > > > >> "Premature optimization is the root of all evil in programming." > >> --C.A.R. Hoare (often misattributed to Knuth, who was himself quoting > >> Hoare)

Re: finding dir of main .py file

2007-12-11 Thread Matt Nordhoff
ron.longo wrote: > Nope, maybe I'm not explaining myself well. > > When I do os.getenv('HOME') I get back None. > > According to the docs, 'HOME' is the user's home directory on some > platforms. Which is not what I want. > > What I want is the directory in which an application's main .py file

Re: Help needed with python unicode cgi-bin script

2007-12-11 Thread John Machin
On Dec 12, 4:46 am, "weheh" <[EMAIL PROTECTED]> wrote: > Hi John: > Thanks for responding. > > >Look at your file using > > > print repr(open('c:/test/spanish.txt','rb').read()) > > >If you see 'a\xf1o' then use charset="windows-1252" > > I did this ... no change ... still see 'a\xf1o' So it's

cadastros de e-mails por estados

2007-12-11 Thread pesquisa
listas de email marketing livre de spam Maladireta e-mails para mala- direta. mala direta, emails segmentados, e-mail marketing. Visite agora: http://www.divulgaemails.com Listas de e-mails, lista de emails, compra de emails, maladireta, mala direta segmentada, , mala direta por e-mail. Mala Dire

Re: Tuples !?!?

2007-12-11 Thread Grant Edwards
On 2007-12-11, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > Is the tuple comparison brooked in python ?!?!? No. > Thanks. You're welcome. > Try this and you will see funny things: No thanks. Maybe you could to post a smaller, easier to read example of what you think is broken? --

Zipfile content reading via an iterator?

2007-12-11 Thread Tim Chase
I'm dealing with several large items that have been zipped up to get quite impressive compression. However, uncompressed, they're large enough to thrash my memory to swap and in general do bad performance-related things. I'm trying to figure out how to produce a file-like iterator out of the

Re: I'm missing something here with range vs. xrange

2007-12-11 Thread Hrvoje Niksic
"Joe Goldthwaite" <[EMAIL PROTECTED]> writes: > To do a range(100) > > 1. Allocate a big chunk of memory > 2. Fill the memory with the range of integers > 3. Setup an index into the memory array > 4. Every time the program asks for the next item, bump > the mem

Re: Are Python deques linked lists?

2007-12-11 Thread Hrvoje Niksic
Neil Cerutti <[EMAIL PROTECTED]> writes: > Anyhow, implementing linked lists in Python is not challenging, but > they don't work well with Python iterators, which aren't suitable > for a linked list's purposes--so you have to give up the happy-joy > for loop syntax in favor of Python's frowny-sad

Re: Is a "real" C-Python possible?

2007-12-11 Thread Adam Funk
On 2007-12-10, sturlamolden wrote: > We have seen several examples that 'dynamic' and 'interpreted' > languages can be quite efficient: There is an implementation of Common > Lisp - CMUCL - that can compete with Fortran in efficiency for > numerical computing. There are also versions of Lisp than

Re: Is a "real" C-Python possible?

2007-12-11 Thread Hrvoje Niksic
sturlamolden <[EMAIL PROTECTED]> writes: > On 10 Des, 23:54, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> Or a lack of time and money. Lisp is one of the older programming >> languages around, and at a time had BigBucks(tm) invested on it to try >> and make it practically usable. > > Yes.

Re: Are Python deques linked lists?

2007-12-11 Thread Hrvoje Niksic
Duncan Booth <[EMAIL PROTECTED]> writes: >> I do have one last question about a doubly-linked list. Would you >> have to perform any tricks (del statements) to get the garbage >> collector to collect every node, or will it just work? > > It should just work. Fortunately that's trivial to verify:

Standard Python 2.4 module like "crypt" for Windows?

2007-12-11 Thread dananrg
Is there a module available in the standard library, for Python 2.4 running on Windows, like "crypt" for Python 2.4 running on *nix machines? I need to store database passwords in a Python 2.4 script, but obviously don't want them in clear text. I'm looking for a reasonable level of security. Wha

  1   2   3   >