Portable (Linux/Mac/Win) way to get network interfaces names and their addresses?

2009-01-06 Thread Alessio Pace
Hi, I'm wondering how could I get, possibly in a pure Python solution, the list of network addresses on a machine and the IP address of each of them. In fact I came across recently on two solutions, one that is pure Python but that works only on Linux: # def all_inter

pg_result_status() alternative?

2009-01-06 Thread Qian Xu
Hi All, I am using the pg module (http://www.pygresql.org/pg.html) for database testing. I have got a problem now: I want to check the result status of postgresql database, which can be done in php by using pg_result_status() (http://www.phpbuilder.com/manual/en/function.pg-result-status.php) Ho

Re: What is ''r'' in python?

2009-01-06 Thread Gary Herron
Harish Vishwanath wrote: > Hello, > > I accidentally did this in the shell. > > >>> ''r'' > '' > >>> ''r'' == '' > True > >>> ''r'' == "" > True > > That is . However > if I try -> > > >>> ''c'' > File "", line 1 > ''c'' > ^ > SyntaxError: invalid syntax > >>> ''z'' > File "", line 1

Re: What is ''r'' in python?

2009-01-06 Thread Chris Rebert
On Tue, Jan 6, 2009 at 10:28 PM, Harish Vishwanath wrote: > Hello, > > I accidentally did this in the shell. > ''r'' > '' ''r'' == '' > True ''r'' == "" > True > > That is . However if I > try -> > ''c'' > File "", line 1 > ''c'' > ^ > SyntaxError: invalid syntax >>

Re: What is ''r'' in python?

2009-01-06 Thread Christopher Thunes
Hey Harish, Python automatically concatenates strings constants so this is actually '' then r'' which is the empty string followed by a 'raw' empty string. See here, http://docs.python.org/tutorial/introduction.html#strings. ''u'' and ''b'' will work for the same reason. - Chris Harish Vi

Re: Oh! The people of all over the world!

2009-01-06 Thread Mensanator
On Jan 6, 7:51�pm, "Obaid R." wrote: > On Jan 7, 2:53�am, Mensanator wrote: > > > But the OP isn't trying to get sympathy for the Isrealis, he's > > trying to get sympathy for his own cause. > > > Which is hard to do given the provocation that's resulting > > in Isreal's retalliation. > > > If th

What is ''r'' in python?

2009-01-06 Thread Harish Vishwanath
Hello, I accidentally did this in the shell. >>> ''r'' '' >>> ''r'' == '' True >>> ''r'' == "" True That is . However if I try -> >>> ''c'' File "", line 1 ''c'' ^ SyntaxError: invalid syntax >>> ''z'' File "", line 1 ''z'' ^ SyntaxError: invalid syntax Any other charac

Re: why cannot assign to function call

2009-01-06 Thread Steve Holden
Mark Wooding wrote: > Steven D'Aprano wrote: > >> The only tricky thing is that items 1, 2 and 3 can be inside two >> different boxes at the same time. There's no obvious real world analogy >> to that without the boxes being nested. This ability for objects to be in >> two places at once (or e

Re: If your were going to program a game...

2009-01-06 Thread alex23
On Jan 1, 9:37 pm, Tokyo Dan wrote: > If your were going to program a game in python what technologies would > you use? pyglet[1], pygame[2], or pycap[3]. > The game is a board game with some piece animations, but no movement > animation...think of a chess king exploding. The game runs in a > br

Re: message of Exception

2009-01-06 Thread Steven Woody
On Wed, Jan 7, 2009 at 12:02 PM, Terry Reedy wrote: > Steven Woody wrote: >> >> Hi, >> >> I am trying define an Exception as below: >> >> class MyError(Exception): >>def __init__(self, message): >>self.message = message >> >> And, I expect that when I raise a MyError as >>raise MyE

Re: why cannot assign to function call

2009-01-06 Thread Mark Wooding
ru...@yahoo.com wrote: > Is not the proper term "aliasing"? Perhaps Python "variables" should > be called "alises". No. The proper term is most definitely `binding': see SICP, for example. (Wikipedia has a link to the full text.) The topic of `aliasing' deals with a problem in compiler imple

Re: why cannot assign to function call

2009-01-06 Thread Mark Wooding
Steven D'Aprano wrote: > The only tricky thing is that items 1, 2 and 3 can be inside two > different boxes at the same time. There's no obvious real world analogy > to that without the boxes being nested. This ability for objects to be in > two places at once (or even to be inside themselves!

Re: message of Exception

2009-01-06 Thread Terry Reedy
Steven Woody wrote: Hi, I am trying define an Exception as below: class MyError(Exception): def __init__(self, message): self.message = message And, I expect that when I raise a MyError as raise MyError, "my message" In 2.x you may and in 3.0 you must write that as raise MyEr

Re: message of Exception

2009-01-06 Thread Steven Woody
On Wed, Jan 7, 2009 at 11:09 AM, Chris Rebert wrote: > On Tue, Jan 6, 2009 at 6:56 PM, Steven Woody wrote: >> Hi, >> >> I am trying define an Exception as below: >> >> class MyError(Exception): >>def __init__(self, message): >>self.message = message >> >> And, I expect that when I rai

Re: why cannot assign to function call

2009-01-06 Thread Mark Wooding
Steven D'Aprano wrote: > If I wanted a reference to a list, I'd expect to *dereference* the > reference to get to the list. That's not what Python forces you do to: > you just use the list as the list object itself. That's odd. No, you give a reference to the list to a function, and the funct

Re: why cannot assign to function call

2009-01-06 Thread rurpy
On Jan 6, 7:03 am, Mark Wooding wrote: ... > > It seems that you don't include in the Python community all those who > > use the term "name binding" instead of variable assignment > > specifically because it gives new users a clue that Python is not the > > same as C. > > Unfortunately, this pract

Re: message of Exception

2009-01-06 Thread Chris Rebert
On Tue, Jan 6, 2009 at 6:56 PM, Steven Woody wrote: > Hi, > > I am trying define an Exception as below: > > class MyError(Exception): >def __init__(self, message): >self.message = message > > And, I expect that when I raise a MyError as >raise MyError, "my message" > the python sho

ssl module - how can I accept SSLv3 and TLSv1 protocols only?

2009-01-06 Thread Giampaolo Rodola'
Hi, I'm trying to add TLS/SSL support to pyftpdlib. Since various defects have been found in the SSLv2 protocol many FTPS servers (i.e. proftpd and vsftpd) decided to support SSLv3 and TLSv1 only and sistematically reject any client attempting to use SSLv2. Is there a way to tell ssl.wrap_socket()

message of Exception

2009-01-06 Thread Steven Woody
Hi, I am trying define an Exception as below: class MyError(Exception): def __init__(self, message): self.message = message And, I expect that when I raise a MyError as raise MyError, "my message" the python should print a line such as MyError: my message But I did not get th

Re: why cannot assign to function call

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 13:43:01 -0800, Aaron Brady wrote: > I think one of the ideas we have trouble communicating is that [1, 2, 3] > and [4, 5, 6] can be the same object Not at the same time they can't. > (using '[:]='), but [1, 2, 3] and [1, 2, 3] don't have to be. I don't think this is hard

Re: Rich Comparisons Gotcha

2009-01-06 Thread Mark Wooding
Steven D'Aprano wrote: > To prove my claim, all you need is two domains with a mutually > incompatible definition of equality. That's not so difficult, surely? How > about equality of integers, versus equality of integers modulo some N? No, that's not an example. The integers modulo N form a

Re: python is great

2009-01-06 Thread Дамјан Георгиевски
>> And there are >> some things (such as Flash-style web applets) that you still can't do >> at all in Python, even after all these years. > > You're looking for Silverlight: > > http://www.voidspace.org.uk/ironpython/silverlight/index.shtml or clutter which has Python bindings http://www.clutte

Re: __builtin__ quote

2009-01-06 Thread Gabriel Genellina
En Tue, 06 Jan 2009 06:56:36 -0200, James Stroud escribió: Steven Woody wrote: On Tue, Jan 6, 2009 at 4:42 PM, James Stroud wrote: py> import __builtin__ py> __builtin__.abs is abs True Does that mean someone did 'import * from __builtin__' when python startup? In terms of the ex

Re: having problems with a multi-conditional while statement

2009-01-06 Thread bowman.jos...@gmail.com
Thanks for the assistance. I actually realized I was making things more complicated than they needed to be and I really only needed one condition to be met. On Jan 6, 7:42 pm, Ned Deily wrote: > In article > <40a44d6b-c638-464d-b166-ef66496a0...@l16g2000yqo.googlegroups.com>, > > > >  "bowman.jos

Re: why cannot assign to function call

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 14:32:04 +, Mark Wooding wrote: > Derek Martin wrote: > >> I think I have though, not that it matters, since that was never really >> my point. Python's assignment model requires more explanation than the >> traditional one, simply to state what it does. That alone is e

Re: cPickle vs pickle discrepancy

2009-01-06 Thread Gabriel Genellina
En Mon, 05 Jan 2009 23:04:30 -0200, Zac Burns escribió: I have a module that attempts to pickle classes defined in that module. I get an error of the form: PicklingError: Can't pickle : import of module Module.SubModule failed when using cPickle (protocol -1, python version 2.5.1). The module

Re: having problems with a multi-conditional while statement

2009-01-06 Thread Ned Deily
In article <40a44d6b-c638-464d-b166-ef66496a0...@l16g2000yqo.googlegroups.com>, "bowman.jos...@gmail.com" wrote: > Hi, > > I'm trying to write a multi-conditional while statement, and am having > problems. I've broken it down to this simple demo. > > #!/usr/bin/python2.5 > > condition1 = Fal

Re: having problems with a multi-conditional while statement

2009-01-06 Thread Philip Semanchuk
On Jan 6, 2009, at 7:18 PM, bowman.jos...@gmail.com wrote: Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2: pri

having problems with a multi-conditional while statement

2009-01-06 Thread bowman.jos...@gmail.com
Hi, I'm trying to write a multi-conditional while statement, and am having problems. I've broken it down to this simple demo. #!/usr/bin/python2.5 condition1 = False condition2 = False while not condition1 and not condition2: print 'conditions met' if condition1: condition2 = Tr

Re: Why not Ruby?

2009-01-06 Thread Gabriel Genellina
En Fri, 02 Jan 2009 15:00:01 -0200, r escribió: Steven i got you NOW! Everybody go and look at this thread, there Mr. Makinzie butts in and posts an off-topic question, and Steven answers it, contributing to the off-topicalitly of the thread. And has yet to apologize for it, or Does the word

Re: mod_python: delay in files changing after alteration

2009-01-06 Thread Graham Dumpleton
On Jan 6, 2:39 am, "psaff...@googlemail.com" wrote: > Maybe this is an apache question, in which case apologies. > > I am runningmod_python3.3.1-3 on apache 2.2.9-7. It works fine, but > I find that when I alter a source file during development, it > sometimes takes 5 seconds or so for the changes

Re: Code Review request for the trash-cli project

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 17:30:19 +0200, Dotan Cohen wrote: > I don't know about the code, but would there be a reason _not_ to alias > rm, rmdir to this program? I see that it is GPL, so this would be a > great addition to any Linux distro. I sure as hell don't want rm to move files to the trash. If

Re: why cannot assign to function call

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 14:03:16 +, Mark Wooding wrote: >> You've also missed out on probably twenty years of CS where Java (using >> the same assignment model as Python!) has been *the* language of choice >> for undergrad CS, not to mention those introductory courses which use >> Python. > > The

Re: Rich Comparisons Gotcha

2009-01-06 Thread Steven D'Aprano
On Tue, 06 Jan 2009 12:42:13 +, Mark Wooding wrote: > Steven D'Aprano wrote: > >> Such assumptions only hold under particular domains though. You can't >> assume equality is an equivalence relation once you start thinking >> about arbitrary domains. > > From a formal mathematical point of v

Re: socket send help

2009-01-06 Thread Gabriel Genellina
En Mon, 05 Jan 2009 22:59:46 -0200, James Mills escribió: On Tue, Jan 6, 2009 at 10:49 AM, Bryan Olson wrote: I thought a firewall would block an attempt to bind to any routeable address, but not to localhost. So using INADDR_ANY would be rejected. No. My understanding is that firewalls b

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 12:24 pm, J Kenneth King wrote: > Jonathan Gardner writes: > > On Jan 6, 8:18 am, sturlamolden wrote: > >> On Jan 6, 4:32 pm, mark wrote: > > >> > I want to implement a internal DSL in Python. I would like the syntax > >> > as human readable as possible. > > >> Also beware that Python

Re: Traceback in Logging

2009-01-06 Thread Thorsten Kampe
* Vinay Sajip (Tue, 6 Jan 2009 11:24:54 -0800 (PST)) > On Jan 6, 4:17 pm, Kottiyath wrote: > > I dont want the whole traceback. I just wanted to know where the log > > was generated from i.e. which procedure and which line. I have 3/4 > > points in many procedures where I encounter a small error (

RE: read pipe information on a running (popen) process

2009-01-06 Thread Jules Stevenson
> Which results in it printing (i think) the last line written to the > pipe > file. I'm thinking there must be a simpler way to access this > information. > Ideally I'd like to dump the whole lot to a string at periodic > intervals but > am completely stumped as to how to do this as readlines() an

Re: math module for Decimals

2009-01-06 Thread Fredrik Johansson
On Jan 6, 8:29 pm, Mark Dickinson wrote: > Note that it's still subject to the same limitations as anything > else for trig_function(really huge argument), of course: > > >>> import mpmath > >>> mpmath.cos(mpmath.mpf('1e9')) > > [... still waiting for a result 30 minutes later ...] > > (n

Re: How to get millisec/fractional seconds out of a time object ?

2009-01-06 Thread MRAB
da...@bag.python.org wrote: Thanks for help to a beginner. script23 import time import datetime start_time = datetime.datetime.now() time.sleep(0.14) end_time = datetime.datetime.now() datetime.timedelta = end_time - start_time You've just overwr

read pipe information on a running (popen) process

2009-01-06 Thread Jules Stevenson
Hi, I'm really struggling with how to read the stdout on a running process. All the examples I've seen tend to rely on waiting for the process to finish. The process I'm running takes a while and I need to get stdout [and stderr] and be able to pipe them into a string for displaying in a web app.

Re: How to get millisec/fractional seconds out of a time object ?

2009-01-06 Thread Chris Rebert
On Tue, Jan 6, 2009 at 1:34 PM, wrote: > Thanks for help to a beginner. > > script23 >import time >import datetime >start_time = datetime.datetime.now() >time.sleep(0.14) >end_time = datetime.datetime.now() >datetime.timedelta = end_time - start_tim

Re: How to get millisec/fractional seconds out of a time object ?

2009-01-06 Thread Scott David Daniels
David Lemper wrote: Thanks for help to a beginner. script23 ... datetime.timedelta = end_time - start_time This is a bad idea. You are changing the globals of another module. You are lucky you didn't break anything. Better would be: elapsed = end_time - start_time the

Re: why cannot assign to function call

2009-01-06 Thread Aaron Brady
On Jan 6, 8:03 am, Mark Wooding wrote: > Steven D'Aprano wrote: snip > > It seems that you don't include in the Python community all those who > > use the term "name binding" instead of variable assignment > > specifically because it gives new users a clue that Python is not the > > same as C. >

How to get millisec/fractional seconds out of a time object ?

2009-01-06 Thread David
Thanks for help to a beginner. script23 import time import datetime start_time = datetime.datetime.now() time.sleep(0.14) end_time = datetime.datetime.now() datetime.timedelta = end_time - start_time print(datetime.timedelta)# works, pri

Re: python is great

2009-01-06 Thread alex goretoy
> > I use Andrea Gavana's GUI2Exe to create my binaries. He recently added > a py2app wrapper to it. I don't have a Mac, so I haven't tested that > part of his app. However, the py2exe portion rocks! I put in the path > to my main Python executable, add any special 3rd party modules and it > just w

Re: [Twisted-web] ANN: Twisted 8.2 released

2009-01-06 Thread lasizoillo
2009/1/6 Christopher Armstrong : > Version 8.2 of Twisted is now out (actually, it's been out for over a > week now!). You can download it (in Windows, Mac, and source forms) > at: > >http://twistedmatrix.com/ This year is for 9.x version, isn't? A query to cheese shop returns 8.1 Version: h

Re: python is great

2009-01-06 Thread Mike Driscoll
On Jan 6, 2:24 pm, Joe Strout wrote: > M.-A. Lemburg wrote: > >> On the Mac in particular, if you want > >> your app to run on any PowerPC or Intel machine runing 10.4 or later, > >> and you're using anything not in the standard framework (such as > >> MySQLdb), it's a bit of a nightmare. > > > Y

Re: pep-8 vs. external interfaces?

2009-01-06 Thread Philip Semanchuk
On Jan 4, 2009, at 2:47 PM, Roy Smith wrote: I'm building a Python language wrapper to an network protocol which traditionally uses camelCase function names. I'm trying to make the new code pep-8 compliant, which means function names should be written this_way() instead of thisWay(). I've got

Re: [email/quoprimime.py] AttributeError: 'tuple' object has no attribute 'lstrip'

2009-01-06 Thread Gilles Ganault
On Mon, 05 Jan 2009 17:54:19 -0500, Terry Reedy wrote: >> for email in rows: >> To = email Thanks guys. Turns out email is a tuple, so here's how to extract the columns: for email in rows: email=email[0] -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread Steve Holden
J Kenneth King wrote: [...] > I could go on a really long rant about how the two are worlds apart, but > I'll let Google tell you if you're really interested. a) How is Google going to know if he's really interested? b) Put a space after the "--" in your sig, please; that way my mailer won't yto

[http] Example with proxy + post + cookie?

2009-01-06 Thread Gilles Ganault
Hello I need to write a script that goes out through a proxy, connects with a POST query, and receives a cookie for a Session ID. I didn't find an example on the Net that did it all three, but only some of the features. Does someone have one handy by any chance? Thank you. -- http://mail.python.

Re: subclassing 'list'

2009-01-06 Thread akineko
Hello Chris and James, Thank you for you guys' prompt response. Yes, that is what I wanted to do. I, somehow, didn't think of using those list methods. Instead, I was looking for a single method to override. Big Thanks! Aki- On Jan 6, 12:43 pm, "Chris Rebert" wrote: > If you mean you want to r

Re: python is great

2009-01-06 Thread M.-A. Lemburg
On 2009-01-06 21:24, Joe Strout wrote: > M.-A. Lemburg wrote: > >>> On the Mac in particular, if you want >>> your app to run on any PowerPC or Intel machine runing 10.4 or later, >>> and you're using anything not in the standard framework (such as >>> MySQLdb), it's a bit of a nightmare. >>> >> >

Re: subclassing 'list'

2009-01-06 Thread J. Cliff Dyer
On Tue, 2009-01-06 at 12:34 -0800, akineko wrote: > Hello everyone, > > I'm creating a class which is subclassed from list (Bulit-in type). > > It works great. > However, I'm having a hard time finding a way to set a new value to > the object (within the class). > There are methods that alter a

Re: python is great

2009-01-06 Thread Dotan Cohen
2009/1/6 Joe Strout : > No, I'm *using* py2app. I've been trying to use it for a couple of weeks > now, with the generous help of such people as Robin Dunn, and I still don't > have it quite working properly. (I'd be happy to send you my notes on what > was required to get as far as I've gotten,

Re: subclassing 'list'

2009-01-06 Thread James Stroud
akineko wrote: Hello everyone, I'm creating a class which is subclassed from list (Bulit-in type). It works great. However, I'm having a hard time finding a way to set a new value to the object (within the class). There are methods that alter a part of the object (ex. __setitem__()). But I coul

Re: subclassing 'list'

2009-01-06 Thread Chris Rebert
On Tue, Jan 6, 2009 at 12:34 PM, akineko wrote: > > Hello everyone, > > I'm creating a class which is subclassed from list (Bulit-in type). > > It works great. > However, I'm having a hard time finding a way to set a new value to > the object (within the class). > There are methods that alter a pa

Re: python is great

2009-01-06 Thread Benjamin Kaplan
On Tue, Jan 6, 2009 at 3:24 PM, Joe Strout wrote: > M.-A. Lemburg wrote: > > On the Mac in particular, if you want >>> your app to run on any PowerPC or Intel machine runing 10.4 or later, >>> and you're using anything not in the standard framework (such as >>> MySQLdb), it's a bit of a nightmar

subclassing 'list'

2009-01-06 Thread akineko
Hello everyone, I'm creating a class which is subclassed from list (Bulit-in type). It works great. However, I'm having a hard time finding a way to set a new value to the object (within the class). There are methods that alter a part of the object (ex. __setitem__()). But I couldn't find any met

Re: python is great

2009-01-06 Thread Joe Strout
M.-A. Lemburg wrote: On the Mac in particular, if you want your app to run on any PowerPC or Intel machine runing 10.4 or later, and you're using anything not in the standard framework (such as MySQLdb), it's a bit of a nightmare. You're looking for py2app: http://undefined.org/python/py2app

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread J Kenneth King
Jonathan Gardner writes: > On Jan 6, 8:18 am, sturlamolden wrote: >> On Jan 6, 4:32 pm, mark wrote: >> >> > I want to implement a internal DSL in Python. I would like the syntax >> > as human readable as possible. >> >> Also beware that Python is not Lisp. You cannot define new syntax (yes >> I

Re: python is great

2009-01-06 Thread r
On Jan 6, 11:36 am, Joe Strout wrote: > I've actually been rather frustrated by Python lately.  It's great at > some things, but rather poor at others.  In the latter category is > building a neatly packaged executable that can be shipped to users and > run reliably on their machine.  On the Mac i

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread M.-A. Lemburg
On 2009-01-06 20:42, Kay Schluehr wrote: >> How would one approach this in Python? Do I need to build a custom >> loader which compiles *.dsl files to *.pyc files? Is it possible to >> switch between the custom DSL and the standard Python interpreter? > Sure, but there is no way to avoid extending

Re: image recogniton?

2009-01-06 Thread J Kenneth King
Li Han writes: > Hi! I know little about the computer image processing, and now I have > a fancy problem which is how to read the time from the picture of a > clock by programming ? Is there anyone who can give me some > suggestions? > Thank! > Li Han I do work in object recognition, and I

ANN: Twisted 8.2 released

2009-01-06 Thread Christopher Armstrong
Version 8.2 of Twisted is now out (actually, it's been out for over a week now!). You can download it (in Windows, Mac, and source forms) at: http://twistedmatrix.com/ Twisted 8.2 is a major feature release, also including many important bug fixes: * twistd now has a --umask option for spec

Re: image recogniton?

2009-01-06 Thread Dotan Cohen
This was just mentioned on the KDE bugtracker: http://opencv.willowgarage.com/wiki/FaceDetection -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л

Re: parse/slice/...

2009-01-06 Thread Albert Hopkins
On Tue, 2009-01-06 at 11:23 -0800, rcmn wrote: > I'm not sure how to call it sorry for the subject description. >Here what i'm trying to accomplish. > the script i'm working on, take a submitted list (for line in file) > and generate thread for it. unfortunately winxp has a limit of 500 > threa

Re: python is great

2009-01-06 Thread M.-A. Lemburg
On 2009-01-06 18:36, Joe Strout wrote: > I've actually been rather frustrated by Python lately. It's great at > some things, but rather poor at others. In the latter category is > building a neatly packaged executable that can be shipped to users and > run reliably on their machine. On the Mac i

Re: Noob question: Is all this typecasting normal?

2009-01-06 Thread J Kenneth King
"Gabriel Genellina" writes: > En Mon, 05 Jan 2009 02:03:26 -0200, Roy Smith escribió: > > >> The other day, I came upon this gem. It's a bit of perl embedded in a >> Makefile; this makes it even more gnarly because all the $'s get >> doubled to >> hide them from make: >> >> define absmondir >>

Problem building Python 2.5.2 curses module on HP/UX 11.11

2009-01-06 Thread Mike Kent
I'm having a problem building the Python 2.5.2 curses module on HP/UX 11.11 using gcc 3.3.6, and was hoping someone had a solution. Compiling Modules/_cursesmodule.c is giving several warnings, but no errors. The relevant compile/link output is below. The key output line is: *** WARNING: renamin

Re: Code Review request for the trash-cli project

2009-01-06 Thread Andrea Francia
Dotan Cohen wrote: 2009/1/6 Andrea Francia : The trash-cli project is a opensource implementation of the FreeDesktop.org I don't know about the code, but would there be a reason _not_ to alias rm, rmdir to this program? Actually the trash-put command accept all the options of GNU rm in orde

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread Kay Schluehr
> How would one approach this in Python? Do I need to build a custom > loader which compiles *.dsl files to *.pyc files? Is it possible to > switch between the custom DSL and the standard Python interpreter? Sure, but there is no way to avoid extending the Python parser and then your DSL becomes e

Re: Python subprocess question

2009-01-06 Thread Roger
On Jan 6, 1:18 pm, s...@pobox.com wrote: >     Roger> .setDaemon(True) means the thread gets destroyed when the program >     Roger> exits and default .setDaemon(False) means that the thread >     Roger> continues to process even when the main program is gone? > > Approximately.  The main thread (a

Re: parse/slice/...

2009-01-06 Thread skip
rcmn> So I have to parse/slice the file by chunk of 500 and loop until rcmn> the list is done. I though i would of done it in no time but i rcmn> can't get started for some reason. Check the itertools module. Probably itertools.islice. -- Skip Montanaro - s...@pobox.com - http://sm

Re: math module for Decimals

2009-01-06 Thread Mark Dickinson
On Jan 6, 3:23 pm, Fredrik Johansson wrote: > FYI, mpmath (http://code.google.com/p/mpmath/) implements arbitrary- > precision standard transcendental functions in pure Python. It is much > faster than decimal, dmath, decimalfuncs and AJDecimalMathAdditions, > and handles huge arguments just fine.

Re: Traceback in Logging

2009-01-06 Thread Vinay Sajip
On Jan 6, 4:17 pm, Kottiyath wrote: > I dont want the whole traceback. I just wanted to know where the log > was generated from i.e. which procedure and which line. I have 3/4 > points in many procedures where I encounter a small error (not an > exception) and want to log it. So having individual

parse/slice/...

2009-01-06 Thread rcmn
I'm not sure how to call it sorry for the subject description. Here what i'm trying to accomplish. the script i'm working on, take a submitted list (for line in file) and generate thread for it. unfortunately winxp has a limit of 500 thread . So I have to parse/slice the file by chunk of 500 and

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:18 am, sturlamolden wrote: > On Jan 6, 4:32 pm, mark wrote: > > > I want to implement a internal DSL in Python. I would like the syntax > > as human readable as possible. > > Also beware that Python is not Lisp. You cannot define new syntax (yes > I've seen the goto joke). This isn't

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread Jonathan Gardner
On Jan 6, 8:13 am, sturlamolden wrote: > On Jan 6, 4:32 pm, mark wrote: > > > > Is it possible to > > switch between the custom DSL and the standard Python interpreter? > > > > - Write the DSL interpreter in Python. > There are Python modules out there that make writing a language interpreter al

Re: python is great

2009-01-06 Thread Dotan Cohen
2009/1/6 sturlamolden : > On Jan 6, 3:35 pm, "Dotan Cohen" wrote: >> 2009/1/3 Nomen Nescio : >> >> > python is great. >> >> No, those are anacondas. > > Unless Nomen Nescio is thinking of the giant serpent Python from greek > mythology. > The word "great" means large, as well as "doubleplusgood".

Re: python is great

2009-01-06 Thread J. Cliff Dyer
On Tue, 2009-01-06 at 10:36 -0700, Joe Strout wrote: > I've actually been rather frustrated by Python lately. OFF TOPIC!!! Please try to stay within the subject presented by the subject header. The subject in question is "python is great," not "python is frustrating." Speaking of which, python

Re: reading stdout from a running win32 process

2009-01-06 Thread sturlamolden
On Jan 6, 6:51 pm, "Jules Stevenson" wrote: > I don't seem to be able to read the 'out' at all? If I omit redirecting > stdout etc then the output displays fine in the console. You are redirecting to a file, not a pipe. Read the file from beginning to end after your process had finished. Or red

Re: python is great

2009-01-06 Thread sturlamolden
On Jan 6, 3:35 pm, "Dotan Cohen" wrote: > 2009/1/3 Nomen Nescio : > > > python is great. > > No, those are anacondas. Unless Nomen Nescio is thinking of the giant serpent Python from greek mythology. - Python lived in a cave near Delphi. CPython can be embedded in Delphi. - Python was made of s

Re: Python subprocess question

2009-01-06 Thread skip
Roger> .setDaemon(True) means the thread gets destroyed when the program Roger> exits and default .setDaemon(False) means that the thread Roger> continues to process even when the main program is gone? Approximately. The main thread (and thus the program) will exit only when all non-

Re: Python subprocess question

2009-01-06 Thread Roger
On Jan 6, 7:46 am, Duncan Booth wrote: > "Alexi Zuo" wrote: > > Hi everyone, > > > Here I have a simple program which starts a thread and the thread use > > Popen to execute a shell cmd which needs a long time.  I want to stop > > the thread once I type "ctrl+C" (KeyboardInterrupt). But in fact t

reading stdout from a running win32 process

2009-01-06 Thread Jules Stevenson
Hi list, I'm launching a process from windows using the demo 'winprocess' from the win32 extensions. I want to be able to record the output of the process as it runs and display it elsewhere. If I use the following [very bad] code: import winprocess import tempfile import time some_condition=Tru

Re: why cannot assign to function call

2009-01-06 Thread sturlamolden
On Jan 2, 11:39 am, Derek Martin wrote: > What the Python community often overlooks, when this discussion again > rears its ugly head (as it seems to every other hour or so), is that > its assignment model is BIZARRE, as in it's conceptually different > from virtually all other languages substant

Re: If your were going to program a game...

2009-01-06 Thread Joe Strout
Kay Schluehr wrote: There is no solution to this problem from a Python perspective. Do what everyone does right now: use Flash for the game and manage your site with Python if you like the language. I know this has been discussed before, and the difficulties are many, yadda yadda etc... But

Re: python is great

2009-01-06 Thread Joe Strout
I've actually been rather frustrated by Python lately. It's great at some things, but rather poor at others. In the latter category is building a neatly packaged executable that can be shipped to users and run reliably on their machine. On the Mac in particular, if you want your app to run o

Re: why cannot assign to function call

2009-01-06 Thread sturlamolden
On Jan 2, 5:43 pm, Steve Holden wrote: > Derek Martin wrote: > > On Tue, Dec 30, 2008 at 02:21:29PM +, John O'Hagan wrote: > [...] > > What the Python community often overlooks, when this discussion again > > rears its ugly head (as it seems to every other hour or so), is that > > its assignme

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Casey
On Jan 6, 11:46 am, Rob Williscroft wrote: > Matimus wrote in news:2a3d6700-85f0-4861-84c9-9f269791f044 > Searching (AKA googling) for: nonlocal site:bugs.python.org > leads to:http://bugs.python.org/issue4199 > > Rob. > --http://www.victim-prime.dsl.pipex.com/ Doh. I looked at the PEP and the 3

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Casey
On Jan 6, 11:10 am, Matimus wrote: > `nonlocal` should behave just like `global` does. It doesn't support > that syntax either. So, yes it was intentional. No, there probably is > no plan to support it in a later release. > > Matt >From my perspective, that's an unfortunate decision and I questi

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Rob Williscroft
Matimus wrote in news:2a3d6700-85f0-4861-84c9-9f269791f044 @f40g2000pri.googlegroups.com in comp.lang.python: > On Jan 6, 5:31 am, Casey wrote: >> In PEP 3104 the nonlocal statement was proposed and accepted for >> implementation in Python 3.0 for access to names in outer scopes.  The >> proposed

Re: Traceback in Logging

2009-01-06 Thread skip
Kottiyath> I dont want the whole traceback. I just wanted to know where Kottiyath> the log was generated from i.e. which procedure and which Kottiyath> line. The asyncore standard module has an undocumented compact_traceback() function: #!/usr/bin/env python import asyncore

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread sturlamolden
On Jan 6, 4:32 pm, mark wrote: > I want to implement a internal DSL in Python. I would like the syntax > as human readable as possible. Also beware that Python is not Lisp. You cannot define new syntax (yes I've seen the goto joke). -- http://mail.python.org/mailman/listinfo/python-list

Re: Traceback in Logging

2009-01-06 Thread Kottiyath
I dont want the whole traceback. I just wanted to know where the log was generated from i.e. which procedure and which line. I have 3/4 points in many procedures where I encounter a small error (not an exception) and want to log it. So having individual names for each looks to be somewhat verbose -

Re: looking for tips on how to implement "ruby-style" Domain Specific Language in Python

2009-01-06 Thread sturlamolden
On Jan 6, 4:32 pm, mark wrote: > Is it possible to > switch between the custom DSL and the standard Python interpreter? As far as I can tell, there are three different options: - Embed a Python and DSL interpreter in the same executable. - Write the DSL interpreter in Python. - Expose the DSL

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Matimus
On Jan 6, 5:31 am, Casey wrote: > In PEP 3104 the nonlocal statement was proposed and accepted for > implementation in Python 3.0 for access to names in outer scopes.  The > proposed syntax included an optional assignment or augmented > assignment to the outer name, such as: > > nonlocal x += 1 >

Re: why cannot assign to function call

2009-01-06 Thread Joe Strout
Mark Wooding wrote: Derek Martin wrote: I think I have though, not that it matters, since that was never really my point. Python's assignment model requires more explanation than the traditional one, simply to state what it does. That alone is evidence (but not proof). Hmm. Actually, it'

  1   2   >