Re: Finding the instance reference of an object

2008-10-27 Thread Gabriel Genellina
En Tue, 28 Oct 2008 01:16:04 -0200, Dale Roberts <[EMAIL PROTECTED]> escribió: So, then, what to tell a C++ programmer about how Python passes arguments? You say: tell them Python only passes by value. I disagree, because I think that would confuse them. Rather than try to map C++ convent

Re: ........ JUNGLE BUNNIES IN ALASKA ..........

2008-10-27 Thread Sydney Gondomer
On Sun, 15 May 2005 22:55:25 -0500, Michel Catudal <[EMAIL PROTECTED]> wrote: >Richard Keebler wrote: > > > > >I found the perfect site for assholes like you > >http://www.amishrakefight.org/gfy/ Are there any of GOD's frozen chosen beautiful African Americans on this Alaska forum? I would like

Re: Looking for a pure python Mysql module

2008-10-27 Thread James Mills
On Tue, Oct 28, 2008 at 9:41 AM, Carl <[EMAIL PROTECTED]> wrote: > Does anyone know of a package that can connect and query a mysql server that > is platform independent and does not need to compile any extra c modules (IE > a pure python module)? There was a recent discussion on this mailing list

Re: Finding the instance reference of an object

2008-10-27 Thread Gabriel Genellina
En Tue, 28 Oct 2008 00:58:10 -0200, greg <[EMAIL PROTECTED]> escribió: Steven D'Aprano wrote: By common usage and technical definition, C is call by value. Argument passing in Python does not behave like C. So why insist that Python is also call by value? Whether it behaves like C is no

Re: project in python

2008-10-27 Thread alex23
On Oct 26, 2:51 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > The more you spam people with your repetitive postings, the less likely it > becomes that they are willing to answer you. In asit's defence, the Google Groups interface has been woefully broken for the past 3-4 days. If e had posted vi

Re: Finding the instance reference of an object

2008-10-27 Thread Douglas Alan
greg <[EMAIL PROTECTED]> writes: > Seems to me that (1) describes exactly how parameter passing > works in Python. So why insist that it's *not* call by value? Because there's an important distinction to be made, and the distinction has been written up in the Computer Science literature since Lis

Re: lxml removing tag, keeping text order

2008-10-27 Thread Tim Arnold
"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Tim Arnold schrieb: >> Hi, >> Using lxml to clean up auto-generated xml to validate against a dtd; I >> need >> to remove an element tag but keep the text in order. For example >> s0 = ''' >> >>first text >> la

Re: PIL: Getting a two color difference between images

2008-10-27 Thread Kevin D . Smith
On 2008-10-25 12:41:51 -0500, [EMAIL PROTECTED] said: Kevin D. Smith: What I want is a two color output image: black where the image wasn't different, and white where it was different.< There are several ways to do that. If speed isn't essential, then you can create a third blank image of the

Re: Finding the instance reference of an object

