Re: How to save python codes in files?

2007-06-14 Thread Gabriel Genellina
En Thu, 14 Jun 2007 01:56:13 -0300, why? [EMAIL PROTECTED] escribió: I tried but its not working. Here's a code for sum of two numbers. Now how do i save it? #! /usr/bin/env python ... def sum(x,y): ... return x+y ... x=int(raw_input('Enter a number: ')) Enter a number: 35

Re: dynamically generated runtime methods reflection

2007-06-14 Thread Josiah Carlson
Jay Loden wrote: Hi all, First, apologies if anyone gets this twice, but it took me quite a while to figure out that Python.org is evidently rejecting all mail from my mail server because I don't have reverse DNS configured. Anyway: I'm not even sure how to phrase this question properly

Re: Method much slower than function?

2007-06-14 Thread Bruno Desthuilliers
Neil Cerutti a écrit : (snip) class bar: def readgenome(self, filehandle): self.s = ''.join(line.strip() for line in filehandle) = self.s = ''.join(line.strip() for line in filehandle if not '' in line) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to format a string from an array?

2007-06-14 Thread Gerard Flanagan
On Jun 13, 11:11 am, Allen [EMAIL PROTECTED] wrote: a = range(256) I want to output the formated string to be: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f f0 f1 f2

Re: Windows XP timezone language issue

2007-06-14 Thread Paul Sijben
MRAB wrote: On Jun 13, 7:31 am, Paul Sijben [EMAIL PROTECTED] wrote: I ran into an internationalization issue. I need a consistent idea about the timezone my application is running on. However when I run the following: import time time.tzname I get back ('West-Europa (standaardtijd)',

Re: Method much slower than function?

2007-06-14 Thread Peter Otten
Gabriel Genellina wrote: En Thu, 14 Jun 2007 01:39:29 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: Gabriel Genellina wrote: In addition, += is rather inefficient for strings; the usual idiom is using ''.join(items) Ehh. Python 2.5 (and probably some earlier versions) optimize +=

Re: Method much slower than function?

2007-06-14 Thread Peter Otten
Leo Kislov wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. cProfile.run(bar.readgenome(open('cb_foo'))) 20004 function calls in 10.214

Re: Method much slower than function?

2007-06-14 Thread Francesco Guerrieri
On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: ... py print timeit.Timer(f2(), from __main__ import f2).repeat(number=1) [0.42673663831576358, 0.42807591467630662, 0.44401481193838876] py print timeit.Timer(f1(), from __main__ import f1).repeat(number=1)

for web application development

2007-06-14 Thread james_027
hi everyone, I am very new to python, I am almost done learning the python language enough that I can start learning developing web app in python. I have gone thru many research and I still say that I will want to develop web app in python. Although some says php should be better since the

Re: mapping subintervals

2007-06-14 Thread Lee Sander
Dear Matteo and Nis, Thankyou very much for your help. I wasn't aware of the bisect library but it's really useful. thank you both once again Lee On 13 Jun, 23:21, Nis Jørgensen [EMAIL PROTECTED] wrote: Matteo skrev: OK - I'm going to assume your intervals are inclusive (i.e. 34-51 contains

Re: for web application development

2007-06-14 Thread Giuseppe Di Martino
Il Thu, 14 Jun 2007 09:16:24 +, james_027 ha scritto: My problem is looking for a web framework for python, that could provide a natural way of developing web app. I am avoiding to learn template language as much as possible. Currently, i'm playing with Pylons (http://pylonshq.com) and

Re: for web application development

2007-06-14 Thread Benedict Verheyen
james_027 schreef: hi everyone, I am very new to python, I am almost done learning the python language enough that I can start learning developing web app in python. I have gone thru many research and I still say that I will want to develop web app in python. Although some says php should

Re: Goto

2007-06-14 Thread Hendrik van Rooyen
HMS Surprise [EMAIL PROTECTED] wrote: How does one effect a goto in python? I only want to use it for debug. I dasn't slap an if clause around the portion to dummy out, the indentation police will nab me. I use a global boolean called trace: if trace: do debug stuff But to try to

Re: SimplePrograms challenge

2007-06-14 Thread Steve Howell
--- Steven Bethard [EMAIL PROTECTED] wrote: unit.text) I posted a slight variant of this, trimmed down a bit to 21 lines. Thanks, I think this will be a very useful example. Pinpoint customers

