Re: Python Pseudo-Switch

2005-05-09 Thread Jason Mobarak
# -*- python -*- import sys def switchFor (target): sw = '__switch_table__' # please pretend the frame hack is not here, # it happens to work for classes and messing with # frame stack in a try/except is probably okay try: raise Exception() except: defs =

RE: Active Directory Modules?

2005-05-09 Thread Tim Golden
[Harlin Seritt] | Does anyone know if there are any Python Active Directory Modules out | there? I looked at LDAP module but there is no version for Python 2.4 | and it's support for Active Directory seems to be lacking a bit. Far from perfect, but functional. Uses pywin32. http://tgolden.sc.sab

RE: how to pass an array to a VB array via COM

2005-05-09 Thread Stefan Schukat
A patch is available at sourceforge: https://sourceforge.net/tracker/index.php?func=detail&aid=1195096&group_id=78018&atid=551956. Stefan > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > jelle > Sent: Friday, April 29, 2005 4:56 PM > To: pyth

Exception in Python 2.3.3 Interpreter

2005-05-09 Thread Saravanan
Hello, Im running Python Application as a Windows Service (using windows extensions). But, sporadically the application crashes (crash in Python23.dll) and this stops the service. This problem cann't be reproduced easily in my system and the call stack generated by the application is given belo

Re: Exception in Python 2.3.3 Interpreter

2005-05-09 Thread Saravanan D
Hello, The crash occured at the following line : c = strcmp(vname, wname) (object.c) Please note that the dump has been taken with the help of adplus. # ChildEBP RetAddr Args to Child 00 023ffa58 1e05c6da 055b1250 00637470 python23!default_3way_compare(struct _object * v = 0x053f2bfc

Python LDAP Schema Pickle

2005-05-09 Thread [EMAIL PROTECTED]
After much googling, I'm yet to see hint at the following topic. Has anyone ever worked on supporting ldap persistance of python objects? I'm a bit new to ldap, and I've noticed that there is a java.schema file standardized that stores persists java objects in an ldap directory. I would think tha

Re: Python LDAP Schema Pickle

2005-05-09 Thread hemanth
Why don't you check if ldaptor has implemented a similar functionality? I got the following link while googling: -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble saving unicode text to file

2005-05-09 Thread F. Petitjean
Le Mon, 09 May 2005 08:39:40 +1000, John Machin a écrit : > On Sun, 08 May 2005 19:49:42 +0200, "Martin v. Löwis" ><[EMAIL PROTECTED]> wrote: > >>John Machin wrote: >>> Martin, I can't guess the reason for this last suggestion; why should >>> a Windows system use iso-8859-1 instead of cp1252? >> >

Re: Strip white spaces from source

2005-05-09 Thread Richie Hindle
[qwweeeit] > I need to limit as much as possible the lenght of a source line, > stripping white spaces (except indentation). > For example: > . . max_move and AC_RowStack.acceptsCards ( self, from_stack, cards > ) > must be reduced to: > . . max_move and AC_RowStack.acceptsCards(self,from_

regarding try/except usa

2005-05-09 Thread praba kar
Dear All, Is there any rules and regulations to use try/except in python? Can any one explain to me when I need to use try/except and when we I need not use try/except?. This Question mainly for to maintain code integrity in my project. But I know how to use try/except regards Praba

Re: regarding try/except usa

2005-05-09 Thread [EMAIL PROTECTED]
Well, there is a lot to say about this subject. Start reading with this: http://docs.python.org/tut/node10.html -- http://mail.python.org/mailman/listinfo/python-list

Re: hard memory limits

2005-05-09 Thread Fredrik Lundh
Mike Meyer wrote: > There is something very non-unixy going on here, though. Why is > vm_malloc exiting with an error message, instead of returning a > failure to the calling application? I've seen other applications > include a FOSS malloc implementation to work around bugs in the > system's mall

is there a python object which can interpret java-script?

2005-05-09 Thread Alexander Fillips
Hi, my short question: is there a python object which can interpret java-script? the whole story ;-) I wrote some streaming-scripts for the xbox mediaplayer which supports python. for a new script i tried to filter the stream-url from an website. it seems, that the site ist using java-script

Re: Fredrik Lundh

