Re: Object Reference question

2009-08-20 Thread Hendrik van Rooyen
On Friday 21 August 2009 08:07:18 josef wrote: > My main focus of this post is: "How do I find and use object reference > memory locations?" >>> a = [1,2,3,4] >>> id(a) 8347088 >>> - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: #elements of seq A in seq B

2009-08-20 Thread Raymond Hettinger
On Aug 19, 4:19 pm, Neal Becker wrote: > What would be a time efficient way to count the number of occurrences of > elements of sequence A in sequence B?  (in this particular case, these > sequences are strings, if that matters). Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit

Re: #elements of seq A in seq B

2009-08-20 Thread Raymond Hettinger
On Aug 19, 4:19 pm, Neal Becker wrote: > What would be a time efficient way to count the number of occurrences of > elements of sequence A in sequence B?  (in this particular case, these > sequences are strings, if that matters). Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit

Re: Object Reference question

2009-08-20 Thread Chris Rebert
On Thu, Aug 20, 2009 at 11:34 PM, Miles Kaufmann wrote: > On Aug 20, 2009, at 11:07 PM, josef wrote: >> The following is what I would like to do: >> I have a list of class instances dk = [ a, b, c, d ], where a, b, c, d >> is an object reference. Entering dk gives me the object: [MyClass0 >> insta

Re: Object Reference question

2009-08-20 Thread Miles Kaufmann
On Aug 20, 2009, at 11:07 PM, josef wrote: To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a "Pass By Object Reference" model. x = 1 x becomes the object reference, while an object is created with the typ

Re: Waiting for a subprocess to exit

2009-08-20 Thread Miles Kaufmann
On Aug 20, 2009, at 10:13 PM, Ben Finney wrote: The module documentation has a section on replacing ‘os.system’ , which says to use:: process = subprocess.Popen("mycmd" + " myarg", shell=True) status = os.waitpid(process.pid, 0

Object Reference question

2009-08-20 Thread josef
To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a "Pass By Object Reference" model. x = 1 x becomes the object reference, while an object is created with the type 'int', value 1, and identifier (id(x)). Doin

Re: install package in a particular python version

2009-08-20 Thread Ben Finney
Steve1234 writes: > I installed the boto module in my Ubuntu system using "python setup.py > install" and it installs in my python2.6 version and works great. That's because your ‘python’ command is doing the same thing as if you'd typed:: $ python2.6 setup.py install The Python 2.6 interp

Re: 2.6 windows install

2009-08-20 Thread alex23
"Tim Arnold" wrote: > Any ideas on what I'm missing here? Most likely the required configuration of the local environments. Did you install Python to the network device from your XP box? That would explain why you can run it: the required registry settings & environment variables are added by th

Waiting for a subprocess to exit

2009-08-20 Thread Ben Finney
Howdy all, I'm looking to replace some usages of ‘os.system’ with the more secure ‘subprocess.Popen’ methods. The module documentation has a section on replacing ‘os.system’ , which says to use:: process = subprocess.Popen("mycmd

2.6 windows install

2009-08-20 Thread Tim Arnold
Hi, I installed python2.6 to a netapp device. I can use it from my local windows machine (XP). But others cannot use it from their pcs. They get this response "The system cannot execute the specified program.". If they double click on python.exe, they get a window with: This application has fai

Re: install package in a particular python version

2009-08-20 Thread Steve1234
Benjamin suggested: sudo python2.5 setup.py install and it works. This makes sense, thanks. I downloaded pythonpkgmgr from source and installed it. I got the error that reguired wx package was missing. I couldn't find this package for Linux or source. -- http://mail.python.org/mailman/listinfo

Re: IDLE is not as interactive as Maple

2009-08-20 Thread laser
Thanks very much for your information. Reinteract looks like exactly what I want. It give me the similary feeling of using Maple. I like this kind of programming style. People who did not have this experience really should take a try. On 8月20日, 下午9时11分, André wrote: > On Aug 20, 12:22 am, laser

Re: How to create functors?

2009-08-20 Thread Charles Yeomans
On Aug 20, 2009, at 5:25 AM, Steven D'Aprano wrote: On Thu, 20 Aug 2009 01:36:14 -0700, Paul Rubin wrote: Steven D'Aprano writes: As near as I can tell, a functor is just an object which is callable like a function without actually being implemented as a function, e.g.: No it's not anyt

Re: #elements of seq A in seq B

2009-08-20 Thread Jan Kaliszewski
a = set(a) n = sum(item in a for item in b) Why set? Does it matter if I say that items in A are already unique? Sets are hash-based, so it's (most probably) far more efficient for sets than for sequences (especially if we say about big/long ones). Regards, *j -- Jan Kaliszewski

Re: install package in a particular python version

2009-08-20 Thread David Lyon
On Thu, 20 Aug 2009 17:57:53 -0700 (PDT), Steve1234 wrote: > I installed the boto module in my Ubuntu system using "python setup.py > install" and it installs in my python2.6 version and works great. Now > I want to install boto into my python2.5 version because my hosting > services supports 2.5

Re: install package in a particular python version

2009-08-20 Thread Benjamin Kaplan
whoops, sent it to you instead of the list On Thu, Aug 20, 2009 at 9:05 PM, Benjamin Kaplan wrote: > On Thu, Aug 20, 2009 at 8:57 PM, Steve1234 wrote: >> >> I installed the boto module in my Ubuntu system using "python setup.py >> install" and it installs in my python2.6 version and works great.  

Re: platform-specific overrides of functions and class methods (expanding on imputils demo code)

2009-08-20 Thread Aahz
In article <77715735-2668-43e7-95da-c91d175b3...@z31g2000yqd.googlegroups.com>, lkcl wrote: > >if somebody would like to add this to the python bugtracker, as a >contribution, that would be great. alternatively, you might like to >have a word with the python developers to get them to remove the

install package in a particular python version

2009-08-20 Thread Steve1234
I installed the boto module in my Ubuntu system using "python setup.py install" and it installs in my python2.6 version and works great. Now I want to install boto into my python2.5 version because my hosting services supports 2.5 but not 2.6. and I want to test my code locally, "sting".format()

Re: Silly question

2009-08-20 Thread John Machin
On Aug 21, 5:33 am, David C Ullrich wrote: > So I'm slow, fine. (There were several times when I was using 1.5.3 > and wished they were there - transposing matrices, etc.) 1.5.THREE ?? -- http://mail.python.org/mailman/listinfo/python-list

Python on Crays

2009-08-20 Thread Carrie Farberow
I am trying to build a statically-linked Python based on directions at: http://yt.enzotools.org/wiki/CrayXT5Installation I have tried this on multiple systems. The first time I attempt to build python, 'make' runs fine but 'make install' fails with the following error: Sorry: UnicodeError: ("\

Re: Annoying octal notation

2009-08-20 Thread James Harris
On 20 Aug, 20:06, David <71da...@libero.it> wrote: > Hi all, > > Is there some magic to make the 2.x CPython interpreter to ignore the > annoying octal notation? > I'd really like 012 to be "12" and not "10". This is (IMHO) a sad hangover from C (which took it from B but not from BCPL which used

Re: Silly question

2009-08-20 Thread Aahz
In article , Benjamin Kaplan wrote: >On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich wrot= >e: >> >> I just noticed that >> sequence[i:j:k] > >Well, I got some good news and some bad news. According to the docs, >it existed in 1.4 but the built-in sequences didn't support it until >2.3. It's not

Re: #elements of seq A in seq B

2009-08-20 Thread Jan Kaliszewski
20-08-2009 o 13:01:29 Neal Becker wrote: I meant #occurrences of characters from the set A in string B But: 1) separately for each element of A? (see Simon's sollution with defaultdict) 2) or total number of all occurrences of elements of A? (see below) 20-08-2009 o 14:05:12 Peter Otten <

Re: #elements of seq A in seq B

2009-08-20 Thread Jan Kaliszewski
20-08-2009 o 04:12:14 Simon Forman wrote: If you want to know the count for each element you can use this: from collections import defaultdict def g(a, b): a = set(a) d = defaultdict(int) for item in b: if item in a: d[item] += 1 return d print g(A, B) #

Re: thread and win32com.client problem

2009-08-20 Thread Martin P. Hellwig
Christian Heimes wrote: Ray wrote: I already find the way to fix it. :-) I consider it good style when people describe their solution to a problem, too. Other Python users may run into the same issue someday. :) Christian He probably used: pythoncom.CoInitialize() -- MPH http://blog.dcu

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Dave Angel
Matthias Güntert wrote: Hello guys I would like to read a hex number from an ASCII file, increment it and write it back. How can this be performed? I have tried several approaches: my file serial.txt contains: 0C -- f = open('serial.txt', 'r') val = f.read

