ANN: Python and Plone Boot Camps in Chapel Hill, NC

2008-05-20 Thread Chris Calloway
Triangle (NC) Zope and Python Users Group (TriZPUG) is proud to open registration for our fourth annual ultra-low cost Plone and Python training camps, BootCampArama 2008: http://trizpug.org/boot-camp/2008/ Registration is now open for: PyCamp: Python Boot Camp, August 4 - 8 Plone Boot

MDP: A Simple Feed Forward Network

2008-05-20 Thread blaine
Hey everyone, I was hoping to see some people out on the python list that are familiar with MDP (Modular Toolkit for Data Processing - http://mdp-toolkit.sourceforge.net/)? I am wanting to develop a very simple feed forward network. This network would consist of a few input neurons, some

Python-URL! - weekly Python news and links (May 19)

2008-05-20 Thread Gabriel Genellina
QOTW: IIRC the idea was so that managers could write programs in English. It failed because nobody could write a parser that would handle something like 'The bottom line is that the stakeholder group requires the situation going forward to be such as to facilitate the variable known as x to

Re: this worked before...' '.join([`x x` for x in range(1, 6)])

2008-05-20 Thread Arnaud Delobelle
John McMonagle [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: ' '.join([`x x` for x in range(1, 6)]) anyone can tell me what im doing wrong? -- http://mail.python.org/mailman/listinfo/python-list ' '.join(['%s %s' % (str(x), str(x)) for x in range(1,6)]) or ' '.join([str(x)+'

Re: Using StringVars in List of Dictionaries as tkInter variables for Scale and Label widgets

2008-05-20 Thread Peter Otten
seanacais wrote: I had the Tkinter import as from Tkinter import * but I changed it to import Tkinter as tk and modified the creation of the root object to root=tk.Tk() I then had to change every instance of Menu, Label, Button, and all Tkinter elements to be prefaced by tk.

Re: test mult vars to same value, how to shorten expr?

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Mon, 19 May 2008 20:36:45 -0700, notnorwegian wrote: if i want o test: if a == 5 and b ==5 and c==5 ... z==5 is there some synctactic suagr for this? rather than maiking one of my own i mean, something built-in like: if a,b,c... z == 5: Since Python 2.5 there's `all()`: In [81]: a,

Re: scaling problems

2008-05-20 Thread Arnaud Delobelle
James A. Donald [EMAIL PROTECTED] writes: Ben Finney The larger the program, the greater the likelihood of inadvertent name collisions creating rare and irreproducible interactions between different and supposedly independent parts of the program that each work fine on their own, and

Re: this worked before...' '.join([`x x` for x in range(1, 6)])

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Mon, 19 May 2008 15:28:48 -0700, notnorwegian wrote: ' '.join([`x x` for x in range(1, 6)]) anyone can tell me what im doing wrong? I doubt that this worked before because that's a syntax error: In [84]: ' '.join([`x x` for x in range(1, 6)])

Re: Compress a string

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Tue, 20 May 2008 00:38:57 -0400, John Salerno wrote: def compress(s): new = [] for c in s: if c not in new: new.append(c) return ''.join(new) No, wait! I can do better! def compress(s): new = [] [new.append(c) for c in s if c not in

Re: python script to windows exe

2008-05-20 Thread sandeep
hi all thanks for ur replies. i have a bit closer look at my code and i am able to fix the problem.now my exe is working fine.the code is bit more cleaner now as i removed lot of unused function from it and try to document it also. import win32com,win32com.client import os,os.path import codecs

Re: scaling problems

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Tue, 20 May 2008 13:57:26 +1000, James A. Donald wrote: The larger the program, the greater the likelihood of inadvertent name collisions creating rare and irreproducible interactions between different and supposedly independent parts of the program that each work fine on their own, and

Re: scaling problems

2008-05-20 Thread Marc 'BlackJack' Rintsch
On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote: 2. It is not clear to me how a python web application scales. Ask YouTube. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: explain this function to me, lambda confusion

2008-05-20 Thread Bruno Desthuilliers
Paul McGuire a écrit : On May 19, 11:04 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: Paul McGuire [EMAIL PROTECTED] writes: [...] Could you use it as a decoratore instead? integer = Word(0123456789) @integer.setParseAction def parse_integer(tokens): return int(tokens[0]) I could make

Re: test mult vars to same value, how to shorten expr?

2008-05-20 Thread Peter Otten
[EMAIL PROTECTED] wrote: if i want o test: if a == 5 and b ==5 and c==5 ... z==5 is there some synctactic suagr for this? rather than maiking one of my own i mean, something built-in like: if a,b,c... z == 5: if all(x == 5 for x in a,b,c,...): print yep Peter --

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : i am confused. x=5 y=5 x==y - True x is y - True shouldnt x is y return False since they shouldnt(dont?) point to the same place in memory, they just store an equal value? Python's variable do not store values, they are name to object bindings. x = 5 is a

Re: Using Python for programming algorithms

2008-05-20 Thread Bruno Desthuilliers
Henrique Dante de Almeida a écrit : On May 19, 5:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The situation would be simpler if there were good well-known toolkits for optimization in python (like numpy for matrix operations), but that's not the case. There's at least Psyco (if you're

Professional Grant Proposal Writing Workshop (August 2008: Manchester, New Hampshire)

2008-05-20 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be heldin Manchester, New Hampshire on August 6 - 8, 2008. Interested development professionals, researchers, faculty, and graduate students should register as soon as possible, as demand means that seats will

Re: explain this function to me, lambda confusion

2008-05-20 Thread Arnaud Delobelle
Bruno Desthuilliers [EMAIL PROTECTED] writes: Paul McGuire a écrit : On May 19, 11:04 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: Paul McGuire [EMAIL PROTECTED] writes: [...] Could you use it as a decoratore instead? integer = Word(0123456789) @integer.setParseAction def

fafdasf

2008-05-20 Thread marco furchi
asdfdg-- http://mail.python.org/mailman/listinfo/python-list

Re: scaling problems

2008-05-20 Thread Graham Dumpleton
On May 20, 2:00 pm, James A. Donald [EMAIL PROTECTED] wrote: 2.  It is not clear to me how a python web application scales.  Python is inherently single threaded, so one will need lots of python processes on lots of computers, with the database software handling parallel accesses to

Re: addendum Re: working with images (PIL ?)

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 10:18:00 -0400, Poppy wrote: Thanks, since posting I figured out how to interpret the histogram results, which seems to be the consensus in responses. I wrote a check image program and have been periodically calling it against a folder where I make a copy of our images

compressing short strings?

2008-05-20 Thread Paul Rubin
I have a lot of short English strings I'd like to compress in order to reduce the size of a database. That is, I'd like a compression function that takes a string like (for example) George Washington and returns a shorter string, with luck maybe 6 bytes or so. One obvious idea is take the gzip

Re: Running commands on cisco routers using python

2008-05-20 Thread Hartmut Goebel
Mike Driscoll schrieb: On May 19, 10:18 am, SPJ [EMAIL PROTECTED] wrote: Is it possible to run specific commands on cisco router using Python? I have to run command show access-list on few hundred cisco routers and get the dump into a file. Please let me know if it is feasible and the best way

Re: Compress a string

2008-05-20 Thread Bruno Desthuilliers
Salvatore DI DI0 a écrit : (top-post corrected - Salvatore, please, don't top-post) Matt Porter [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi guys, I'm trying to compress a string. E.g: BBBC - ABC Try this t = set(bbc) list(t)

Re: Compress a string

2008-05-20 Thread Bruno Desthuilliers
Matt Porter a écrit : Hi guys, I'm trying to compress a string. E.g: BBBC - ABC The code I have so far feels like it could be made clearer and more succinct, but a solution is currently escaping me. def compress_str(str): using 'str' as an indentifier will shadow the builtin str

Re: TPCServer and xdrlib

2008-05-20 Thread Nick Craig-Wood
Henrique Dante de Almeida [EMAIL PROTECTED] wrote: On May 19, 10:28?am, Laszlo Nagy [EMAIL PROTECTED] wrote: I cannot predict acceptable speed requirements, but I can tell that there will be some clients downloading 100MB report files from the server, so I presume that I will need a

Re: scaling problems

2008-05-20 Thread Nick Craig-Wood
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 20 May 2008 13:57:26 +1000, James A. Donald wrote: The larger the program, the greater the likelihood of inadvertent name collisions creating rare and irreproducible interactions between different and supposedly independent parts

Re: Using Python for programming algorithms

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 08:53:11 -0700, Henrique Dante de Almeida wrote: On May 19, 6:52 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: Henrique Dante de Almeida a écrit : On May 17, 7:32 pm, Vicent Giner [EMAIL PROTECTED] wrote: Hello. (snip) However, it is usually said that

Re: Using Python for programming algorithms

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 11:07:06 -0700, Vicent Giner wrote: [...] By the way, is it possible (and easy) to call a C function from a Python program?? Yes. http://groups.google.com/group/comp.lang.python/msg/9d47913a265c348a -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-20 Thread Ulrich Eckhardt
Asun Friere wrote: Well you have to be careful in case some smartarse comes back with a class with something like this in it: def __eq__ (self, other) : if self is other : return False That's pretty paranoid. :) Who said that? (: Uli -- Sator Laser GmbH Geschäftsführer: Thorsten

Re: compressing short strings?

2008-05-20 Thread Arnaud Delobelle
Paul Rubin http://[EMAIL PROTECTED] writes: I have a lot of short English strings I'd like to compress in order to reduce the size of a database. That is, I'd like a compression function that takes a string like (for example) George Washington and returns a shorter string, with luck maybe 6

Re: Classmethods are evil

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 13:53:31 -0700, [EMAIL PROTECTED] wrote: On 17 mai, 11:50, Ivan Illarionov [EMAIL PROTECTED] wrote: On Sat, 17 May 2008 02:33:13 -0300, Gabriel Genellina wrote: En Sat, 17 May 2008 01:01:50 -0300, Ivan Illarionov [EMAIL PROTECTED] escribió: After re-reading Python is

Re: compressing short strings?

2008-05-20 Thread Thomas Troeger
Paul Rubin wrote: I have a lot of short English strings I'd like to compress in order to reduce the size of a database. That is, I'd like a compression function that takes a string like (for example) George Washington [...] Thanks. I think your idea is good, maybe you'd want to build an

Embedding Python question.

2008-05-20 Thread Thomas Troeger
Dear all, I've successfully embedded the Python interpreter into a set of C/C++ application programs that use a larger library project with information from http://docs.python.org/api/api.html and http://docs.python.org/ext/ext.html. Now I want to wrap classes and functions from the

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-20 Thread Bruno Desthuilliers
Gabriel Genellina a écrit : En Mon, 19 May 2008 17:58:48 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: On 19 mai, 22:29, Luis Zarrabeitia [EMAIL PROTECTED] wrote: (snip) The main concept here: identity [usually] implies equality, I really enjoyed the usually disclaimer !-) In some

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-20 Thread Duncan Booth
John Salerno [EMAIL PROTECTED] wrote: a = 'this is longer' b = 'this is longer' a == b True a is b False In the above example, Python has created only one string called 'hello' and both x and y reference it. However, 'this is longer' is two completely different objects. That is

Newbie In Python

2008-05-20 Thread andrew . smith . cpp
I have Heard About Python its a OOD Language. i have to Learn it where from i should start it. i have python compiler at linux Platform. anyone can suggest me about it. Thanks In advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Classmethods are evil

2008-05-20 Thread Bruno Desthuilliers
Ivan Illarionov a écrit : On Mon, 19 May 2008 13:53:31 -0700, [EMAIL PROTECTED] wrote: On 17 mai, 11:50, Ivan Illarionov [EMAIL PROTECTED] wrote: (snip) How did I come to this:http://code.djangoproject.com/changeset/7098 I measured this and there was a marginal speed increase when

subprocess - please enhance the documentation

2008-05-20 Thread Helmut Jarausch
Hi, I'd like to suggest to add a few lines to chapter 17.1.3.5 Replacing os.popen (Python Doc 2.5.2) I have used the following code in the past ARC='MyDumpFile' tar_inp= os.popen('/bin/tar cjf '+ARC+' -T -','w') tar_exit_code= tar_inp.close() if tar_exit_code != None and tar_exit_code

Re: Newbie In Python

2008-05-20 Thread Thomas Troeger
[EMAIL PROTECTED] wrote: I have Heard About Python its a OOD Language. i have to Learn it where from i should start it. i have python compiler at linux Platform. anyone can suggest me about it. Thanks In advance. How about http://docs.python.org/tut/tut.html? --

Re: Newbie In Python

2008-05-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I have Heard About Python its a OOD Language. 'OOD' = 'object oriented ???' ? i have to Learn it where from i should start it. Err... What about reading the docs on python.org - possibly starting with the tutorial: http://docs.python.org/tut/tut.html You'll

Report Lab Image Flowable Issue ..

2008-05-20 Thread dbee
I'm try to generate a report that will span multiple pages and have dynamic content using python reportlab. I have no issues with regards to generating images and then using p.drawInlineImage(signup_img, 100,150) to draw them onto the canvas. The problem that i have comes when i try to

Re: How do *you* use Python in non-GUI work?

2008-05-20 Thread David C. Ullrich
On Sun, 18 May 2008 18:20:22 -0400, John Salerno [EMAIL PROTECTED] wrote: Hey all. Just thought I'd ask a general question for my own interest. Every time I think of something I might do in Python, it usually involves creating a GUI interface, so I was wondering what kind of work you all do

Re: compressing short strings?

2008-05-20 Thread Helmut Jarausch
Paul Rubin wrote: I have a lot of short English strings I'd like to compress in order to reduce the size of a database. That is, I'd like a compression function that takes a string like (for example) George Washington and returns a shorter string, with luck maybe 6 bytes or so. One obvious

Re: svg-chart 1.1 SVG Charting Library

2008-05-20 Thread Helmut Jarausch
Jason R. Coombs wrote: I'm pleased to announce svg-chart 1.1, the first public release of a library for generating Scalable Vector Graphic (SVG) charts. http://sourceforge.net/projects/py-svg This repository seems to be still empty? Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische

Re: indexed properties...

2008-05-20 Thread David C. Ullrich
On Mon, 19 May 2008 14:48:03 +0200, pataphor [EMAIL PROTECTED] wrote: On Mon, 19 May 2008 06:29:18 -0500 David C. Ullrich [EMAIL PROTECTED] wrote: Maybe you could be more specific? Various positions I've taken in all this may well be untenable, but I can't think of any that have anything to

Re: Write bits in file

2008-05-20 Thread pataphor
On Sun, 18 May 2008 06:36:28 -0700 (PDT) Monica Leko [EMAIL PROTECTED] wrote: Yes. I need arbitrary, 8bits, than 10 bits for something else, than sequence of bytes, than 10 bits again, etc. Here's something to get you started. No guarantees, but I managed to write four 10 bit numbers to a

Re: do you fail at FizzBuzz? simple prog test

2008-05-20 Thread Wolfgang Grafen
globalrev schrieb: http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: Write a program that prints the numbers from 1 to 100. But for multiples of three print Fizz instead of the number and for the multiples of five print

Re: Running commands on cisco routers using python

2008-05-20 Thread Floris Bruynooghe
On May 19, 4:18 pm, SPJ [EMAIL PROTECTED] wrote: Is it possible to run specific commands on cisco router using Python? I have to run command show access-list on few hundred cisco routers and get the dump into a file. Please let me know if it is feasible and the best way to achieve this.

Re: Distributing applications that use 3rd party modules

2008-05-20 Thread Mike Driscoll
On May 17, 4:42 am, eliben [EMAIL PROTECTED] wrote: Hello, I'm getting into Python now after years of Perl, and as part of my research I must understand how to do some common tasks I need. I have a bunch of Windows PCs at work to which I want to distribute an application I've developed on

Re: compressing short strings?

2008-05-20 Thread bearophileHUGS
Helmut Jarausch: I'd ask in comp.compression where the specialists are listening and who are very helpful. Asking in comp.compression is a good starting point. My suggestions (sorry if they look a bit unsorted): it depends on what language you want to use, how much you want to compress the

Misuse of list comprehensions?

2008-05-20 Thread John Salerno
I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. Here's the two examples: Example 1: def compress(s): new = [] for c in s: if c not in new:

What is wrong with my Python threading?

2008-05-20 Thread Chuckk Hubbard
#!/usr/bin/python #why doesn't this run both threads simultaneously? #Thanks for any help. #Chuckk import threading import time def printesc(thrd): for i in range(10): time.sleep(1) print thrd, i def master(): thd1 = threading.Thread(target=printesc, args=(1,)) thd2

Re: compressing short strings?

2008-05-20 Thread bearophileHUGS
bearophile: So you need to store only this 11 byte long string to be able to decompress it. Note that maybe there is a header, that may contain changing things, like the length of the compressed text, etc. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: do you fail at FizzBuzz? simple prog test

2008-05-20 Thread castironpi
On May 20, 6:57 am, Wolfgang Grafen [EMAIL PROTECTED] wrote: globalrev schrieb: http://reddit.com/r/programming/info/18td4/comments claims people take a lot of time to write a simple program like this: Write a program that prints the numbers from 1 to 100. But for multiples of three

Re: What is wrong with my Python threading?

2008-05-20 Thread castironpi
On May 20, 8:19 am, Chuckk Hubbard [EMAIL PROTECTED] wrote: #!/usr/bin/python #why doesn't this run both threads simultaneously? #Thanks for any help. #Chuckk import threading import time def printesc(thrd):     for i in range(10):         time.sleep(1)         print thrd, i def

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
John Salerno wrote: I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. Here's the two examples: Example 1: def compress(s): new = [] for c in s: if c not

Re: test mult vars to same value, how to shorten expr?

2008-05-20 Thread castironpi
On May 20, 2:08 am, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote:  if i want o test: if a == 5 and b ==5 and c==5 ... z==5 is there some synctactic suagr for this? rather than maiking one of my own i mean, something built-in like: if a,b,c... z == 5: if all(x == 5

Re: What is wrong with my Python threading?

2008-05-20 Thread Diez B. Roggisch
Chuckk Hubbard wrote: #!/usr/bin/python #why doesn't this run both threads simultaneously? #Thanks for any help. #Chuckk Because you should call thread.start(). Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-20 Thread brad
Vicent Giner wrote: The usual answer is that development time is more important than running time. This depends. Run time is not important until you are asked to scale to millions or billions of users or computations or large data sets. I've seen this first hand. Getting results back the

Re: Distributing applications that use 3rd party modules

2008-05-20 Thread castironpi
On May 20, 7:56 am, Mike Driscoll [EMAIL PROTECTED] wrote: On May 17, 4:42 am, eliben [EMAIL PROTECTED] wrote: Hello, I'm getting into Python now after years of Perl, and as part of my research I must understand how to do some common tasks I need. I have a bunch of Windows PCs at

Re: Misuse of list comprehensions?

2008-05-20 Thread bearophileHUGS
John Salerno: What does everyone think about this? The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: indexed properties...

2008-05-20 Thread pataphor
On Tue, 20 May 2008 06:12:01 -0500 David C. Ullrich [EMAIL PROTECTED] wrote: Well, ok. Like I said, I never _took_ the position that it _should_ be a list of lists, I just said I didn't see the advantage to using a single list. I'm now thinking about a list of lists containing single element

RE: Newbie In Python

2008-05-20 Thread Sells, Fred
get a python-aware editor. I vary between emacs and Eclipse, depending on my mood and the size of the project. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bruno Desthuilliers Sent: Tuesday, May 20, 2008 6:25 AM To: python-list@python.org

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: John Salerno: What does everyone think about this? The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). No, it doesn't. It uses append because it refers to itself in the if-expression. So the append(c) is needed - and thus

Re: compressing short strings?

2008-05-20 Thread castironpi
On May 20, 8:24 am, [EMAIL PROTECTED] wrote: bearophile: So you need to store only this 11 byte long string to be able to decompress it. Note that maybe there is a header, that may contain changing things, like the length of the compressed text, etc. Bye, bearophile I've read that

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-20 Thread castironpi
On May 20, 5:04 am, Duncan Booth [EMAIL PROTECTED] wrote: John Salerno [EMAIL PROTECTED] wrote: a = 'this is longer' b = 'this is longer' a == b True a is b False In the above example, Python has created only one string called 'hello' and both x and y reference it. However, 'this

Re: scaling problems

2008-05-20 Thread Duncan Booth
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Tue, 20 May 2008 10:47:50 +1000, James A. Donald wrote: 2. It is not clear to me how a python web application scales. Ask YouTube. :-) Or look at Google appengine where unlike normal Python you really are prevented from making good

persistent deque

2008-05-20 Thread castironpi
I'd like a persistent deque, such that the instance operations all commit atomicly to file system. -- http://mail.python.org/mailman/listinfo/python-list

Re: Misuse of list comprehensions?

2008-05-20 Thread Bruno Desthuilliers
John Salerno a écrit : I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. (snip) def compress(s): new = [] [new.append(c) for c in s if c not in new] return ''.join(new) As far as I'm

Re: Using Python for programming algorithms

2008-05-20 Thread Duncan Booth
Roel Schroeven [EMAIL PROTECTED] wrote: C OTOH was designed to be compiled to assembly code (or directly to machine code) and as a result there are no (or virtually) no implementations that interpret C or compile it to bytecode. Have you considered Microsoft's C/C++ compiler targetted at

Re: TPCServer and xdrlib

2008-05-20 Thread Laszlo Nagy
- use simple file copying from a mounted network drive Untrustable clients should not mount out anything from my server. (Also, it is not a protocol. I need to communicate with a real program, not just copying files.) - use http (web server) I mentioned this before - don't know how to

Re: Misuse of list comprehensions?

2008-05-20 Thread Hrvoje Niksic
Diez B. Roggisch [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: John Salerno: What does everyone think about this? The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). No, it doesn't. This line: [new.append(c) for c in s if c not in

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
Hrvoje Niksic wrote: Diez B. Roggisch [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: John Salerno: What does everyone think about this? The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). No, it doesn't. This line:

Re: Misuse of list comprehensions?

2008-05-20 Thread Thomas Bellman
Diez B. Roggisch [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). No, it doesn't. It uses append because it refers to itself in the if-expression. So the append(c) is needed - and thus the

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
Thomas Bellman wrote: Diez B. Roggisch [EMAIL PROTECTED] writes: [EMAIL PROTECTED] wrote: The Example 2 builds a list, that is then thrown away. It's just a waste of memory (and time). No, it doesn't. It uses append because it refers to itself in the if-expression. So the append(c) is

Re: Using Python for programming algorithms

2008-05-20 Thread Arnaud Delobelle
brad [EMAIL PROTECTED] writes: Vicent Giner wrote: The usual answer is that development time is more important than running time. This depends. Run time is not important until you are asked to scale to millions or billions of users or computations or large data sets. I've seen this first

Re: Misuse of list comprehensions?

2008-05-20 Thread Diez B. Roggisch
That being said, I use that idiom myself. But I don't see anything wrong with using a list-comp as loop-abbreviation. because that is it's actual purpose. And also it is common in non-functional languages that l-values aren't always assigned, if the aren't needed. It's the consequence of

Re: Misuse of list comprehensions?

2008-05-20 Thread Paul McGuire
On May 20, 8:13 am, John Salerno [EMAIL PROTECTED] wrote: I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. Here's the two examples: Example 1: def compress(s):     new = []  

Help with character encodings

2008-05-20 Thread A_H
Help! I've scraped a PDF file for text and all the minus signs come back as u'\xad'. Is there any easy way I can change them all to plain old ASCII '-' ??? str.replace complained about a missing codec. Hints? -- http://mail.python.org/mailman/listinfo/python-list

Re: Misuse of list comprehensions?

2008-05-20 Thread Arnaud Delobelle
Paul McGuire [EMAIL PROTECTED] writes: On May 20, 8:13 am, John Salerno [EMAIL PROTECTED] wrote: I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. Here's the two examples: Example 1:

Re: Help with character encodings

2008-05-20 Thread Gary Herron
A_H wrote: Help! I've scraped a PDF file for text and all the minus signs come back as u'\xad'. Is there any easy way I can change them all to plain old ASCII '-' ??? str.replace complained about a missing codec. Hints? Encoding it into a 'latin1' encoded string seems to work:

Python in non-standard location erring with No module named _sha256

2008-05-20 Thread emallove
I'm running into the below No modules named _sha256 issue, with a python installed in a non-standard location. $ python Python 2.5.2 (r252:60911, May 20 2008, 09:46:50) [GCC 3.3.3 (SuSE Linux)] on linux2 Type help, copyright, credits or license for more information. import md5 Traceback (most

Re: Write bits in file

2008-05-20 Thread Nick Craig-Wood
Monica Leko [EMAIL PROTECTED] wrote: On May 18, 2:20?pm, Ken Starks [EMAIL PROTECTED] wrote: You want your file considered as a sequence of bits rather than a sequence of 8-bit bytes, do you? Yes. is the 10-bit bit-pattern to be stored at an arbitrary bit-position in the file

Re: indexed properties...

2008-05-20 Thread David C. Ullrich
In article [EMAIL PROTECTED], pataphor [EMAIL PROTECTED] wrote: On Tue, 20 May 2008 06:12:01 -0500 David C. Ullrich [EMAIL PROTECTED] wrote: Well, ok. Like I said, I never _took_ the position that it _should_ be a list of lists, I just said I didn't see the advantage to using a single

Re: Help with character encodings

2008-05-20 Thread J. Cliff Dyer
On Tue, 2008-05-20 at 08:28 -0700, Gary Herron wrote: A_H wrote: Help! I've scraped a PDF file for text and all the minus signs come back as u'\xad'. Is there any easy way I can change them all to plain old ASCII '-' ??? str.replace complained about a missing codec. Hints?

Re: Misuse of list comprehensions?

2008-05-20 Thread s0suk3
On May 20, 9:58 am, Paul McGuire [EMAIL PROTECTED] wrote: On May 20, 8:13 am, John Salerno [EMAIL PROTECTED] wrote: I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list comprehension. Here's the two examples:

Re: Misuse of list comprehensions?

2008-05-20 Thread Paul McGuire
On May 20, 10:17 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: Paul McGuire [EMAIL PROTECTED] writes: On May 20, 8:13 am, John Salerno [EMAIL PROTECTED] wrote: I posted this code last night in response to another thread, and after I posted it I got to wondering if I had misused the list

Re: Misuse of list comprehensions?

2008-05-20 Thread Paul McGuire
On May 20, 10:50 am, [EMAIL PROTECTED] wrote: You don't need all those conditionals. A set differs from a list precisely in the fact that each element is unique. And since the function is expecting s to be an iterable object, it can be constructed even without a for loop: def compress(s):  

Re: Help with character encodings

2008-05-20 Thread Gary Herron
Gary Herron wrote: A_H wrote: Help! I've scraped a PDF file for text and all the minus signs come back as u'\xad'. Is there any easy way I can change them all to plain old ASCII '-' ??? str.replace complained about a missing codec. Hints? Encoding it into a 'latin1' encoded string

Removing Space and - from a string

2008-05-20 Thread Ahmed, Shakir
I have thousands of records in MS Access database table, which records I am fetching using python script. One of the columns having string like '8 58-2155-58' Desired output: '858215558' I want to remove any spaces between string and any dashes between strings. I could do it in access manually

Re: addendum Re: working with images (PIL ?)

2008-05-20 Thread Poppy
Thank you and the other responders have given me something to consider, I understand the concept of the posterize idea and will be experimenting with that. I wanted to respond to this statement below which is true, however I believe the histogram sums the values so both colors would be in bin

Re: Showing the method's class in expection's traceback

2008-05-20 Thread Gabriel Genellina
En Mon, 19 May 2008 10:54:05 -0300, Agustin Villena [EMAIL PROTECTED] escribió: On May 18, 4:31 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Agustin Villena schrieb: is there anyway to show the class of amethodin an exception's traceback? I want to improve the line File

Re: Removing Space and - from a string

2008-05-20 Thread s0suk3
On May 20, 11:02 am, Ahmed, Shakir [EMAIL PROTECTED] wrote: I have thousands of records in MS Access database table, which records I am fetching using python script. One of the columns having string like '8 58-2155-58' Desired output: '858215558' I want to remove any spaces between string

Re: Misuse of list comprehensions?

2008-05-20 Thread Paul Hankin
On May 20, 3:58 pm, Paul McGuire [EMAIL PROTECTED] wrote: def compress(s): seen = set() return ''.join(c for c in s if c not in seen and (seen.add(c) or True)) Slightly nicer is to move the set add out of the conditional... def compress(s): seen = set() return

Accumulating values in dictionary

2008-05-20 Thread Zack
Given a bunch of objects that all have a certain property, I'd like to accumulate the totals of how many of the objects property is a certain value. Here's a more intelligible example: Users all have one favorite food. Let's create a dictionary of favorite foods as the keys and how many people

Re: default gettext localedir on windows

2008-05-20 Thread ZeeGeek
On May 17, 8:39 pm, Thorsten Kampe [EMAIL PROTECTED] wrote: * ZeeGeek (Sun, 4 May 2008 10:56:52 -0700 (PDT)) On May 5, 1:16 am, Thorsten Kampe [EMAIL PROTECTED] wrote: * ZeeGeek (Sun, 4 May 2008 08:59:05 -0700 (PDT)) Hi, what's the default localedir for gettext module on windows? In

RE: Removing Space and - from a string

2008-05-20 Thread Ahmed, Shakir
Thanks, works exactly what I needed. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 20, 2008 12:22 PM To: python-list@python.org Subject: Re: Removing Space and - from a string On May 20, 11:02 am, Ahmed, Shakir

Re: Misuse of list comprehensions?

2008-05-20 Thread Arnaud Delobelle
Paul McGuire [EMAIL PROTECTED] writes: On May 20, 10:17 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: [...] split hairs Isn't     c not in seen and (seen.add(c) or True) the same as     seen.add(c) or c not in seen ?     return ''.join(new) (notice I haven't closed the tag!) --

Re: Removing Space and - from a string

2008-05-20 Thread python
Shakir, I have thousands of records in MS Access database table, which records I am fetching using python script. One of the columns having string like '8 58-2155-58' Desired output: '858215558' I want to remove any spaces between string and any dashes between strings. I could do it in

  1   2   3   >