2005-05-09 Thread Fredrik Lundh
Robert Kern wrote: >> It hides any mention that Fredrik Lundh is behind it, which is deceitful >> when he posts any smidgeon of praise his software gets, not admitting he >> makes his income off support fees for that same software. > > I think that reasonable people can draw a line. I would welcom

Re: is there a python object which can interpret java-script?

2005-05-09 Thread Robert Kern
Alexander Fillips wrote: > Hi, > > my short question: > > is there a python object which can interpret java-script? > > the whole story ;-) google("python javascript") First link is a Python binding to the SpiderMonkey JavaScript interpreter from the Mozilla project. It's unmaintained, and I'

Re: path(file)

2005-05-09 Thread Fuzzyman
Can you give us an example of the way the 'list of files' is stored in. import os print os.path.abspath(filename) Will do *something*... so long as 'filename' contains a path relative to the current working directory. What you want is undoubtably in the os and os.path modules. Regards, Fuzzy ht

Re: New Python regex Doc

2005-05-09 Thread Fredrik Lundh
Mike Meyer wrote: > After doing a google for "regular expression greedy", the second match > starts with the text: > > By default, pattern matching is greedy, which means that the matcher > returns the longest match possible. > > Now, it can be argued that the term ought not to be used,

[ANNOUNCE] PyKota v1.08 is out

2005-05-09 Thread Jerome Alet
Hi there, I'm pleased to announce that PyKota v1.08 is out. PyKota is an entirely Python written, GNU GPLed, centralized, full featured, internationalized, and easily extensible, print quota and accounting solution for CUPS and LPRng under Unix like systems like GNU/Linux. This release includes

Re: is there a python object which can interpret java-script?

2005-05-09 Thread Kartic
The Great 'Alexander Fillips' uttered these words on 5/9/2005 7:34 AM: > Hi, > > my short question: > > is there a python object which can interpret java-script? > > the whole story ;-) > > I wrote some streaming-scripts for the xbox mediaplayer which supports > python. for a new script i trie

[ANNOUNCE] PyKota v1.22 is out !

2005-05-09 Thread Jerome Alet
I'm pleased to announce the availability of PyKota v1.22 Final. PyKota is a 100% Python written Print Quota and Accounting solution for CUPS and LPRng, published under the terms of the GNU General Public License of the Free Software Foundation, and is available from : http://www.librelogiciel.c

Re: [ANNOUNCE] PyKota v1.08 is out

2005-05-09 Thread Jerome Alet
This one is completely outdated, sorry for the inconvenience. In addition I wasn't able to cancel it because of some error on my part... Sorry again Jerome -- http://mail.python.org/mailman/listinfo/python-list

memory leak

2005-05-09 Thread Carlos Garcia
Hi All,     I have a memory leak in an application that uses the Python.exec() method multiple times, i can see in jprobe that instance of classes org.python.pycode._pyx* andorg.python.proxies.* dynamically created during an exec  are not cleaned by the garbage collector.       Any id

Re: Exception in Python 2.3.3 Interpreter

2005-05-09 Thread Fredrik Lundh
"Saravanan D" <[EMAIL PROTECTED]> wrote: > 03 023ffaa4 1e013182 055b1250 00637470 python23!cmp_outcome(int op > = 88026108, struct _object * v = 0x0001, struct _object * w = > 0x)+0xa9 [F:\Python-2.3.3\Python-2.3.3\Python\ceval.c @ 3880] > 04 023ffb18 1e016ba4 014f3318 000

ANN: rest2web 0.1.0

2005-05-09 Thread Fuzzyman
Finally, the long awaited (*ahem*) release of **rest2web**. It's an early release - lot's more features still to be added - but it all works. *Hurrah* rest2web is a tool for autogenerating websites. It allows you to store your contents in reST format, and generate pages and indexes from templates.

Re: clear the files using python

2005-05-09 Thread Peter Hansen
Sez sez: > Each file's structure as below: > Comments: This is article 1965 obtained from the website > Title: Banana Report #65, September 2003 > Author: dylab > Date: 1st September 2003 > Section: pulse > > In the past month: > A mass hit North America, cutting electricity to 50 million people >

Re: clear the files using python