Re: Annoying octal notation

2009-08-20 Thread Mensanator
On Aug 20, 2:06 pm, David <71da...@libero.it> wrote: > Hi all, > > Is there some magic to make the 2.x CPython interpreter to ignore the > annoying octal notation? > I'd really like 012 to be "12" and not "10". Use 3.1: >>> int('012') 12 (Just kidding! That works in 2.5 also. How are you using

Re: ncurses getch & unicode (was: decoding keyboard input when using curses)

2009-08-20 Thread Iñigo Serna
Hi again, 2009/8/20 Iñigo Serna > > I have the same problem mentioned in > http://groups.google.com/group/comp.lang.python/browse_thread/thread/c70c80cd9bc7bac6?pli=1 > some months ago. > > Python 2.6 program which uses ncurses module in a terminal configured to use > UTF-8 encoding. > > When

Re: Executing untrusted code

2009-08-20 Thread Emanuele D'Arrigo
Christian, Rami and Steven, thank you all for your help. It wasn't meant to be a challenge, I knew it ought to be easily breakable. I'm no hacker and it just helps to have some examples to better understand the issue. On Aug 20, 7:42 pm, Steven D'Aprano On a related topic, you should read this po

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Rami Chowdhury
Of course - my apologies, I was being an idiot. On Thu, 20 Aug 2009 14:38:08 -0700, Simon Forman wrote: On Aug 20, 5:18 pm, "Rami Chowdhury" wrote: > val = val.encode('hex') That's the crucial line -- it's returning a new integer, which you are   re-binding to val. If you then did: No,

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Ethan Furman
[fixed top-posting] Rami Chowdhury wrote: On Thu, 20 Aug 2009 14:08:34 -0700, Matthias Güntert wrote: Hello guys I would like to read a hex number from an ASCII file, increment it and write it back. How can this be performed? I have tried several approaches: my file serial.txt contains:

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Simon Forman
On Aug 20, 5:18 pm, "Rami Chowdhury" wrote: > > val = val.encode('hex') > > That's the crucial line -- it's returning a new integer, which you are   > re-binding to val. If you then did: No, it returns another string, which still isn't the decimal representation of the hex string. hex C => decim

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Simon Forman
On Aug 20, 5:08 pm, Matthias Güntert wrote: > Hello guys > > I would like to read a hex number from an ASCII file, increment it and > write it back. > How can this be performed? > > I have tried several approaches: > > my file serial.txt contains: 0C > > -- > f = op

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Mark Lawrence
Matthias Güntert wrote: Hello guys I would like to read a hex number from an ASCII file, increment it and write it back. How can this be performed? I have tried several approaches: my file serial.txt contains: 0C -- f = open('serial.txt', 'r') val = f.read