2008-10-27 Thread Dale Roberts
[I am actually enjoying this discussion, even though it does not address the OP's question. It is helping to solidify *my* understanding.] Joe Strout wrote: On Oct 27, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote: I think this "uncontrived" example addresses the C/Python difference fairly direc

Re: Finding the instance reference of an object

2008-10-27 Thread greg
Steven D'Aprano wrote: By common usage and technical definition, C is call by value. Argument passing in Python does not behave like C. So why insist that Python is also call by value? Whether it behaves like C is not the test. Let's look at the definitions of the terms: (1) Call by value:

Re: Ordering python sets

2008-10-27 Thread greg
On approximately 10/27/2008 10:27 AM, came the following characters from the keyboard of Peter Otten: Here's a class that can negate arbitrary values ... def __init__(self, value): ... self.value = value ... def __cmp__(self, other): ... return -cmp(self.value, o

Database specialized in storing directed graphs?

2008-10-27 Thread Carl Banks
I was wondering if anyone had any advice on this. This is not to study graph theory; I'm using the graph to represent a problem domain. The graphs could be arbitrarily large, and could easily have millions of nodes, and most nodes have a substantial amount of data associated with them. Obviously

Looking for a pure python Mysql module

2008-10-27 Thread Carl
Does anyone know of a package that can connect and query a mysql server that is platform independent and does not need to compile any extra c modules (IE a pure python module)? -- http://mail.python.org/mailman/listinfo/python-list

Re: question about the textwrap module

2008-10-27 Thread Gabriel Genellina
En Mon, 27 Oct 2008 20:50:08 -0200, TP <[EMAIL PROTECTED]> escribió: Recently, I have tried to improve the look of the printed text in command line. For this, I was compelled to remove redundant spaces in strings, because in my scripts, often the strings are spreading on several lines. For ex

Re: Finding the instance reference of an object

2008-10-27 Thread Chuckk Hubbard
I'm sorry to say I'm pretty confused by the example, but if you want something like bob = module.object() frank = module.object() and then to know that bob is bob from a list of instances, you could instead do something like: for person in listofnames: temp = module.object(person) list.

Re: Porting VB apps to Python for Window / Linux use

2008-10-27 Thread Steven D'Aprano
On Mon, 27 Oct 2008 12:31:06 +1100, Ben Finney wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > >> Software has no market value. Business models that try to assign it one >> are doomed to fight an uphill battle against market forces. > > +1 QOTW. -1 That quote confuses the *cost* of

Re: Finding the instance reference of an object

2008-10-27 Thread Steven D'Aprano
On Mon, 27 Oct 2008 13:11:04 -0600, Joe Strout wrote: > On Oct 27, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote: > >> I think this "uncontrived" example addresses the C/Python difference >> fairly directly (both were tested): > > That's correct, but of course, C is a decades-old language barely a

question about the textwrap module

2008-10-27 Thread TP
Hi everybody, Recently, I have tried to improve the look of the printed text in command line. For this, I was compelled to remove redundant spaces in strings, because in my scripts, often the strings are spreading on several lines. For example, "aaa bbb" had to be transformed in "aaa bbb". I ha

Re: Converting a time string to a more readable date, time

2008-10-27 Thread Scott David Daniels
Thierry Lam wrote: I have a python time string which has the following value: 1225137896 The above corresponds to 2008/10/27 16:04:56 What can I use to convert 1225137896 to a more readable date, time format? (1) Read Smart Questions [you could at least have told us where this number came f

Re: Type feedback tool?

2008-10-27 Thread Martin Vilcans
Thanks everyone for the suggestions. I've implemented a simple solution using sys.settrace. It's quite nice because it doesn't require any instrumentation of the code (it works like a debugger that traps all function calls). Here's the output I get right now when "profiling" Skip's example code (b

Re: Unpacking byte strings from a file of unknown size

2008-10-27 Thread Terry Reedy
Mark wrote: Hi; I'm trying to use the struct.unpack to extract an int, int, char struct info from a file. I'm more accustomed to the file.readlines which works well in a 'for' construct (ending loop after reaching EOF). You do not need .readlines to iterate through a file by lines. for line

Re: Unpacking byte strings from a file of unknown size

2008-10-27 Thread Gabriel Genellina
En Mon, 27 Oct 2008 19:03:37 -0200, Steven Clark <[EMAIL PROTECTED]> escribió: On Mon, Oct 27, 2008 at 4:29 PM, Mark <[EMAIL PROTECTED]> wrote: Hi; I'm trying to use the struct.unpack to extract an int, int, char struct info from a file. I'm more accustomed to the file.readlines which works

Re: FTP via web browser

2008-10-27 Thread Diez B. Roggisch
rodmc schrieb: Hi, I have posted elsewhere about a related topic. But I an curious is it possible to set up a web form which people select a file for upload which is then upload it via FTP protocol to the web server - the entire process must be web based and not require an external FTP client. T

Re: Finding the instance reference of an object

2008-10-27 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Oct 17, 5:39 pm, Joe Strout <[EMAIL PROTECTED]> wrote: On Oct 17, 2008, at 3:19 PM, Grant Edwards wrote: No, it isn't. In many other languages (C, Pascal, etc.), a "variable" is commonly thought of as a fixed location in memory into which one can put values. Thos

Re: Linq to Python

2008-10-27 Thread Duncan Booth
"Tim Rowe" <[EMAIL PROTECTED]> wrote: >> I haven't yet had occasion to use LINQ in anger yet, so I have no >> idea whether its an idea to love or to hate. I do think it is good >> that C# has effectively sprouted list comprehensions (not to mention >> anonymous types and type inferencing) and I ex

Re: Ordering python sets

2008-10-27 Thread Carl Banks
On Oct 25, 4:58 am, Lie Ryan <[EMAIL PROTECTED]> wrote: > On Wed, 22 Oct 2008 10:43:35 -0700, bearophileHUGS wrote: > > Mr.SpOOn: > >> Is there another convenient structure or shall I use lists and define > >> the operations I need? > > > > > As Python becomes accepted for more and more "serious"

Re: Converting a time string to a more readable date, time

2008-10-27 Thread Benjamin Kaplan
On Mon, Oct 27, 2008 at 4:45 PM, Thierry Lam <[EMAIL PROTECTED]> wrote: > I have a python time string which has the following value: > > 1225137896 > > The above corresponds to 2008/10/27 16:04:56 > > What can I use to convert 1225137896 to a more readable date, time > format? > -- >>> from date

Re: Unpacking byte strings from a file of unknown size

2008-10-27 Thread Steven Clark
On Mon, Oct 27, 2008 at 4:29 PM, Mark <[EMAIL PROTECTED]> wrote: > Hi; > > I'm trying to use the struct.unpack to extract an int, int, char > struct info from a file. I'm more accustomed to the file.readlines > which works well in a 'for' construct (ending loop after reaching > EOF). > > # This do

Re: Python barcode decoding

2008-10-27 Thread Robocop
On Oct 24, 1:24 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Oct 24, 12:05 pm,Robocop<[EMAIL PROTECTED]> wrote: > > > Does anyone know of any decent (open source or commercial) python > > barcode recognition tools or libraries.  I need to read barcodes from > > pdfs or images, so it will invol

Re: Python barcode decoding

2008-10-27 Thread Robocop
On Oct 24, 1:24 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Oct 24, 12:05 pm, Robocop <[EMAIL PROTECTED]> wrote: > > > Does anyone know of any decent (open source or commercial) python > >barcoderecognition tools or libraries.  I need to read barcodes from > > pdfs or images, so it will invol

Converting a time string to a more readable date, time

2008-10-27 Thread Thierry Lam
I have a python time string which has the following value: 1225137896 The above corresponds to 2008/10/27 16:04:56 What can I use to convert 1225137896 to a more readable date, time format? -- http://mail.python.org/mailman/listinfo/python-list

Re: example for PEP 342

2008-10-27 Thread Terry Reedy
Severin wrote: Hello, Is there a simple example demonstrating how to use the Trampoline from PEP 342 (http://www.python.org/dev/peps/pep-0342/)? In the examples section toward the end 3. A simple co-routine scheduler or "trampoline" that lets coroutines "call" other coroutines by yie

Unpacking byte strings from a file of unknown size

2008-10-27 Thread Mark
Hi; I'm trying to use the struct.unpack to extract an int, int, char struct info from a file. I'm more accustomed to the file.readlines which works well in a 'for' construct (ending loop after reaching EOF). # This does OK at fetching one 10-byte string at a time: # (4, 4, 2 ascii chars represen

Re: Ordering python sets

2008-10-27 Thread bearophileHUGS
Lie Ryan: >Oh no, the two dict implementation would work _exactly_ the same from the >outside, they are transparently interchangeable. Only the performance >characteristic differs because of the different implementation.< I don't agree with the general idea. If the operations done by your data

RE: Web crawler on python

2008-10-27 Thread Support Desk
-Original Message- From: James Mills [mailto:[EMAIL PROTECTED] Sent: Sunday, October 26, 2008 5:26 PM To: sonich Cc: python-list@python.org Subject: Re: Web crawler on python On Mon, Oct 27, 2008 at 6:54 AM, sonich <[EMAIL PROTECTED]> wrote: > I need simple web crawler, > I found Ruya,

Pydev 1.3.24 Released

2008-10-27 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.3.24 have been released This is a high-priority release to fix some blocker bugs (that's why it was released in such a short time from the last release) Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on

Re: Proposal for thread-safe Tkinter

2008-10-27 Thread Steve Holden
Allen Taylor wrote: > I was given the task of upgrading a Python/Tkinter GUI application to > the latest versions of Python and Tk. After a while, I realized that the > application had not been written in a thread-safe manner. Multiple > threads would simply use the Tk object directly. The applicat

Re: Finding the instance reference of an object

2008-10-27 Thread Joe Strout
On Oct 27, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote: I think this "uncontrived" example addresses the C/Python difference fairly directly (both were tested): That's correct, but of course, C is a decades-old language barely a step above assembler. For a fair comparison, pick any modern OO

Re: Finding the instance reference of an object

2008-10-27 Thread Dale Roberts
On Oct 17, 5:39 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 17, 2008, at 3:19 PM, Grant Edwards wrote: > > >> And my real point is that this is exactly the same as in every > >> other modern language. > > > No, it isn't. In many other languages (C, Pascal, etc.), a > > "variable" is commonl

Re: redirection of standard output of a Python command to a Python variable

2008-10-27 Thread Gabriel Genellina
En Mon, 27 Oct 2008 16:03:45 -0200, TP <[EMAIL PROTECTED]> escribió: Hi everybody, I try to find a quick way to redirect the standard output of a Python command (for example: print "message") to a python variable "foobar". Ok, in this simple example, I could do foobar = "message", but in fact

Re: Simple print to stderr

2008-10-27 Thread Matt Nordhoff
RC wrote: > By default the print statement sends to stdout > I want to send to stderr > > Try > > print "my meeage", file=sys.stderr > > I got >> SyntaxError: invalid syntax > > I try > > print "my message", sys.stderr > > But it still sent to stdout. > What is the syntax? > > I wouldn't und

Simple print to stderr

2008-10-27 Thread RC
By default the print statement sends to stdout I want to send to stderr Try print "my meeage", file=sys.stderr I got SyntaxError: invalid syntax I try print "my message", sys.stderr But it still sent to stdout. What is the syntax? I wouldn't understand Python's manual print([object,

[no subject]

2008-10-27 Thread janandith jayawardena
-- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-27 Thread gooberts
On Oct 17, 5:39 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 17, 2008, at 3:19 PM, Grant Edwards wrote: > > >> And my real point is that this is exactly the same as in every > >> other modern language. > > > No, it isn't.  In many other languages (C, Pascal, etc.), a > > "variable" is commonl

Re: big objects and avoiding deepcopy?

2008-10-27 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Robert Kern: This is similar to implementing "Undo" functionality in applications.< In a quite-high-level language (like Python, but not necessarily in Python itself) it may become eventually advantageous to add some (even limited) built-in form of undo. Right now, I

Re: Finding Default Page Name using urllib2

2008-10-27 Thread M�ta-MCI (MVP)
Hi! Can I do this in python? No. The "default page" is a property of the web-server ; and it is not client side. Examples : for Apache, it's index.html or index.htm ; but if PHP is installed, index.php is also possible. for APS, it's init.htm (between others possibilites). etc. @-s

redirection of standard output of a Python command to a Python variable

2008-10-27 Thread TP
Hi everybody, I try to find a quick way to redirect the standard output of a Python command (for example: print "message") to a python variable "foobar". Ok, in this simple example, I could do foobar = "message", but in fact 'print "message"' could be replaced by any Python function writing on sta

Re: [Python 2.6] print_function and unicode_literals cannot be used at the same time?

2008-10-27 Thread Terry Reedy
Gabriel Genellina wrote: En Sun, 26 Oct 2008 12:13:08 -0200, Christian Heimes <[EMAIL PROTECTED]> escribió: ?? wrote: Any ideas? Code 1: from __future__ import print_function, unicode_literals import sys print(type('HELLO, WORLD!'), file=sys.stderr) You have to do each future import i

Re: Finding the instance reference of an object

2008-10-27 Thread Douglas Alan
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I understand that Python's object and calling semantics are exactly the > same as Emerald (and likely other languages as well), and that both > Emerald and Python are explicitly based on those of CLU, as described by > by Barbara Liskov in 1979: > >

Re: Improving interpreter startup speed

2008-10-27 Thread Terry Reedy
James Mills wrote: So instead of coming up with arbitary problems, why don't we come up with solutions for "Improving Interpreter Startup Speeds" ? The current developers, most of whom use Python daily, are aware that faster startup would be better. 2.6 and 3.0 start up quicker because the s

Re: Improving interpreter startup speed

2008-10-27 Thread Terry Reedy
David Cournapeau wrote: On Mon, Oct 27, 2008 at 2:36 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: It this a theoretical problem or an actual one, that we might have other suggestions for? Any command line based on python is a real example of that problem. No it is not. The specific problem tha

Re: Ordering python sets

2008-10-27 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Glenn Linderman: > >> how does one create a key that corresponds to ascending integer followed >> by descending character string? > > (Others may have already answered you because Google groups is very > slow.) > seq = [(10, "abb"), (5, "zul"), (5, "hal"), (2, "o

Re: using modules in destructors

2008-10-27 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: It seems to me that deleting local instances before imported modules would solve the problem. Is it not possible for the interpreter to get this right? Or are there cases where this would break stuff. It seems rather unpythonic for the __del__() method to become unpredic

Re: dictionary

2008-10-27 Thread Scott David Daniels
Hendrik van Rooyen wrote: ... You had Compilers! You had Compiler Vendors! When I was lad, we had nowt but raw hardware. We had to sit in cold room, ears deafened by whine of fan, clicking switches to load our octal in computer. We just had error light... You had octal! We just had oscillosc

Re: big objects and avoiding deepcopy?

2008-10-27 Thread bearophileHUGS
Robert Kern: > This is similar to implementing "Undo" functionality in applications.< In a quite-high-level language (like Python, but not necessarily in Python itself) it may become eventually advantageous to add some (even limited) built-in form of undo. Both to give a simpler way to implement a

Re: Limit between 0 and 100

2008-10-27 Thread bearophileHUGS
(Sorry for the answering delay, Google groups is very slow.) James: >P.S. I don't understand a lot of what I have there, I got most of it from the >beginning tutorials and help sections. I have never programmed before, but >this is for a school assignment.< You must understand what you do at s

Re: Ordering python sets

2008-10-27 Thread bearophileHUGS
Glenn Linderman: > how does one create a key that corresponds to ascending integer followed by > descending character string? (Others may have already answered you because Google groups is very slow.) >>> seq = [(10, "abb"), (5, "zul"), (5, "hal"), (2, "of")] >>> sorted(seq, key=lambda (n,s): (

Re: Do a Gnuplot of a file in python

2008-10-27 Thread Santix
Thanks a lot because it works with g.load("power.p") But now I have this problem gnuplot> load 'power.p' gnuplot> set terminal postscript enhanced color gnuplot> set output "spectrum.ps" gnuplot> plot gnuplot> set terminal x11 gnuplot> set output gnuplot> plot ^ line

Re: Limit between 0 and 100

2008-10-27 Thread Matimus
On Oct 25, 1:42 pm, [EMAIL PROTECTED] wrote: > Hi. I'm very new to Python, and so this is probably a pretty basic > question, but I'm lost. I am looking to limit a float value to a > number between 0 and 100 (the input is a percentage). > > I currently have: > > integer = int() > running = True > >

Re: Linq to Python

2008-10-27 Thread Tim Rowe
2008/9/24 Duncan Booth <[EMAIL PROTECTED]>: > Python still wins hands down on this example both in verbosity and > readability: But AFAICS, the Python version you give creates a temporary. One of the advantages cited for LINQs functional programming paradigm is that it specifies what is wanted a

Re: Finding Default Page Name using urllib2

2008-10-27 Thread Philip Semanchuk
On Oct 27, 2008, at 12:17 PM, barrett wrote: Is there a way to find the name of a page you are retrieving using python. For example, if I get http://www.cnn.com/ i want to know that the page is index.html. I can do this using wget. as seen in the code below. Can I do this in python? Hi bar

Finding Default Page Name using urllib2

2008-10-27 Thread barrett
Is there a way to find the name of a page you are retrieving using python. For example, if I get http://www.cnn.com/ i want to know that the page is index.html. I can do this using wget. as seen in the code below. Can I do this in python? Thanks, $ wget cnn.com --11:15:25-- http://cnn.com/

Python-URL! - weekly Python news and links (Oct 27)

2008-10-27 Thread Gabriel Genellina
QOTW: "But it is the right idea. They just don't know what it means, because they've been listening to people like you who insist on using Pascal terminology with a definition unrecognizable to Pascal programmers. To an ex-Pascal programmer like myself, when you talk about 'call by value where the

Re: Do I need a lock here?

2008-10-27 Thread Michael Sparks
jasiu85 wrote: > Do I need a lock to protect the COMMON_DICT dictionary? AFAIK bytecode > operations are atomic and in each thread there's only one crucial > bytecode op: STORE_NAME in the first thread and LOAD_NAME in the > second one. So I suspect that everything will work just fine. Am I > righ

Re: Triple-quoted strings hath not the Python-nature

2008-10-27 Thread Steven D'Aprano
On Mon, 27 Oct 2008 12:11:34 +1300, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steven D'Aprano > wrote: > >> I disagree. Triple-quoted strings are exactly the same as other >> strings: they capture *exactly* what you put in them ... > > But that conflicts with the use of whites

Post easy_install hooks/message

2008-10-27 Thread Orestis Markou
Hello, I've finally uploaded PySmell [1] to PyPI [2], thanks to a fantastic contributor which did all the work for me. As I've written in a blog post [3], I have some trouble distributing some support files, notably, a vim script. I am currently using these directives: data_files = [

Re: Type feedback tool?

2008-10-27 Thread Orestis Markou
I think that rope has something like that; not really sure though. On Mon, Oct 27, 2008 at 1:41 AM, <[EMAIL PROTECTED]> wrote: > > (Sorry for any repeated recommendations. I'm offline until Monday morning. > You may well see some of these suggestions in the meanwhile, but so far it > seems you'v

Re: xchat

2008-10-27 Thread Tino Wildenhain
Hi, luca72 wrote: Hello i have installed xchat on suse11 i see that there is the possibility to use python for make some script, i see also that the python interface is loaded, but when in python i type import xchat i get that the module don't exist. where is the module? I try also to ask in th

Re: Type feedback tool?

2008-10-27 Thread skip
(Sorry for any repeated recommendations. I'm offline until Monday morning. You may well see some of these suggestions in the meanwhile, but so far it seems you've had no nibbles.) Martin> I'm wondering if there's a tool that can analyze a Python Martin> program while it runs, and generat

xchat

2008-10-27 Thread luca72
Hello i have installed xchat on suse11 i see that there is the possibility to use python for make some script, i see also that the python interface is loaded, but when in python i type import xchat i get that the module don't exist. where is the module? I try also to ask in the xchat forum but i g

Re: Do I need a lock here?

2008-10-27 Thread Duncan Booth
jasiu85 <[EMAIL PROTECTED]> wrote: > Hey, > > Please take a look at the code of the two threads below: > > COMMON_DICT = {} > > def thread_1(): > global COMMON_DICT > local_dict = prepare_dict() > COMMON_DICT = local_dict > > def thread_2(): > global COMMON_DICT > local_dic

Re: conversion to and from unicode strings

2008-10-27 Thread Duncan Booth
abhishek <[EMAIL PROTECTED]> wrote: > hello group, > i want to represent and store a string u'\x00\x07\xa7' as > '\x00\x07\xa7'. any ideas on how to achieve this. You can use latin-1 encoding. >>> u = ''.join(unichr(c) for c in range(256)) >>> [ord(c) for c in u.encode('latin1')] == range(256)

Re: FTP via web browser

2008-10-27 Thread Tino Wildenhain
rodmc wrote: Hi, I have posted elsewhere about a related topic. But I an curious is it possible to set up a web form which people select a file for upload which is then upload it via FTP protocol to the web server - the entire process must be web based and not require an external FTP client. The

Re: Type feedback tool?

2008-10-27 Thread M.-A. Lemburg
On 2008-10-26 13:54, Martin Vilcans wrote: > Hi list, > > I'm wondering if there's a tool that can analyze a Python program > while it runs, and generate a database with the types of arguments and > return values for each function. In a way it is like a profiler, that > instead of measuring how of

FTP via web browser

2008-10-27 Thread rodmc
Hi, I have posted elsewhere about a related topic. But I an curious is it possible to set up a web form which people select a file for upload which is then upload it via FTP protocol to the web server - the entire process must be web based and not require an external FTP client. The reason for ask

example for PEP 342

2008-10-27 Thread Severin
Hello, Is there a simple example demonstrating how to use the Trampoline from PEP 342 (http://www.python.org/dev/peps/pep-0342/)? Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Cannot build _multiprocessing, math, mmap and readline of Python 2.6 on FreeBSD 4.11 w/ gcc 2.95.4

2008-10-27 Thread M.-A. Lemburg
On 2008-10-25 20:19, Akira Kitada wrote: > Hi Marc-Andre, > > Thanks for the suggestion. > I opened a ticket for this issue: http://bugs.python.org/issue4204 Thanks. > Now I understand the state of the multiprocessing module, > but it's too bad to see math, mmap and readline modules, that worked

Re: Do I need a lock here?

2008-10-27 Thread Diez B. Roggisch
jasiu85 schrieb: Hey, Please take a look at the code of the two threads below: COMMON_DICT = {} def thread_1(): global COMMON_DICT local_dict = prepare_dict() COMMON_DICT = local_dict def thread_2(): global COMMON_DICT local_dict = COMMON_DICT use_dict(local_dict) Do

Do I need a lock here?

2008-10-27 Thread jasiu85
Hey, Please take a look at the code of the two threads below: COMMON_DICT = {} def thread_1(): global COMMON_DICT local_dict = prepare_dict() COMMON_DICT = local_dict def thread_2(): global COMMON_DICT local_dict = COMMON_DICT use_dict(local_dict) Do I need a lock to pr

Re: conversion to and from unicode strings

2008-10-27 Thread Gerhard Häring
abhishek wrote: hello group, i want to represent and store a string u'\x00\x07\xa7' as '\x00\x07\xa7'. any ideas on how to achieve this. You want to store it in the form of the repr() of the string? It is possible to use repr() to get a bytestring to store and to use eval() to create a unic

Re: set/dict comp in Py2.6

2008-10-27 Thread Gabriel Genellina
En Sat, 25 Oct 2008 23:44:46 -0200, Benjamin <[EMAIL PROTECTED]> escribió: On Oct 25, 3:13 am, [EMAIL PROTECTED] wrote: I'd like to know why Python 2.6 doesn't have the syntax to create sets/ dicts of Python 3.0, like: Because nobody bothered to backport them. En Sat, 25 Oct 2008 23:47:32

conversion to and from unicode strings

2008-10-27 Thread abhishek
hello group, i want to represent and store a string u'\x00\x07\xa7' as '\x00\x07\xa7'. any ideas on how to achieve this. -- http://mail.python.org/mailman/listinfo/python-list

Re: Improving interpreter startup speed

2008-10-27 Thread [EMAIL PROTECTED]
To make faster python, you can do: 1.) Use mod_python, and not cgi. 2.) Use other special python server that remaining in memory, and call it from compiled C code. For example, the C code communicate this server with pipes, tcp, (or with special files, and the result will come back in other fi

Re: 2.6, 3.0, and truly independent intepreters

2008-10-27 Thread Martin v. Löwis
Andy O'Meara wrote: > On Oct 24, 9:52 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: A c-level module, on the other hand, can sidestep/release the GIL at will, and go on it's merry way and process away. >>> ...Unless part of the C module execution involves the need do CPU- >>> bound wor

Re: Python 2.5.chm problem

2008-10-27 Thread [EMAIL PROTECTED]
This solve the problem: http://techrepublic.com.com/5208-11183-0.html?forumID=89&threadID=191474 regsvr32 %systemroot%\system32\hhctrl.ocx regsvr32 %systemroot%\system32\itss.dll [EMAIL PROTECTED]: Hi! When I try to open the 2.5 Python help, I got error message: "A fájl (mk:@MSITStore:c:\

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:46 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> +1 This thread is stupid and pointless. >> Even for a so-called cold startup 0.5s is fast enough! > > I don't see the need to be rude. > And I DO care for Python startup time and memory footprint, and others do > too.

Re: @property decorator doesn't raise exceptions

2008-10-27 Thread Peter Otten
Rafe wrote: > Can anyone explain why this is happening? When an attribute error is raised that is an indication that the requested attribute doesn't exist, and __getattr__() must be called as a fallback. > I can hack a work-around, > but even then I could use some tips on how to raise the 'rea

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:40 PM, David Cournapeau <[EMAIL PROTECTED]> wrote: > Depends on the tool: build tool and source control tools are example > it matters (specially when you start interfaciing them with IDE or > editors). Having fast command line tools is an important feature of > UNIX, and

Re: Improving interpreter startup speed

2008-10-27 Thread Gabriel Genellina
En Sun, 26 Oct 2008 23:52:32 -0200, James Mills <[EMAIL PROTECTED]> escribió: On Mon, Oct 27, 2008 at 4:12 AM, Benjamin Kaplan <[EMAIL PROTECTED]> wrote: You must be in a real big hurry if half a second matters that much to you. Maybe if it took 5 seconds for the interpreter to start up, I

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:36 PM, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > It's not optimal but it is very common (CGI for example). Which is why we (The Python Community) created WSGI and mod_wsgi. C"mon guys these "problems" are a bit old and out dated :) --JamesMills -- -- -- "Pro

Re: Improving interpreter startup speed

2008-10-27 Thread David Cournapeau
On Mon, Oct 27, 2008 at 4:33 PM, James Mills <[EMAIL PROTECTED]> wrote: > Yes, but in most cases you are not invoking your > command-line app x times per y units of time. Depends on the tool: build tool and source control tools are example it matters (specially when you start interfaciing them wit

Re: Improving interpreter startup speed

2008-10-27 Thread Paul Rubin
"James Mills" <[EMAIL PROTECTED]> writes: > Heaven knows! I hardly think invoking hundreds > and possibly thousands of short-lived python > interpreters to be an optimal solution that may > have spawned this particular thread. It's not optimal but it is very common (CGI for example). -- http://mai

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 5:28 PM, David Cournapeau <[EMAIL PROTECTED]> wrote: > Any command line based on python is a real example of that problem. > There are plenty of them. Yes, but in most cases you are not invoking your command-line app x times per y units of time. --JamesMills -- -- -- "Pr

Re: Improving interpreter startup speed

2008-10-27 Thread James Mills
On Mon, Oct 27, 2008 at 3:36 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > It this a theoretical problem or an actual one, that we might have other > suggestions for? Heaven knows! I hardly think invoking hundreds and possibly thousands of short-lived python interpreters to be an optimal solution t

Re: Improving interpreter startup speed

2008-10-27 Thread David Cournapeau
On Mon, Oct 27, 2008 at 2:36 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > It this a theoretical problem or an actual one, that we might have other > suggestions for? Any command line based on python is a real example of that problem. There are plenty of them. David -- http://mail.python.org/mai

Re: Immutable object thread-safety

2008-10-27 Thread Gabriel Genellina
En Sun, 26 Oct 2008 23:25:09 -0200, Alcari The Mad <[EMAIL PROTECTED]> escribió: I am confused about which data structure to rely on thread-safety, or operator in Python? All of the builtin functions(which are implemented in C, like len()) are atomic(but assigning their output to a value may