2005-05-09 Thread Simon Brunning
On 8 May 2005 21:55:04 -0700, Sez <[EMAIL PROTECTED]> wrote: > Could you please point me to right direction here. Or provide some > example code. In the mean time I'll be searching myself. I know you > guys hate novice people like me but I would appreciated if you could > provide little help here.

Re: __brace__ (PEP?)

2005-05-09 Thread Roy Smith
"Kay Schluehr" <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > > foo->bar ==> foo.__arrrow__(bar) > > foo$bar ==> foo.__dollar__(bar) > > foo#bar ==> foo.__hash__(bar) > > foo::bar ==> foo.__scope__(bar) > > I'm strongly in favor for the arrow ( but with two "r" only ). The > question is simpl

replace string patern with different value

2005-05-09 Thread [EMAIL PROTECTED]
Hello, I would like to replace string with different values, For example : source = 'kode1 bla bla kode1 bla kode1' I have a list with each member will replace each of kode1. L = [11,22,33] So the new source will become: newsource = '11 bla bla 22 bla 33' How can I do it ? I tried to find using s

Re: Trouble saving unicode text to file

2005-05-09 Thread Fredrik Lundh
John Machin wrote: > I find it a bit hard to imagine that the euro sign wouldn't get a fair > bit of usage in Swedish data processing even if it's not their own > currency. it's spelled "Euro" or "EUR" in swedish. (if you live in a country that use letters to represent its own currency, you tend

replace string patern with different value

2005-05-09 Thread Bill Mill
On 9 May 2005 06:23:41 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I would like to replace string with different values, > For example : > source = 'kode1 bla bla kode1 bla kode1' > I have a list with each member will replace each of kode1. > L = [11,22,33] > So the new source

Re: replace string patern with different value

2005-05-09 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I would like to replace string with different values, > For example : > source = 'kode1 bla bla kode1 bla kode1' > I have a list with each member will replace each of kode1. > L = [11,22,33] > So the new source will become: > newsource = '11 bla bla 22 bla 33' Here's on

Re: replace string patern with different value

2005-05-09 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > I would like to replace string with different values, > For example : > source = 'kode1 bla bla kode1 bla kode1' > I have a list with each member will replace each of kode1. > L = [11,22,33] > So the new source will become: > newsource = '11 bla bla 22 bla 33' > > How c

Re: replace string patern with different value

2005-05-09 Thread Fredrik Lundh
Bill Mill wrote: for rep in L: > ... source = source.replace(token, rep, 1) here's another way to do it: >>> L = ["11", "22", "33"] >>> S = "xyzzy text we've got xyzzy text xyzzy yeah yeah yeah" >>> L.reverse() >>> re.sub("xyzzy", lambda x: L.pop(), S) "11 text we've got 22 text 33 yeah

Re: Trouble saving unicode text to file

2005-05-09 Thread Max M
Fredrik Lundh wrote: > (I just noticed that there's no euro sign on my swedish keyboard. I've > never missed it ;-) It's probably "AltGR + E" like here in DK -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble saving unicode text to file

2005-05-09 Thread Simon Brunning
On 5/9/05, Max M <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > (I just noticed that there's no euro sign on my swedish keyboard. I've > > never missed it ;-) > > It's probably "AltGR + E" like here in DK My UK keyboard has it as AltGr + 4, FWIW. -- Cheers, Simon B, [EMAIL PROTECTED]

ANN: Boston Python Interest Group Meeting

2005-05-09 Thread Chris Curvey
Thursday, 7PM Harvard Science Center 1 Oxford St Room 507 Cambridge, mA 02101 'Nuff said. -- http://mail.python.org/mailman/listinfo/python-list

include "apythonscript.py"