Re: incrementing string/hex value from file and write back

2009-08-20 Thread Rami Chowdhury
val = val.encode('hex') That's the crucial line -- it's returning a new integer, which you are re-binding to val. If you then did: val = val + 1 you'd be fine, and could then write val back to your file :-) On Thu, 20 Aug 2009 14:08:34 -0700, Matthias Güntert wrote: Hello guys I w

incrementing string/hex value from file and write back

2009-08-20 Thread Matthias Güntert
Hello guys I would like to read a hex number from an ASCII file, increment it and write it back. How can this be performed? I have tried several approaches: my file serial.txt contains: 0C -- f = open('serial.txt', 'r') val = f.read() val = val.encode('hex') p

Re: Problem with arrays in a recursive class function

2009-08-20 Thread Aaron Scott
Never mind -- ditched the attempt and implemented Dijkstra. -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2009-08-20 Thread artur lukowicz
6344a24de14243c76060bedd42f79bc302679dad -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-20 Thread Simon Forman
On Aug 20, 3:06 pm, David <71da...@libero.it> wrote: > Hi all, > > Is there some magic to make the 2.x CPython interpreter to ignore the > annoying octal notation? No. You would have to modify and recompile the interpreter. This is not exactly trivial, see "How to Change Python's Grammar" http://

Re: thread and win32com.client problem