Re: Method much slower than function?

2007-06-14 Thread Christof Winter
Gabriel Genellina wrote: [...] py import timeit py py def f1(): ... a= ... for i in xrange(10): ... a+=str(i)*20 ... py def f2(): ... a=[] ... for i in xrange(10): ... a.append(str(i)*20) ... a=.join(a) ... py print timeit.Timer(f2(), from __main__

Re: SimplePrograms challenge

2007-06-14 Thread rzed
Steven Bethard [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Steve Howell wrote: --- George Sakkis [EMAIL PROTECTED] wrote: from itertools import count, ifilter def sieve(): seq = count(2) while True: p = seq.next() seq = ifilter(p.__rmod__, seq)

Re: for web application development

2007-06-14 Thread Thomas Wittek
james_027: My problem is looking for a web framework for python, that could provide a natural way of developing web app. The three bigger Python web frameworks seem to be: - Django: http://www.djangoproject.com/ - TurboGears: http://www.turbogears.org/ - Pylons: http://pylonshq.com/ I only

Re: How can I capture all exceptions especially when os.system() fail? Thanks

2007-06-14 Thread Michael Hoffman
Gabriel Genellina wrote: En Wed, 13 Jun 2007 21:47:16 -0300, mike [EMAIL PROTECTED] escribió: Following piece of code can capture IOError when the file doesn't exist, also, other unknown exceptions can be captured when I press Ctrl-C while the program is sleeping(time.sleep). Now the

Professional Grant Proposal Writing Workshop (September 2007: Simon Fraser University)

2007-06-14 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be held at Simon Fraser University at Harbour Centre, September 12 - 14 , 2007. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand

IndentationError: unexpected indent

2007-06-14 Thread desktop
I have this class: class case(blop.case): def __init__(self, n, a, b): blop.case.__init__(self) print 'Monty Python's Flying Circus has a ' within it...' ... ... But I get an error when I run the .py script from shell saying: print 'Monty Python's Flying Circus has a

Re: IndentationError: unexpected indent

2007-06-14 Thread Wim Vogelaar
You have possibly unvisible tab characters in your file. Just copy your lines to the simple MS notepad and try again. Wim Vogelaar, http://home.wanadoo.nl/w.h.vogelaar/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IndentationError: unexpected indent

2007-06-14 Thread Laurent Pointal
desktop a écrit : I have this class: class case(blop.case): def __init__(self, n, a, b): blop.case.__init__(self) print 'Monty Python's Flying Circus has a ' within it...' ... ... But I get an error when I run the .py script from shell saying: print 'Monty

Re: for web application development

2007-06-14 Thread Laurent Pointal
james_027 a écrit : hi everyone, I am very new to python, I am almost done learning the python language enough that I can start learning developing web app in python. I have gone thru many research and I still say that I will want to develop web app in python. Although some says php should

Re: Cretins.

2007-06-14 Thread Laurent Pointal
Cousin Stanley a écrit : On Thu, 14 Jun 2007 09:32:10 +1000, Ben Finney wrote: Dr. Pastor [EMAIL PROTECTED] writes: Please do not do business with those cretins who without authorization attaching [spam footers] Indeed. The cost of Usenet access should not be translated to spam on

Re: Help with PAM and ctypes

2007-06-14 Thread Chris AtLee
On Jun 11, 6:01 pm, Lenard Lindstrom [EMAIL PROTECTED] wrote: [snip snip snip] if __name__ == __main__: import getpass, os, sys @conv_func def my_conv(nMessages, messages, pResponse, appData): # Create an array of nMessages response objects # Does r get

Re: Method much slower than function?

2007-06-14 Thread Neil Cerutti
On 2007-06-14, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Neil Cerutti a écrit : (snip) class bar: def readgenome(self, filehandle): self.s = ''.join(line.strip() for line in filehandle) = self.s = ''.join(line.strip() for line in filehandle if not '' in line)

Re: Convert String to Int and Arithmetic

2007-06-14 Thread Facundo Batista
tereglow wrote: cpuSpeed = 'Speed: 10' What I would like to do is extract the '10' from the string, and divide that by 1000 twice to get the speed of a processor in MHz. cpuSpeed = 'Speed: 10' p = cpuSpeed.split(:) p ['Speed', ' 10'] p[1] ' 10' v

Re: xmlrpclib hangs execution

2007-06-14 Thread itkovian
Hi, 2. The Python implementation ofxmlrpcis not very robust. It just waits for the connection to close. A well-written client (like your Java client) would detect the presence of a Content-Length header and use that. I'm facing a similar ordeal here. I think the right thing to do would be to

Re: xmlrpclib hangs execution

2007-06-14 Thread itkovian
On Jun 14, 3:10 pm, [EMAIL PROTECTED] wrote: Hi, 2. The Python implementation ofxmlrpcis not very robust. It just waits for the connection to close. A well-written client (like your Java client) would detect the presence of a Content-Length header and use that. I'm facing a similar

Re: How to save python codes in files?

2007-06-14 Thread BartlebyScrivener
On Jun 13, 12:04 am, why? [EMAIL PROTECTED] wrote: Im working with Python 2.2 on my red hat linux system. Is there any way to write python codes in separate files and save them so that i can view/edit them in the future? Actually I've just started with python and would be grateful for a

Re: Build EXE on Mac OsX 10.4

2007-06-14 Thread Paul McNett
Sherm Pendley wrote: Gabriel Genellina [EMAIL PROTECTED] writes: En Wed, 13 Jun 2007 17:35:19 -0300, Paul McNett [EMAIL PROTECTED] escribió: Tempo wrote: Has anyone sucesfully built a *.exe file on a mac operating system before from a *.py file? I have been trying to do this with

Re: Method much slower than function?

2007-06-14 Thread Grant Edwards
On 2007-06-14, Leo Kislov [EMAIL PROTECTED] wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. cProfile.run(bar.readgenome(open('cb_foo')))

Re: one-time initialization of class members

2007-06-14 Thread James Turk
On Jun 13, 11:42 pm, Steven Bethard [EMAIL PROTECTED] wrote: James Turk wrote: It actually occured to me that I could use a @classmethod to do the loading and take that out of the BaseClass constructor. What I have makes more sense and eliminates the unecessary constructors. ie.

Re: Python-URL! - weekly Python news and links (Jun 11)

2007-06-14 Thread Alex Martelli
Gabriel Genellina [EMAIL PROTECTED] wrote: QOTW: That's the Martellibot for you. Never use a word where a paragraph with explanatory footnotes will do. Sigh. I miss him on c.l.py. - Simon Brunning Funny -- didn't Simon write this in 2005 referring to an essay of mine that I had posted in

Re: Method much slower than function?

2007-06-14 Thread Matimus
The first time you read the file, it has to read it from disk. The second time, it's probably just reading from the buffer cache in RAM. I can verify this type of behavior when reading large files. Opening the file doesn't take long, but the first read will take a while (multiple seconds

Re: Method much slower than function?

2007-06-14 Thread Diez B. Roggisch
Grant Edwards schrieb: On 2007-06-14, Leo Kislov [EMAIL PROTECTED] wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function.

Re: for web application development

2007-06-14 Thread Evan Klitzke
On 6/14/07, james_027 [EMAIL PROTECTED] wrote: My problem is looking for a web framework for python, that could provide a natural way of developing web app. I am avoiding to learn template language as much as possible. You should definitely reconsider avoiding templates -- it's hard to imagine

Re: dynamically generated runtime methods reflection

2007-06-14 Thread Jay Loden
Josiah Carlson wrote: Ahh, so you want to pass the method name to the method that you are returning to be called. No problem. import functools class foo: ... def __getattr__(self, name): ... return functools.partial(self.ActualMethod, name) ... ... def

Moving items from list to list

2007-06-14 Thread HMS Surprise
Just wondered if there was some python idiom for moving a few items from one list to another. I often need to delete 2 or 3 items from one list and put them in another. Delete doesn't seem to have a return value. I don't care which items I get so now I just use a couple of pops or a for loop for

qt4 setFlags

2007-06-14 Thread luca72
Hello I make this code: row = self.tableWidget.rowCount() for a in range(row): self.tableWidget.item(row, 0).setFlags(Qt.IsSelectable) i have this erroror : global name Qt is not definied Regards Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Method much slower than function?

2007-06-14 Thread Peter Otten
Peter Otten wrote: Leo Kislov wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. cProfile.run(bar.readgenome(open('cb_foo'))) 20004

Re: Method much slower than function?

2007-06-14 Thread Chris Mellon
On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote: Peter Otten wrote: Leo Kislov wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function.

Re: In C extension .pyd, sizeof INT64 = 4?

2007-06-14 Thread Laurent Pointal
Allen wrote: On 6 13 , 11 55 , Martin v. Löwis [EMAIL PROTECTED] wrote: I used INT64 and initialize its value from PyArg_ParseTuple. The code is PyArg_ParseTuple(args, l, nValue). It should be PyArg_ParseTuple(args, L, nValue). That's still incorrect. For the L format flag, use

Re: Method much slower than function?

2007-06-14 Thread Steven D'Aprano
On Thu, 14 Jun 2007 00:40:12 +, idoerg wrote: cProfile.run(bar.readgenome(open('cb_foo'))) 20004 function calls in 10.214 CPU seconds This calls the method on the CLASS, instead of an instance. When I try it, I get this: TypeError: unbound method readgenome() must be called with

Re: Method much slower than function?

2007-06-14 Thread Grant Edwards
On 2007-06-14, Steven D'Aprano [EMAIL PROTECTED] wrote: However, having said that, the speed difference does seem to be real: even when I correct the above issue, I get a large time difference using either cProfile.run() or profile.run(), and timeit agrees: f = bar().readgenome

Re: Moving items from list to list

2007-06-14 Thread Evan Klitzke
On 6/14/07, HMS Surprise [EMAIL PROTECTED] wrote: Just wondered if there was some python idiom for moving a few items from one list to another. I often need to delete 2 or 3 items from one list and put them in another. Delete doesn't seem to have a return value. I don't care which items I get

OS X install confusion

2007-06-14 Thread John Fisher
Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open a bash terminal session and type python, it brings up version 2.3.5. If I type IDLE it brings up version 2.4.4. My question: what

Re: Is there any way to catch expections when call python method in C++

2007-06-14 Thread Gabriel Genellina
En Wed, 13 Jun 2007 12:03:00 -0300, Robert Bauck Hamar [EMAIL PROTECTED] escribió: Allen wrote: I use try catch, but cannot catch the execeptions of execution python method. No. CPython is written in C, not C++, and C has no concept of exceptions. Exceptions in Python is usually

FTP Date Format Function

2007-06-14 Thread samuraisam
FTP LST/LIST/NLST date field formatting function for all those seekers out there... import time import datetime def ftpdateformat(value): Formats dates from most FTP servers if : in value: # within 6 months return datetime.datetime( *time.strptime( # have to guess

Re: Method much slower than function?

2007-06-14 Thread Steven D'Aprano
On Thu, 14 Jun 2007 00:40:12 +, idoerg wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. After further testing, I think I have found the cause of the speed difference -- and it isn't that

Re: OS X install confusion

2007-06-14 Thread Kevin Walzer
John Fisher wrote: Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open a bash terminal session and type python, it brings up version 2.3.5. If I type IDLE it brings up

Re: Method much slower than function?

2007-06-14 Thread Peter Otten
Chris Mellon wrote: On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote: Peter Otten wrote: Leo Kislov wrote: On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a

Re: OS X install confusion

2007-06-14 Thread Ted
On Jun 14, 1:31 pm, Kevin Walzer [EMAIL PROTECTED] wrote: John Fisher wrote: Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open a bash terminal session and type python, it

lagrange multipliers in python

2007-06-14 Thread [EMAIL PROTECTED]
Hi all, Sorry for the cross-posting. I'm trying to find the minimum of a multivariate function F(x1, x2, ..., xn) subject to multiple constraints G1(x1, x2, ..., xn) = 0, G2(...) = 0, ..., Gm(...) = 0. The conventional way is to construct a dummy function Q, $$Q(X, \Lambda) = F(X) + \lambda_1

Re: qt4 setFlags

2007-06-14 Thread Diez B. Roggisch
luca72 schrieb: Hello I make this code: row = self.tableWidget.rowCount() for a in range(row): self.tableWidget.item(row, 0).setFlags(Qt.IsSelectable) i have this erroror : global name Qt is not definied import Qt might help. And reading the python tutorial. Diez

Re: Method much slower than function?

2007-06-14 Thread [EMAIL PROTECTED]
On Jun 14, 1:12 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 14 Jun 2007 01:39:29 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: Gabriel Genellina wrote: In addition, += is rather inefficient for strings; the usual idiom is using ''.join(items) Ehh. Python 2.5 (and

Re: SimplePrograms challenge

2007-06-14 Thread Steven Bethard
rzed wrote: Steven Bethard [EMAIL PROTECTED] wrote in def iter_primes(): # an iterator of all numbers between 2 and +infinity numbers = itertools.count(2) # generate primes forever while True # generate the first number from the iterator, # which

Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread py_genetic
Hi, I'm looking to generate x alphabetic strings in a list size x. This is exactly the same output that the unix command split generates as default file name output when splitting large files. Example: produce x original, but not random strings from english alphabet, all lowercase. The length

Re: Method much slower than function?

2007-06-14 Thread [EMAIL PROTECTED]
On Jun 14, 1:10 am, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: take virtually the same amount of time on my machine (2.5), and the non-join version is clearer, IMO. I'd still use join in case I wind up running under an older Python, but it's

Re: How can I capture all exceptions especially when os.system() fail? Thanks

2007-06-14 Thread mike
On Jun 14, 2:55 am, Michael Hoffman [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: En Wed, 13 Jun 2007 21:47:16 -0300, mike [EMAIL PROTECTED] escribió: Following piece of code can capture IOError when the file doesn't exist, also, other unknown exceptions can be captured when I press

Re: save class

2007-06-14 Thread nik
On Jun 13, 10:04 pm, Josiah Carlson [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: En Wed, 13 Jun 2007 23:11:22 -0300, nik [EMAIL PROTECTED] escribió: It would seem that I want to actually save the source code for the class. I know that I could of course open up an editor and just make

Re: dynamically generated runtime methods reflection

2007-06-14 Thread Josiah Carlson
Jay Loden wrote: Josiah Carlson wrote: Ahh, so you want to pass the method name to the method that you are returning to be called. No problem. import functools class foo: ... def __getattr__(self, name): ... return functools.partial(self.ActualMethod, name) ... ...

Re: Method much slower than function?

2007-06-14 Thread Josiah Carlson
[EMAIL PROTECTED] wrote: On Jun 14, 1:10 am, Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: take virtually the same amount of time on my machine (2.5), and the non-join version is clearer, IMO. I'd still use join in case I wind up running under an

Re: Moving items from list to list

2007-06-14 Thread HMS Surprise
Thanks. That will work. The 2nd, smaller lst starts out empty but this is easily adapted. jh -- http://mail.python.org/mailman/listinfo/python-list

Re: Method much slower than function?

2007-06-14 Thread Josiah Carlson
Francesco Guerrieri wrote: On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: ... py print timeit.Timer(f2(), from __main__ import f2).repeat(number=1) [0.42673663831576358, 0.42807591467630662, 0.44401481193838876] py print timeit.Timer(f1(), from __main__

a_list.count(a_callable) ?

2007-06-14 Thread Ping
Hi, I'm wondering if it is useful to extend the count() method of a list to accept a callable object? What it does should be quite intuitive: count the number of items that the callable returns True or anything logically equivalent (non-empty sequence, non-zero number, etc). This would return

Re: Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread [EMAIL PROTECTED]
On Jun 14, 1:41 pm, py_genetic [EMAIL PROTECTED] wrote: Hi, I'm looking to generate x alphabetic strings in a list size x. This is exactly the same output that the unix command split generates as default file name output when splitting large files. Example: produce x original, but not

Re: Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread Rob Wolfe
py_genetic [EMAIL PROTECTED] writes: Hi, I'm looking to generate x alphabetic strings in a list size x. This is exactly the same output that the unix command split generates as default file name output when splitting large files. Example: produce x original, but not random strings from

Convert to C/C++?

2007-06-14 Thread SpreadTooThin
I am wondering if someone who knows the implemention of python's time could help converting this to c/c++ nanoseconds = int(time.time() * 1e9) # 0x01b21dd213814000 is the number of 100-ns intervals between the # UUID epoch 1582-10-15 00:00:00

Re: Moving items from list to list

2007-06-14 Thread George Sakkis
On Jun 14, 12:30 pm, HMS Surprise [EMAIL PROTECTED] wrote: Just wondered if there was some python idiom for moving a few items from one list to another. I often need to delete 2 or 3 items from one list and put them in another. Delete doesn't seem to have a return value. I don't care which

Proper licensing and copyright attribution for extracted Python code

2007-06-14 Thread Douglas Alan
Hi. I extracted getpath.c out of Python and modified it to make a generally useful facility for C and C++ programming. These comments are at the top of my .c file, and I would like to know if they pass muster for meeting licensing, copyright, and aesthetics requirements: // -*- Mode: C;

python i2c ioctl

2007-06-14 Thread luca
Hi, I was trying to make to work directly l i2c with python with the calls ioctl. But I have of the problems and I do not succeed to go ahead. this and l error [EMAIL PROTECTED] /usr/local/wrap]129# python pcf8591_ioctl.py Reading from 4 ch 8 bit A/D converter PCF8591 Traceback (most recent

os.path.normpath bug?

2007-06-14 Thread billiejoex
Hi there, I've noticed that os.path.normpath does not collapse redundant separators if they're located at the beginning of the string: print os.path.normpath('/a//b//c') \a\b\c print os.path.normpath('//a//b//c') \\a\b\c Is it intentional or is it a bug? --

Re: os.path.normpath bug?

2007-06-14 Thread Michael Hoffman
billiejoex wrote: Hi there, I've noticed that os.path.normpath does not collapse redundant separators if they're located at the beginning of the string: print os.path.normpath('/a//b//c') \a\b\c print os.path.normpath('//a//b//c') \\a\b\c Is it intentional or is it a bug? Intentional.

Re: a_list.count(a_callable) ?

2007-06-14 Thread Dustan
On Jun 14, 2:53 pm, Ping [EMAIL PROTECTED] wrote: Hi, I'm wondering if it is useful to extend the count() method of a list to accept a callable object? What it does should be quite intuitive: count the number of items that the callable returns True or anything logically equivalent

Serialization across languages?

2007-06-14 Thread Tobiah
I want to do SOAP like calls from a device who's libraries don't include SOAP. I'm thinking of using simple HTTP posts, but I'm going to want to send arrays and hashes. First, what do I need to be aware of when sending arbitrary data by a POST, and Second, is there a universally supported

Re: a_list.count(a_callable) ?

2007-06-14 Thread Dustan
On Jun 14, 3:37 pm, Dustan [EMAIL PROTECTED] wrote: map and filter are basically obsolete after the introduction of list comprehensions It is probably worth noting that list comprehensions do not require that you write a new function; they take any expression where appropriate. For more

Questions about mathematical and statistical functionality in Python

2007-06-14 Thread Talbot Katz
Greetings Pythoners! I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical computing and graphics. R is designed with matrix manipulation in mind, and it's very easy to do

Re: Serialization across languages?

2007-06-14 Thread Martin v. Löwis
First, what do I need to be aware of when sending arbitrary data by a POST, and Second, is there a universally supported version of what python can do with pickle? I mostly need python and PHP, but perl would be nice too. You might want to use WDDX. There are WDDX libraries for Python, PHP,

Re: os.path.normpath bug?

2007-06-14 Thread billiejoex
On 14 Giu, 22:35, Michael Hoffman [EMAIL PROTECTED] wrote: Intentional. http://en.wikipedia.org/wiki/Path_(computing)#Universal_Naming_Conven... -- Michael Hoffman Got it. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: a_list.count(a_callable) ?

2007-06-14 Thread Dustan
On Jun 14, 3:37 pm, Dustan [EMAIL PROTECTED] wrote: Which can then be converted into a generator expression (round brackets instead of square brackets) to avoid the intermediate list: len((i for i in a_list if a_callable(i))) Sorry for the excess of posts everybody. I just realized that the

Re: a_list.count(a_callable) ?

2007-06-14 Thread Carsten Haese
On Thu, 2007-06-14 at 21:06 +, Dustan wrote: On Jun 14, 3:37 pm, Dustan [EMAIL PROTECTED] wrote: Which can then be converted into a generator expression (round brackets instead of square brackets) to avoid the intermediate list: len((i for i in a_list if a_callable(i))) Sorry for the

Re: Questions about mathematical and statistical functionality in Python

2007-06-14 Thread kyosohma
On Jun 14, 4:02 pm, Talbot Katz [EMAIL PROTECTED] wrote: Greetings Pythoners! I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical computing and graphics. R is designed with

Re: a_list.count(a_callable) ?

2007-06-14 Thread Carsten Haese
On Thu, 2007-06-14 at 12:53 -0700, Ping wrote: Hi, I'm wondering if it is useful to extend the count() method of a list to accept a callable object? What it does should be quite intuitive: count the number of items that the callable returns True or anything logically equivalent (non-empty

Re: MS Word parser

2007-06-14 Thread Ben C
On 2007-06-13, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jun 13, 1:28 am, Tim Golden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi all, I'm currently using antiword to extract content from MS Word files. Is there another way to do this without relying on any command prompt

Re: Questions about mathematical and statistical functionality in Python

2007-06-14 Thread Michael Hoffman
Talbot Katz wrote: I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical computing and graphics. R is designed with matrix manipulation in mind, and it's very easy to do

Re: Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread py_genetic
You didn't try hard enough. :) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 -- HTH, Rob Thanks Rob, permutation was the keyword I shcould have used! -- http://mail.python.org/mailman/listinfo/python-list

RE: Questions about mathematical and statistical functionality in Python

2007-06-14 Thread John Krukoff
On Jun 14, 4:02 pm, Talbot Katz [EMAIL PROTECTED] wrote: Greetings Pythoners! I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical computing and graphics. R is designed

Re: Questions about mathematical and statistical functionality in Python

2007-06-14 Thread Tim Churches
Michael Hoffman wrote: Talbot Katz wrote: I hope you'll indulge an ignorant outsider. I work at a financial software firm, and the tool I currently use for my research is R, a software environment for statistical computing and graphics. R is designed with matrix manipulation in mind,

Re: Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread [EMAIL PROTECTED]
On Jun 14, 3:08 pm, Rob Wolfe [EMAIL PROTECTED] wrote: py_genetic [EMAIL PROTECTED] writes: Hi, I'm looking to generate x alphabetic strings in a list size x. This is exactly the same output that the unix command split generates as default file name output when splitting large files.

Re: Efficient way of generating original alphabetic strings like unix file split

2007-06-14 Thread [EMAIL PROTECTED]
On Jun 14, 4:39 pm, py_genetic [EMAIL PROTECTED] wrote: You didn't try hard enough. :) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465 -- HTH, Rob Thanks Rob, permutation was the keyword I shcould have used! See my other post to see if that is indeed what you mean. --

Re: Method much slower than function?

2007-06-14 Thread Gabriel Genellina
En Thu, 14 Jun 2007 05:54:25 -0300, Francesco Guerrieri [EMAIL PROTECTED] escribió: On 6/14/07, Peter Otten [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: ... py print timeit.Timer(f2(), from __main__ import f2).repeat(number=1) [0.42673663831576358, 0.42807591467630662,

Failing on string exceptions in 2.4

2007-06-14 Thread Stephen R Laniel
Reading the Python docs, it looks like string exceptions will be a DeprecationWarning in Python 2.5. Is there any way to make them so in 2.4? Now how about if I want to turn all DeprecationWarnings into compile-time errors? Is there some way to do this? End goal being that string exceptions would

Re: Moving items from list to list

2007-06-14 Thread Gabriel Genellina
En Thu, 14 Jun 2007 14:23:14 -0300, Evan Klitzke [EMAIL PROTECTED] escribió: On 6/14/07, HMS Surprise [EMAIL PROTECTED] wrote: Just wondered if there was some python idiom for moving a few items from one list to another. I often need to delete 2 or 3 items from one list and put them in

Re: save class

2007-06-14 Thread Gabriel Genellina
En Thu, 14 Jun 2007 16:05:14 -0300, nik [EMAIL PROTECTED] escribió: On Jun 13, 10:04 pm, Josiah Carlson [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: En Wed, 13 Jun 2007 23:11:22 -0300, nik [EMAIL PROTECTED] escribió: It would seem that I want to actually save the source code for the

Re: OS X install confusion

2007-06-14 Thread John Fisher
Ted [EMAIL PROTECTED] wrote: On Jun 14, 1:31 pm, Kevin Walzer [EMAIL PROTECTED] wrote: John Fisher wrote: Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open a

Re: OS X install confusion

2007-06-14 Thread Paul McNett
John Fisher wrote: Ted [EMAIL PROTECTED] wrote: On Jun 14, 1:31 pm, Kevin Walzer [EMAIL PROTECTED] wrote: John Fisher wrote: Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open

poking around a running program

2007-06-14 Thread Paul Rubin
I have a long-running program that has lots of net connections open on separate threads. I'm twiddling my thumbs waiting for it to finish (each run takes maybe an hour) and although I'm logging various info that I can monitor as the run progresses, it would be cool to be able to actually poke

Re: OS X install confusion

2007-06-14 Thread 7stud
On Jun 14, 11:21 am, [EMAIL PROTECTED] (John Fisher) wrote: Hi Groupies, I have an Intel Macbook running OS X 10.4. It came installed with Python 2.3.5. I have since installed MacPython with version 2.4.4, cool. When I open a bash terminal session and type python, it brings up version

Problems with regular expressions

2007-06-14 Thread Carlos Luis Pérez Alonso
I have the next piece of code: if re.search('^(taskid|bugid):\\d+',logMessage): return 0 else: sys.stderr.write(El comentario tiene que contener el taskid: o el bugid:) return

  1   2   >