2005-05-09 Thread martijn
H! I'm trying to find a python function to use like this: -- maincode.py Include "apythonscript_function.py" -- end So I can split the maincode.py file in smalle pieces. Or yust save the function's in other file and include them once. I really want to use this because else { the maincode.py wi

file corruption on windows - possible bug

2005-05-09 Thread Jeremy Jones
I've written a piece of code that iterates through a list of items and determines the filename to write some piece of data to based on something in the item itself. Here is a small example piece of code to show the type of thing I'm doing:: # file_dict = {} a_list

Re: include "apythonscript.py"

2005-05-09 Thread Larry Bates
How about? put apythonscript_function.py in a separate file then inculde apythonscript_function.py at the top of maincode.py Looks like you probably need to go back and read the tutorial. -Larry [EMAIL PROTECTED] wrote: > H! > > I'm trying to find a python function to use like this: > > --

Re: include "apythonscript.py"

2005-05-09 Thread Chris Curvey
the PHP include doesn't have an exact match in Python, but I think you can do what you intend. To follow the first example from php.net, this would work vars.py color = 'green' fruit = 'apple' test.py from vars import * print "A " , color, fruit HTH -- http://mail.python.org/mailman/listinfo

Re: file corruption on windows - possible bug

2005-05-09 Thread Fredrik Lundh
Jeremy Jones wrote: > # > file_dict = {} > > a_list = [("a", "a%s" % i) for i in range(2500)] > b_list = [("b", "b%s" % i) for i in range(2500)] > c_list = [("c", "c%s" % i) for i in range(2500)] > d_list = [("d", "d%s" % i) for i in range(2500)] > > > joined_list =

Adapt PyShell's code completion into DrPython

2005-05-09 Thread dcrespo
I would like to adapt the PyShell code completion to DrPython, because both programs are very good... Any clue for start finding the code location in both programs to accomplish this? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Encryption with Python?

2005-05-09 Thread Anthra Norell
Robert, Thanks a lot for your thorough explanations. - Original Message - From: "Robert Kern" <[EMAIL PROTECTED]> To: Sent: Saturday, May 07, 2005 3:18 PM Subject: Re: Encryption with Python? ( snip ) > >>You do realize that if I have two ciphertexts encrypted with the same > >>ke

Re: file corruption on windows - possible bug

2005-05-09 Thread Duncan Booth
Jeremy Jones wrote: > Here is a small example piece of code to > show the type of thing I'm doing:: > > # > file_dict = {} > > a_list = [("a", "a%s" % i) for i in range(2500)] > b_list = [("b", "b%s" % i) for i in range(2500)] > c_list = [("c", "c%s" % i) for i in

Re: include "apythonscript.py"

2005-05-09 Thread martijn
Ah damn , that's the way. And what if you have a very big class and want to include some class functions ? class ThisIsAClass: def __init__(self): Here I want to import a class def -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble saving unicode text to file

2005-05-09 Thread Fredrik Lundh
Max M wrote: >> (I just noticed that there's no euro sign on my swedish keyboard. I've >> never missed it ;-) > > It's probably "AltGR + E" like here in DK ah, there it is. almost entirely worn out. and it doesn't work. but a little fooling around reveals that AltGr+5 does work. oh well, you

M2Crypto SSL memory leaks - fixes or alternatives ??

2005-05-09 Thread adsheehan
Hi folks, I notice that M2Crypto (a python wrap of OpenSSL) leaks (haemorrhages) memory significantly and affects my long running app very badly. Does anyone know of fixes to this problem? Does anyone recommmend alternatives to M2C ? e.g pyopenssl. I notice that Guido Van Rossum has flamed abou

Re: file corruption on windows - possible bug

2005-05-09 Thread Duncan Booth
Fredrik Lundh wrote: > you do realize that this opens the file again every time, so you end > up having 4x2500 file handles pointing to 4 physical files. that's a > bad idea. > Assuming he is using the common C Python most of those file handles get closed immediately after opening, so he never

Re: file corruption on windows - possible bug

2005-05-09 Thread Jeremy Jones
Fredrik Lundh wrote: Jeremy Jones wrote: # file_dict = {} a_list = [("a", "a%s" % i) for i in range(2500)] b_list = [("b", "b%s" % i) for i in range(2500)] c_list = [("c", "c%s" % i) for i in range(2500)] d_list = [("d", "d%s" % i) for i in range(2

Re: replace string patern with different value

2005-05-09 Thread Paul McGuire
Well, not to be left out, here is a pyparsing solution. But this looks suspiciously like some form of mail-merge or templating application. Google for 'python templating' for existing approaches to this problem. Interestingly, using an iterator of L sidesteps a number of other problems. My origi

Re: include "apythonscript.py"

2005-05-09 Thread Duncan Booth
wrote: > Ah damn , that's the way. > > And what if you have a very big class and want to include some class > functions ? > > class ThisIsAClass: > def __init__(self): > > Here I want to import a class def > The usual way to handle that would be to not write a 'very big class' at a

Re: Exception in Python 2.3.3 Interpreter

2005-05-09 Thread Terry Reedy
"Saravanan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Im running Python Application as a Windows Service (using windows > extensions). But, sporadically the application crashes (crash in > Python23.dll) and this stops the service. This problem cann't be > reproduced easily i

Question about extending the interperter

2005-05-09 Thread Eli
Hi, I've followed the Python docs about extending the Python interperter and created an extension library. I've added my functions like this: static PyMethodDef pmylib_methods[] = { {"foo", pmylib_foo, METH_VARARGS, "foo() doc string"}, ... } static PyObject *pmylib_foo(PyObject *self, PyObject *a

Re: Calling a python function from C++

2005-05-09 Thread djw
[EMAIL PROTECTED] wrote: > Let's say I have a python function do some math like the following: > > def doMath(self): >self.val = self.val + 1 > > > How can I call this python function from C++? Assuming I have some sort > of Python wrapper around my C++ codes. > Elmer? http://elmer.source

Re: Outlook-MAPI

2005-05-09 Thread erinhouston
This code should help. code import win32com.client olMailItem = 0x0 obj = win32com.client.Dispatch("Outlook.Application") newMail = obj.CreateItem(olMailItem) newMail.Subject = "This works" newMail.Body = "It worked aging\n" newMail.display() V.C.Sekhar wrote: > Hi there, > > Can any

Resize an Image without PIL

2005-05-09 Thread querypk
Hi I would like to know how to resize an Image without using python Imaging library. -- http://mail.python.org/mailman/listinfo/python-list

Listing of declared variables and functions

2005-05-09 Thread ohms377
Dear python users, In interactive mode, I was wondering if there is a way to list all declared variables and functions (and from global workspace). Thanks, -frankie -- http://mail.python.org/mailman/listinfo/python-list

Re: Listing of declared variables and functions

2005-05-09 Thread Bill Mill
On 9 May 2005 09:58:19 -0700, ohms377 <[EMAIL PROTECTED]> wrote: > Dear python users, > > In interactive mode, I was wondering if there is a way to list all > declared variables and functions (and from global workspace). > >>> x = 12 >>> z = 13 >>> import re >>> locals() {'__builtins__': , 're':

Inverse confusion about floating point precision

2005-05-09 Thread Skip Montanaro
I understand why the repr() of float("95.895") is "95.8949996". What I don't understand is why if I multiply the best approximation to 95.895 that the machine has by 1 I magically seem to get the lost precision back. To wit: % python Python 2.3.4 (#12, Jul 2 2004, 09:48:10)

Does anybody know the status of PyCon recordings?

2005-05-09 Thread Bill Mill
Hey all, There was a lot of talk on this list about recording pycon 2005 talks, but I never saw any messages saying that they'd actually been recorded. The wiki page ( http://www.python.org/moin/PyConDC2005/TalkRecording ) doesn't give links to any recordings. Does anybody know if these recording

Re: Inverse confusion about floating point precision

2005-05-09 Thread Tim Peters
[Skip Montanaro] > I understand why the repr() of float("95.895") is "95.8949996". > What I don't understand is why if I multiply the best approximation to > 95.895 that the machine has by 1 I magically seem to get the lost > precision back. To wit: > >% python >Python 2.3.4 (#

Advice needed on __del__

2005-05-09 Thread André Roberge
Suppose I have two classes: 'Jekyll' and 'Hyde' that are related in a particular way. When I create a Jekyll object, a Hyde one gets automatically created (and displayed on a screen). drum roll to announce Python script === Nice = Jekyll()# Nice_twin, a Hyde object, gets created. Nice.

Re: Does anybody know the status of PyCon recordings?

2005-05-09 Thread Sébastien Boisgérault
http://www.pycon.org/talks/ Cheers, SB -- http://mail.python.org/mailman/listinfo/python-list

Re: Inverse confusion about floating point precision

2005-05-09 Thread Dan Bishop
Skip Montanaro wrote: > I understand why the repr() of float("95.895") is "95.8949996". > What I don't understand is why if I multiply the best approximation to > 95.895 that the machine has by 1 I magically seem to get the lost > precision back. To wit: > > % python > Python 2

Dr. Dobb's Python-URL! - weekly Python news and links (May 9)

2005-05-09 Thread Simon Brunning
QOTW: "It's not perfect, but then nobody in this thread has offered anything even remotely resembling perfect documentation for regular expressions yet. " - Peter Hansen "Python's flavor of OO is perfectly valid and usable, even though it doesn't follow the Java Holy Bible of Object Orientation (g

Re: replace string patern with different value

2005-05-09 Thread [EMAIL PROTECTED]
Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: __brace__ (PEP?)

2005-05-09 Thread Kay Schluehr
Roy Smith wrote: > "Kay Schluehr" <[EMAIL PROTECTED]> wrote: > > > Roy Smith wrote: > > > > > foo->bar ==> foo.__arrrow__(bar) > > > foo$bar ==> foo.__dollar__(bar) > > > foo#bar ==> foo.__hash__(bar) > > > foo::bar ==> foo.__scope__(bar) > > > > I'm strongly in favor for the arrow ( but with two "

Re: Inverse confusion about floating point precision

2005-05-09 Thread Skip Montanaro
>> Why isn't the last result "958949.996"? IOW, how'd I get >> back the lost bits? Dan> You were just lucky. Thanks for the response (and to Tim as well). Dan> The floating-point representation of 95.895 is exactly Dan> 6748010722917089 * 2**-46. I seem to recall se

py2exe to share binary files

2005-05-09 Thread Laguna
Hi, With py2exe-0.3.3 for Python 2.2 in Windows XP, how to configure setup.py such that multiple executables can share the dll files (like wx*.dll etc.) as follows: # Source folders \Program1 Program1.py Program1WX.py \Program2 Program2.py Program2WX.py # Output binary folders \Sha

Re: Inverse confusion about floating point precision

2005-05-09 Thread Tim Peters
[Dan] >Dan> The floating-point representation of 95.895 is exactly >Dan> 6748010722917089 * 2**-46. [Skip Montanaro] > I seem to recall seeing some way to extract/calculate fp representation from > Python but can't find it now. I didn't see anything obvious in the > distribution. For Da

Re: Strip white spaces from source

2005-05-09 Thread qwweeeit
Hi Richie, thank you for your answer. Your solution is interesting but does not take into account some white spaces (like those after the commas, before or after mathematical operands etc...). Besides that I'm a almost a newbie in Python, and I have the very old programmers' habits (I don't use cla

Re: Advice needed on __del__

2005-05-09 Thread Fredrik Lundh
André Roberge wrote: > This morning I had the following thought: > I can, when I create a Jekyll object, update > an outside_list. > If, somehow, I could update that list when > a Jekyll object disappears > (perhaps by using __del__, which I have never touched) Python makes no guarantees whatsov

Re: Question about extending the interperter

2005-05-09 Thread Fredrik Lundh
"Eli" wrote: > I've followed the Python docs about extending the Python interperter > and created an extension library. > I've added my functions like this: > > static PyMethodDef pmylib_methods[] = { > {"foo", pmylib_foo, METH_VARARGS, "foo() doc string"}, > ... > } > static PyObject *pmylib_foo(

Re: Resize an Image without PIL

2005-05-09 Thread Larry Bates
PIL is the best way. Or you can call some external program to do it (using os.system). Larry Bates [EMAIL PROTECTED] wrote: > Hi I would like to know how to resize an Image without using python > Imaging library. > -- http://mail.python.org/mailman/listinfo/python-list

Re: Encryption with Python?

2005-05-09 Thread Paul Rubin
"Anthra Norell" <[EMAIL PROTECTED]> writes: > The non-randomness of the difference is evidence of having guessed the key, > right? Why then do I need two samples? If I hack away at a single sample I > get a probably more conspicuous non-randomness twice as fast. No. Let's say you encrypt two asci

Re: Declaring self in PyObject_CallMethod

2005-05-09 Thread Fredrik Lundh
"[EMAIL PROTECTED]" wrote: > Calling a python method from C++ has the following signature: > > PyObject * > PyObject_CallMethod(PyObject *self, char *method_name, > char *arg_format, ...); > > I'm having trouble figuring out how to declare self. Reading the C API documentation

Re: global lists

2005-05-09 Thread Dan Christensen
andrea crotti <[EMAIL PROTECTED]> writes: > Hi everbybody again, > I have a little "problem", I don't understand the reason of this: > > a = [10,1,2,3] > def foo(): > global a > for n in range(len(a)): > a[n] = a[n]*2 If I type the above, and then call foo, I get what looks like reasonabl

PyAr - Python Argentina 9th Meeting, this Thursday

2005-05-09 Thread Batista, Facundo
Title: PyAr - Python Argentina 9th Meeting, this Thursday The Argentine Python User Group, PyAr, will have its nineth meeting this Thursday, May 12nd at 7:00pm. Agenda -- Despite our agenda tends to be rather open, this time we would like to cover these topics: - See what we'll do w

Re: Advice needed on __del__

2005-05-09 Thread Fredrik Lundh
"phil" wrote: > > Python makes no guarantees whatsover about when and how to > > run __del__, so relying on it to remove user-visible resources is a > > rather bad idea. > What does that mean? Is it a destructor or not? it's a finalizer. most Python implementations do a reasonable attempt to c

Re: [Python.NET] Announce: Python for .NET 1.0 RC1 released

2005-05-09 Thread Guy Robinson
Great Stuff!!! >(probably including a few specific > examples of embedding Python for .NET in a .NET application). Cool!! :-) Guy Brian Lloyd wrote: > Hi all - > > I'm happy to announce the release of Python for .NET 1.0 RC1. > You can download it from: > > http://www.zope.org/Members/Bri

Re: Advice needed on __del__

2005-05-09 Thread André Roberge
Fredrik Lundh wrote: > André Roberge wrote: > > > >>This morning I had the following thought: >>I can, when I create a Jekyll object, update >>an outside_list. >>If, somehow, I could update that list when >>a Jekyll object disappears >>(perhaps by using __del__, which I have never touched) > >

cimport from different packages [Pyrex]

2005-05-09 Thread George Sakkis
Does cimport work for importing from different packages in Pyrex ? Here's a minimal example: # in ./foo/bar.pxd cdef class Bar: cdef int i # in ./foo/bar.pyx cdef class Bar: def __init__(self, i): self.i = i # in ./tmp.pyx cimport foo.bar $ pyrexc foo/bar.pyx $ pyrexc tmp.pyx tm

Re: Resize an Image without PIL

2005-05-09 Thread James Carroll
Or if you're using wxPython, wx.Image can load, rescale and save. There's also a Python wrapper for imageMagick, which will do just about anything to medium-small files. One way or another you'll need to incorporate (depend on) something that can decode the various image file formats that you nee

GTK progress bar not working properly with pulse()

2005-05-09 Thread lamthierry
My python file(progressbar.py) looks like the following: pbar = gtk.ProgressBar() def updateBar(percentage): print percentage pbar.pulse() class ProgressBar: def __init__(self): # other gui codes align.add(pbar) pbar.show() My C++ codes look like the followi

Re: Trouble saving unicode text to file

2005-05-09 Thread "Martin v. Löwis"
John Machin wrote: > Terminology disambiguation: what I call "users" wouldn't know what > 'cp1252' and 'iso-8859-1' were. They're not expected to know. They > just type in whatever characters they can see on their keyboard or > find in the charmap utility. It's what I'd call 'admins' and > 'develop

Re: Encryption with Python?

2005-05-09 Thread Anthra Norell
Paul, I thank you too for your response. Let me just tell you what goes through my mind. - Original Message - From: "Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> Newsgroups: comp.lang.python To: Sent: Monday, May 09, 2005 9:45 PM Subject: Re: Encryption with Python? > "Anthra Nor

Re: pyvm -- faster python

2005-05-09 Thread djw
Paul Rubin wrote: > Stelios Xanthakis <[EMAIL PROTECTED]> writes: > >>- The demo is an x86/linux binary only. You shouldn't trust binaries, >> run it in a chrooted environment not as root! > > > Are you going to release the source? If not, it's a lot less interesting. From the website: "..

Unique Elements in a List

2005-05-09 Thread [EMAIL PROTECTED]
Is there an easy way to grab the Unique elements from a list? For Example: data = [0.1,0.5,0.6,0.4,0.1,0.5,0.6,0.9] what I am looking for is the unique elements 0.4 and 0.9 with their index from the list. Probably something like a Hash Table approach!! I would like to get this done without unneces

Dr. Dobb's Python-URL! - weekly Python news and links (May 9)

2005-05-09 Thread Simon Brunning
QOTW: "It's not perfect, but then nobody in this thread has offered anything even remotely resembling perfect documentation for regular expressions yet. " - Peter Hansen "Python's flavor of OO is perfectly valid and usable, even though it doesn't follow the Java Holy Bible of Object Orientation (g

Re: Language documentation ( was Re: Computing Industry shams)

2005-05-09 Thread Sean Burke
alex goldman <[EMAIL PROTECTED]> writes: > vermicule wrote: > > > > > What is so hard to understand ? > > Should be perfectly clear even to a first year undergraduate. > > > > As for "greedy" even a minimal exposure to Djikstra's shortest path > > algorithm would have made the concept intuitiv

Re: Encryption with Python?

2005-05-09 Thread Paul Rubin
"Anthra Norell" <[EMAIL PROTECTED]> writes: > I don't follow. There is no bitwise correlation between a plain-text > character and its encoded equivalent. What's more, there is no detectable > correlation at all. Your question was how could you tell if two ciphertexts were encrypted with the same

Re: Unique Elements in a List

2005-05-09 Thread runes
This is not the most beautiful idiom, but it works... d = {} for k in data: try: d[k] += 1 except: d[k] = 1 for k,v in d.items(): if v == 1: print k -- http://mail.python.org/mailman/listinfo/python-list

Re: Unique Elements in a List

2005-05-09 Thread [EMAIL PROTECTED]
OK I need to be more clear I guess!Unique Elements I mean, elements that are non repeating. so in the above list 0.4, 0.9 are unique as they exist only once in the list. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unique Elements in a List

2005-05-09 Thread Roie Kerstein
[EMAIL PROTECTED] wrote: > Is there an easy way to grab the Unique elements from a list? > Yes. The set data type. Look in the reference of python 2.4. -- Best regards Roie Kerstein -- http://mail.python.org/mailman/listinfo/python-list

Unique Elements in a List

2005-05-09 Thread James Stroud
On Monday 09 May 2005 03:15 pm, [EMAIL PROTECTED] wrote: > Is there an easy way to grab the Unique elements from a list? from sets import Set data = [0.1,0.5,0.6,0.4,0.1,0.5,0.6,0.9] [x for x in Set(data) if data.count(x) == 1] -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box

Re: Unique Elements in a List

2005-05-09 Thread James Stroud
On Monday 09 May 2005 03:15 pm, [EMAIL PROTECTED] wrote: > Is there an easy way to grab the Unique elements from a list? > For Example: > data = [0.1,0.5,0.6,0.4,0.1,0.5,0.6,0.9] > > what I am looking for is the unique elements 0.4 and 0.9 with their > index from the list. > Probably something like

Re: replace string patern with different value

2005-05-09 Thread Bengt Richter
On Mon, 9 May 2005 15:48:14 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Bill Mill wrote: > > for rep in L: >> ... source = source.replace(token, rep, 1) > >here's another way to do it: > L = ["11", "22", "33"] S = "xyzzy text we've got xyzzy text xyzzy yeah yeah yeah"

Re: Unique Elements in a List

2005-05-09 Thread runes
Your set-approach is very nice, but if the list of data is huge, it is rather slow because you'll have to loop through the data list and count every member. -- http://mail.python.org/mailman/listinfo/python-list

RE: py23-pysvn-svn114-1.2.0-415.exe << won't load on win98

2005-05-09 Thread Timothy Smith
hello there, i get the following error when attempting to load pysvn on a win98 system Traceback (most recent call last): > File "PubWare.py", line 11, in ? > File "Main.pyc", line 46, in ? > File "pysvn\__init__.pyc", line 12, in ? > File "pysvn\_pysvn.pyc", line 9, in ? > File "pysvn\_pysvn

Re: file corruption on windows - possible bug

2005-05-09 Thread Bengt Richter
On Mon, 09 May 2005 10:54:22 -0400, Jeremy Jones <[EMAIL PROTECTED]> wrote: >I've written a piece of code that iterates through a list of items and >determines the filename to write some piece of data to based on >something in the item itself. Here is a small example piece of code to >show the ty

  1   2   >