2009-08-20 Thread Christian Heimes
Ray wrote: I already find the way to fix it. :-) I consider it good style when people describe their solution to a problem, too. Other Python users may run into the same issue someday. :) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-20 Thread Johannes Bauer
David schrieb: > If I want an octal I'll use oct()! > > "Explicit is better than implicit..." A leading "0" *is* explicit. Implicit would be when some functions would interpret a "0" prefix as octal and others wouldn't. Regards, Johannes -- "Meine Gegenklage gegen dich lautet dann auf bewus

Problem with arrays in a recursive class function

2009-08-20 Thread Aaron Scott
I have a list of nodes, and I need to find a path from one node to another. The nodes each have a list of nodes they are connected to, set up like this: class Node(object): def __init__(self, connectedNodes): self.connectedNodes = connectedNodes nodes = { 1: Node

ANN: discover 0.3.0 released, automatic test discovery for unittest

2009-08-20 Thread Fuzzyman
The discover module is a backport of the automatic test discovery from the unittest module in Python-trunk (what will become Python 2.7 and 3.2). The discover module should work on versions of Python 2.4 upwards: * discover module on PyPI: http://pypi.python.org/pypi/discover The discover module

Re: thread and win32com.client problem

2009-08-20 Thread Ray
I already find the way to fix it. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Silly question

2009-08-20 Thread David C Ullrich
On Thu, 20 Aug 2009 14:36:35 -0400, Benjamin Kaplan wrote: > On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich > wrote: >> I just noticed that >> >>  sequence[i:j:k] >> >> syntax in a post here. When did this happen? >> >> (I'm just curious whether it existed in 1.5.x or not. If so I'm stupid >> -

Re: Silly question

2009-08-20 Thread David C Ullrich
On Thu, 20 Aug 2009 18:41:34 +, Duncan Booth wrote: > David C Ullrich wrote: > >> I just noticed that >> >> sequence[i:j:k] >> >> syntax in a post here. When did this happen? >> >> (I'm just curious whether it existed in 1.5.x or not. If so I'm stupid >> - otoh if it was introduced in 2

thread and win32com.client problem

2009-08-20 Thread Ray
Hi, I have a problem with thread and win32com.client running python 2.5 on vista (activestate python) import win32com.client, thread def child(test): problem=win32com.client.Dispatch("WScript.Shell") print 'hello from thread', test def parent(): i=0 while 1:

ANN: Wing IDE 3.2 released

2009-08-20 Thread Wingware
Hi, Wingware has released version 3.2.0 final of Wing IDE, our integrated development environment for the Python programming language. *Release Highlights* This release includes the following new features: * Support for Python 3.0 and 3.1 * Rewritten version control integration with support fo

Annoying octal notation

2009-08-20 Thread David
Hi all, Is there some magic to make the 2.x CPython interpreter to ignore the annoying octal notation? I'd really like 012 to be "12" and not "10". If I want an octal I'll use oct()! "Explicit is better than implicit..." TIA David -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing untrusted code

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 08:16:51 -0700, Emanuele D'Arrigo wrote: > In what ways would the untrusted string be able to obtain the original, > built-in open function and open a file for writing? On a related topic, you should read this post here: http://tav.espians.com/a-challenge-to-break-python-secu

Re: Silly question

2009-08-20 Thread Duncan Booth
David C Ullrich wrote: > I just noticed that > > sequence[i:j:k] > > syntax in a post here. When did this happen? > > (I'm just curious whether it existed in 1.5.x or not. > If so I'm stupid - otoh if it was introduced in 2.x > I'm just slow...) > > Googling for 'python extended slice' ret

Re: Executing untrusted code

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 08:16:51 -0700, Emanuele D'Arrigo wrote: > Fair enough. In this context, let's say I do this: > > import __builtin__ > import imp > originalBuiltins = imp.new_module("OriginalBuiltins") > > def readOnlyOpen(filename): > return originalBuiltins.open(filename, "r") > > __b

Re: Silly question

2009-08-20 Thread Benjamin Kaplan
On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich wrote: > I just noticed that > >  sequence[i:j:k] > > syntax in a post here. When did this happen? > > (I'm just curious whether it existed in 1.5.x or not. > If so I'm stupid - otoh if it was introduced in 2.x > I'm just slow...) > Well, I got some

Silly question

2009-08-20 Thread David C Ullrich
I just noticed that sequence[i:j:k] syntax in a post here. When did this happen? (I'm just curious whether it existed in 1.5.x or not. If so I'm stupid - otoh if it was introduced in 2.x I'm just slow...) -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary from a list

2009-08-20 Thread iu2
On Aug 20, 9:10 am, Peter Otten <__pete...@web.de> wrote: > Jan Kaliszewski wrote: > > 20-08-2009 o 02:05:57 Jan Kaliszewski wrote: > > >> Or probably better: > > >>      from itertools import islice, izip > >>      dict(izip(islice(li, 0, None, 2), islice(li, 1, None, 2))) > > > Or similarly, per

ncurses getch & unicode (was: decoding keyboard input when using curses)

2009-08-20 Thread Iñigo Serna
Hello, I have the same problem mentioned in http://groups.google.com/group/comp.lang.python/browse_thread/thread/c70c80cd9bc7bac6?pli=1some months ago. Python 2.6 program which uses ncurses module in a terminal configured to use UTF-8 encoding. When trying to get input from keyboard, a non-ascii

Re: Executing untrusted code

2009-08-20 Thread Rami Chowdhury
They could, of course, use the file object constructor directly, e.g.: f = file("/etc/passwd", "w") On Thu, 20 Aug 2009 08:16:51 -0700, Emanuele D'Arrigo wrote: Sorry for digging this back from the grave. I've had to chew on it for a little while. On Aug 8, 1:40 am, Nobody wrote:

Re: Executing untrusted code

2009-08-20 Thread Christian Heimes
Emanuele D'Arrigo write: In what ways would the untrusted string be able to obtain the original, built-in open function and open a file for writing? Yes, if you know some tricks: [cls for cls in object.__subclasses__() if cls.__name__ == 'file'][0] Christian -- http://mail.python.org/mail

Re: Executing untrusted code

2009-08-20 Thread Emanuele D'Arrigo
Sorry for digging this back from the grave. I've had to chew on it for a little while. On Aug 8, 1:40 am, Nobody wrote: > If you want to support restricted execution within a language, it > has to be built into the language from day one. Trying to bolt it > on later > is a fool's errand. Fair e

Re: Hi everyone, I get a problem when using binhex module

2009-08-20 Thread Dave Angel
Yan Jian wrote: Below is what I copy from the Internet: import binhex import sys infile = "in.txt" binhex.binhex(infile, sys.stdout) Every time I try to run this script, I get a message saying Traceback (most recent call last): File "D:\eclipse_workspace\encode\src\binhex.sample.py", line

Re: difference between raw_input() and input()

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 03:24:15 -0700, baalu aanand wrote: > Hi, > > I have used both raw_input() and input() for a same input value. > But these gives different output. > > I have listed below what actually I have done > > >>> a = raw_input("===>") >===>

Re: IDLE is not as interactive as Maple

2009-08-20 Thread sturlamolden
On 19 Aug, 20:22, laser wrote: > In the future, will Python provide programe enviroment like Maple > does? You might be looking for SAGE. http://www.sagemath.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: pypi category

2009-08-20 Thread jelle
The pypi list of categories, sorry... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python libexpat and EXPAT are same/Different?

2009-08-20 Thread Stefan Behnel
hari wrote: > Am very new to XML, I have a query, Does Python libexpat and EXPAT > are same or they are diffrent? Depends on what you mean with "EXPAT". Python's expat module that you can find in the standard library is the well known non-validating XML parser originally written by James Clark.

Python libexpat and EXPAT are same/Different?

2009-08-20 Thread hari
Hi all, Am very new to XML, I have a query, Does Python libexpat and EXPAT are same or they are diffrent? Thanks in advance. Regards, Hari -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE is not as interactive as Maple

2009-08-20 Thread Benjamin Kaplan
On Wed, Aug 19, 2009 at 11:22 PM, laser wrote: > In the future, will Python provide programe enviroment like Maple > does? In Maple, you can remove anything unneeded in the editor. And > the code execution order are not necessary in one direction. You can > run any command line on the screen by > p

Re: IDLE is not as interactive as Maple

2009-08-20 Thread André
On Aug 20, 12:22 am, laser wrote: > In the future, will Python provide programe enviroment like Maple > does? A quick, flip answer: perhaps if you design one? Tools for Python are designed by people scratching an itch. That being said, have a look at reinteract: http://www.reinteract.org/trac/w

Re: Data visualization in Python

2009-08-20 Thread Aaron Watters
On Aug 17, 3:10 pm, kj wrote: > I'm looking for a good Python package for visualizing > scientific/statistical data.  (FWIW, the OS I'm interested in is > Mac OS X). Please take a look at the amcharts embedding in WHIFF http://aaron.oirt.rutgers.edu/myapp/amcharts/doc WHIFF is a collection

Re: Hi everyone, I get a problem when using binhex module

2009-08-20 Thread Xavier Ho
On Thu, Aug 20, 2009 at 10:07 PM, Yan Jian wrote: > > Does anyone encounter similar situation. Thank you for your help? > Yeah, in Python 3.1 I get this: Traceback (most recent call last): File "test.py", line 6, in binhex.binhex(file, sys.stdout) File "c:\Python31\lib\binhex.py", lin

pypi category

2009-08-20 Thread jelle
Hi, Would someone be able to inform me how a category can be added to the pypy list of categories? I'd like to add a CAD & Geometry category. ( I develop PythonOCC, wrappers for the OpenCASCADE CAD kernel, which is why ) Thanks! -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: #elements of seq A in seq B

2009-08-20 Thread Peter Otten
Neal Becker wrote: > I meant #occurrences of characters from the set A in string B If a contains "few" characters: n = sum(b.count(c) for c in a) If a contains "many" characters: identity = "".join(map(chr, range(256))) n = len(b) - len(b.translate(identity, a)) Peter -- http://mail.python

Hi everyone, I get a problem when using binhex module

2009-08-20 Thread Yan Jian
Below is what I copy from the Internet: import binhex import sys infile = "in.txt" binhex.binhex(infile, sys.stdout) Every time I try to run this script, I get a message saying Traceback (most recent call last): File "D:\eclipse_workspace\encode\src\binhex.sample.py", line 6, in import

New Windows Mobile Smartphones from I-mate

2009-08-20 Thread Muhammad Salman
Windows Mobile smart phone device manufacturer, i-mate has shown off its latest models -the Ultimate 9502 and the Ultimate 8502.for other details http://infomobilepk.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL and Python

2009-08-20 Thread MaxTheMouse
On Aug 20, 10:23 am, catafest wrote: > On my photo jpg i have this : > > Image Type: jpeg (The JPEG image format) > Width: 1224 pixels > Height: 1632 pixels > Camera Brand: Sony Ericsson > Camera Model: W810i > Date Taken: 2009:07:09 08:16:21 > Exposure Time: 1/19 sec. > ISO Speed Rating: 320 > Fl

Re: #elements of seq A in seq B

2009-08-20 Thread Neal Becker
Jan Kaliszewski wrote: > 20-08-2009 o 01:19:24 Neal Becker wrote: > >> What would be a time efficient way to count the number of occurrences of >> elements of sequence A in sequence B? (in this particular case, these >> sequences are strings, if that matters). > > If you mean: to count occuren

pexpect on QNX platform

2009-08-20 Thread Asha Gowda
Hi, I found that pexpect is available only for linux. But we need to port to QNX, Is pexpect is available? If yes, where can I find it. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: difference between raw_input() and input()

2009-08-20 Thread Chris Rebert
On Thu, Aug 20, 2009 at 3:24 AM, baalu aanand wrote: > Hi, > >     I have used both raw_input() and input() for a same input value. > But these gives different output. > >     I have listed below what actually I have done > >            >>> a = raw_input("===>") >                   ===> 023 >      

Zipimport leaks memory?

2009-08-20 Thread ashwin.u....@nokia.com
Hi, We are currently trying to identify and fix all the memory leaks by just doing Py_Initialize-PyRun_SimpleFile(some simple script)-Py_Finalize and found that there are around 70 malloc-ed blocks which are not freed. One of the significant contributor to this number is the 'files' object in

difference between raw_input() and input()

2009-08-20 Thread baalu aanand
Hi, I have used both raw_input() and input() for a same input value. But these gives different output. I have listed below what actually I have done >>> a = raw_input("===>") ===> 023 >>> a '023' I have given the same

Polling a net address

2009-08-20 Thread Iain
Hi All, I'm writing a system tray application for windows, and the app needs to poll a remote site at a pre-defined interval, and then process any data returned. The GUI needs to remain responsive as this goes on, so the polling needs to be done in the background. I've been looking into Twisted a

Re: difference between 2 arrays

2009-08-20 Thread Michel Claveau - MVP
(envoyé via news:\\news.wanadoo.fr\comp.lang.python) Hi! Yes, the module sets is written, in doc, like "deprecated". But: - sets exist in Python 2.6 (& 2.5 or 2.4) - documentation of sets (module) is better tha, documentation of set (builtin) The best: read the documentaion of the module

Re: What file is foo in package bar in ?

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 01:06:00AM +0200, Christian Heimes wrote: > northof40 wrote: >> Given an arbitary package is there some programmatic way to 'ask' what >> file the method/function is implemented in ? > > Indeed, the inspect module contains several useful functions for the > job, for exampl

Re: How to create functors?

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 01:36:14 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> As near as I can tell, a functor is just an object which is callable >> like a function without actually being implemented as a function, e.g.: > > No it's not anything like that either, at least as I'm used to th

Re: How to create functors?

2009-08-20 Thread Paul Rubin
Steven D'Aprano writes: > As near as I can tell, a functor is just an object which is > callable like a function without actually being implemented as a > function, e.g.: No it's not anything like that either, at least as I'm used to the term in programming or in mathematics. Maybe it's used o

Re: PIL and Python

2009-08-20 Thread catafest
On my photo jpg i have this : Image Type: jpeg (The JPEG image format) Width: 1224 pixels Height: 1632 pixels Camera Brand: Sony Ericsson Camera Model: W810i Date Taken: 2009:07:09 08:16:21 Exposure Time: 1/19 sec. ISO Speed Rating: 320 Flash Fired: Flash did not fire, compulsory flash mode. Mete

Re: regular expression

2009-08-20 Thread Peter Otten
Pierre wrote: > I would like to change the string "(1 and (2 or 3))" by "(x[1] & (x > [2] || x[3]))" using regular expression... > Anyone can help me ? >>> re.compile(r"(\d+)").sub(r"x[\1]", "(1 and (2 or 3))") '(x[1] and (x[2] or x[3]))' >>> re.compile("and|or").sub(lambda m, d={"and":"&", "or

Re: Dictionary from a list

2009-08-20 Thread Peter Otten
Steven D'Aprano wrote: > On Thu, 20 Aug 2009 08:10:28 +0200, Peter Otten wrote: > > >> I just can't stop posting this one: >> > from itertools import izip > it = iter([1,2,3,4,5,6]) > dict(izip(it, it)) >> {1: 2, 3: 4, 5: 6} >> >> I really tried, but yours drove me over the edge. >

Re: Dictionary from a list

2009-08-20 Thread Tim Chase
Peter Otten wrote: it = iter([1,2,3,4,5,6]) dict(izip(it, it)) {1: 2, 3: 4, 5: 6} Zip(it). Zip(it) good. it's-3:00am-and-i-seriously-need-to-sleep'ly yers... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 00:18:23 -0700, Pierre wrote: > Hello, > > I would like to change the string "(1 and (2 or 3))" by "(x[1] & (x > [2] || x[3]))" using regular expression... Anyone can help me ? Do you mean you want to change the string into "(x[1] & (x[2] || x[3]))" ? Does it have to be u

Re: How to create functors?

2009-08-20 Thread Rami Chowdhury
As near as I can tell, a functor is just an object which is callable like a function I believe that's how they're defined in the C++ world, in which, of course, functions aren't first-class objects... - Rami Chowdhury "Never assume malice when stupidity will suffice." -- Hanlon'

regular expression

2009-08-20 Thread Pierre
Hello, I would like to change the string "(1 and (2 or 3))" by "(x[1] & (x [2] || x[3]))" using regular expression... Anyone can help me ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionary from a list

2009-08-20 Thread Steven D'Aprano
On Thu, 20 Aug 2009 08:10:28 +0200, Peter Otten wrote: > I just can't stop posting this one: > from itertools import izip it = iter([1,2,3,4,5,6]) dict(izip(it, it)) > {1: 2, 3: 4, 5: 6} > > I really tried, but yours drove me over the edge. If you want something to drive you ove