Re: Do this as a list comprehension?

2008-06-06 Thread dwahli
On Jun 6, 8:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > Of course, enumerate(iterable) is just a facade over zip(itertools.count(), > iterable) So you could write: gen = (x for x in itertools.izip(itertools.count(8), [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3])) print list(gen) Using zip like you o

Re: Books for learning how to write "big" programs

2008-06-06 Thread Bob Martin
in 69148 20080605 140635 [EMAIL PROTECTED] wrote: >On May 22, 12:49=A0pm, "Kurt Smith" <[EMAIL PROTECTED]> wrote: >> On Thu, May 22, 2008 at 10:55 AM, duli <[EMAIL PROTECTED]> wrote: >> > Hi: >> > I would like recommendations forbooks(in any language, not >> > necessarily C++, C, python) which have

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread cokofreedom
Someone asked about Java; class FieldTest { public String publicString = "Foobar"; private String privateString = "Hello, World!"; } import java.lang.reflect.Field; public class Test4 { public static void main(String args[]) { final Field fields[] = FieldTest.class.getDecla

Re: gcc error in Mac OS X

2008-06-06 Thread Zhaojie Boulder
Thank you all. Finally the problem was solved by installing Xcode from the DVD which comes with the computer. But installing the same program downloaded from apple site always cause the gcc error. Jie 2008/6/5 Mathieu Prevot <[EMAIL PROTECTED]>: > 2008/6/6 Mathieu Prevot <[EMAIL PROTECTED]>: > >

Re: Cannot use Winpdb (or PyDev) to trace embedded Python script in MSVC++ application - ImportError: No module named _socket

2008-06-06 Thread Nir
You seem to be having a problem with the import path of the embedded interpreter. I suppose the embedded interpreter includes some modules in a particular folder and _socket is not one of them. For the sake of debugging try adding the c:\python25\lib path to the sys.path variable of the interpreter

import cherrypy2

2008-06-06 Thread luca72
Hello i can't import cherrypy2 but i don't know why this is the sys path: '', '/home/pirataja/opo.net/python/lib/python2.5/site-packages/ setuptools-0.6c7-py2.5.egg', '/home/pirataja/opo.net/python/lib/ python2.5/site-packages/TurboGears-1.0.4.4-py2.5.egg', '/home/pirataja/ opo.net/python/lib/pyth

Re: import cherrypy2

2008-06-06 Thread Chris
On Jun 6, 10:22 am, luca72 <[EMAIL PROTECTED]> wrote: > Hello i can't import cherrypy2 but i don't know why this is the sys > path: > > '', '/home/pirataja/opo.net/python/lib/python2.5/site-packages/ > setuptools-0.6c7-py2.5.egg', '/home/pirataja/opo.net/python/lib/ > python2.5/site-packages/TurboG

Re: Help need with subprocess communicate

2008-06-06 Thread Nicola Musatti
On Jun 4, 9:56 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 3 Jun 2008 23:48:38 -0700 (PDT), [EMAIL PROTECTED] declaimed the > following in comp.lang.python: > > > Is there way to configure the stdout buffer size so that it flushes > > earlier.. > > Is there a way to make above mentio

parsing .pcap files

2008-06-06 Thread Astan Chee
Hi, Im using pyflag to parse .pcap files. Pyflag displays the data part of the .pcap file in binary and I was wondering what this means. How do I decode the 'data' part of the packet without using external libraries? What does these non-alpha numerical information mean? Is there a (python) dic

Re: import cherrypy2

2008-06-06 Thread luca72
On 6 Giu, 10:31, Chris <[EMAIL PROTECTED]> wrote: > On Jun 6, 10:22 am, luca72 <[EMAIL PROTECTED]> wrote: > > > > > Hello i can't import cherrypy2 but i don't know why this is the sys > > path: > > > '', '/home/pirataja/opo.net/python/lib/python2.5/site-packages/ > > setuptools-0.6c7-py2.5.egg', '/

Re: Do this as a list comprehension?

2008-06-06 Thread Marc 'BlackJack' Rintsch
On Thu, 05 Jun 2008 23:56:40 -0700, dwahli wrote: > On Jun 6, 8:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >> >> Of course, enumerate(iterable) is just a facade over zip(itertools.count(), >> iterable) > > So you could write: > gen = (x for x in itertools.izip(itertools.count(8), [0, 1, 1, 1

Re: import cherrypy2

2008-06-06 Thread luca72
No i haven't install lino but if frmp the python of this computer i make import cherrypy2 i import it without problem this is the python path: [EMAIL PROTECTED]:~> python Python 2.5.1 (r251:54863, Jan 10 2008, 18:00:49) [GCC 4.2.1 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "l

Re: import cherrypy2

2008-06-06 Thread Chris
On Jun 6, 10:59 am, luca72 <[EMAIL PROTECTED]> wrote: > On 6 Giu, 10:31, Chris <[EMAIL PROTECTED]> wrote: > > > > > On Jun 6, 10:22 am, luca72 <[EMAIL PROTECTED]> wrote: > > > > Hello i can't import cherrypy2 but i don't know why this is the sys > > > path: > > > > '', '/home/pirataja/opo.net/pytho

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread Gabriel Rossetti
Larry Bates wrote: Gabriel Rossetti wrote: Hello everyone, I had read somewhere that it is preferred to use self.__class__.attribute over ClassName.attribute to access class (aka static) attributes. I had done this and it seamed to work, until I subclassed a class using this technique and fr

How to kill a thread?

2008-06-06 Thread John Dohn
Hi there, How can I kill a threading.Thread subclass from MainThread? My threads are waiting for data in Queue.get() method: class MyThread(threading.Thread): def run(self): while True: data = queue.get()# <- here it waits most of the time ... process data

Re: Convert Word .doc to Acrobat .pdf files

2008-06-06 Thread Paul Scott
On Fri, 2008-06-06 at 16:22 +0530, Dinil Karun wrote: > hi, > > I am using the below code but i am getting a error saying pyUno module > not found. > can u please help. I just wrote the same thing! Take a look at http://cvs2.uwc.ac.za/trac/python_tools/browser/oooconv It should do what you wan

creating yaml without tags using pyyaml

2008-06-06 Thread Stephen Moore
hello I have a situation where I have quite a large python object which I want to convert to yaml so I can then send it to a flex application using pyamf. I've managed to create a yaml document using the python object (http://flashbsm.googlecode.com/svn/testing/yamlTest/tester.yaml) (using pyyaml

Re: How to kill a thread?

2008-06-06 Thread Gerhard Häring
John Dohn wrote: Hi there, How can I kill a threading.Thread subclass from MainThread? My threads are waiting for data in Queue.get() method: class MyThread(threading.Thread): def run(self): while True: data = queue.get()# <- here it waits most of the time

Re: How to kill a thread?

2008-06-06 Thread John Dohn
On Fri, Jun 6, 2008 at 10:30 PM, John Dohn <[EMAIL PROTECTED]> wrote: > Hi there, > > How can I kill a threading.Thread subclass from MainThread? At the end I did: def run(self): while True: if exit_event.isSet(): #

Re: creating yaml without tags using pyyaml

2008-06-06 Thread Kirill Simonov
Stephen Moore wrote: I have come to the conclusion that this is the fault of the tags (for example, !!python/tuple) as getting rid of them gets rid of the errors. So I'm wondering if there is an option to YAML.decode that will create a yaml document without the tags? Try yaml.safe_dump(). >>>

BZip2 decompression and parsing XML

2008-06-06 Thread phasma
Hi. I'm trying to disassemble bzipped file. If I use minidom.parseString, I'm getting this error: Traceback (most recent call last): File "./replications.py", line 342, in ? File "/usr/lib64/python2.4/xml/dom/minidom.py", line 1925, in parseString return expatbuilder.parseString(string)

Re: BZip2 decompression and parsing XML

2008-06-06 Thread Stefan Behnel
phasma wrote: > xml.parsers.expat.ExpatError: not well-formed (invalid token): line > 538676, column 17 Looks like your XML file is broken in line 538676. > try: > handler = open(args[0], "r") This should read handler = open(args[0], "rb") Maybe t

Re: Python CGI Upload from Server Status

2008-06-06 Thread John Dohn
On Sat, Jun 7, 2008 at 12:50 AM, Derek Tracy <[EMAIL PROTECTED]> wrote: > I am trying to create a simple python cgi app that allows the user to kick > off an ftp from the server the cgi is on to another server; I have that > piece working using ftplib but since the files in question are usually ve

Re: Python CGI Upload from Server Status

2008-06-06 Thread Derek Tracy
On Fri, Jun 6, 2008 at 9:16 AM, John Dohn <[EMAIL PROTECTED]> wrote: > On Sat, Jun 7, 2008 at 12:50 AM, Derek Tracy <[EMAIL PROTECTED]> wrote: > >> I am trying to create a simple python cgi app that allows the user to kick >> off an ftp from the server the cgi is on to another server; I have that

Re: configure fails

2008-06-06 Thread A.T.Hofkamp
On 2008-06-05, Mathieu Prevot <[EMAIL PROTECTED]> wrote: > I have the following error on a OSX.5 OS with CC=icc and using the > python-svn files: > > checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) > > I would like to help so we can compile python with icc/OSX. This l

cgi, parse_header and semi-colon

2008-06-06 Thread Sylvain
Hi, I'm playing with Google App Engine and during my tests it seems that there is a bug in cgi. parse_header function. If we upload a file with a semi-colon (i.e : "C:/my;file.jpg") : cgi.FieldStorage.filename returns only "my" everything after the semi- colon is missing Is it a bug or i'm missi

Re: How to kill a thread?

2008-06-06 Thread Laszlo Nagy
def run(self): while True: if exit_event.isSet(): # Thread exiting return try: data = q_in.get(timeout = .5)

Re: creating yaml without tags using pyyaml

2008-06-06 Thread Stephen Moore
On Fri, Jun 6, 2008 at 8:20 PM, Kirill Simonov <[EMAIL PROTECTED]> wrote: > Stephen Moore wrote: >> >> I have come to the conclusion that this is the fault of the tags (for >> example, !!python/tuple) as getting rid of them gets rid of the >> errors. >> >> So I'm wondering if there is an option to

Re: Proof that \ is a better line joiner than parenthetical sets

2008-06-06 Thread Jordan Greenberg
Joshua Kugler wrote: "Beautiful is better than ugly." And I think putting parenthesis around a multi-line statement is much prettier. So there! :) j And PEP 8 agrees with you. Another vote for parens. -Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial download with ftplib and retrbinary

2008-06-06 Thread Giampaolo Rodola'
On 24 Mag, 12:53, [EMAIL PROTECTED] wrote: > I am breaking/interrupting my connection with theftpserver at > present when doing a partial download of a file. I have a callback > with retrbinary that raises an exception and ends the download. The > problem is that the server is not notified and hang

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread Bruno Desthuilliers
Hrvoje Niksic a écrit : "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: On 5 juin, 17:40, Gabriel Rossetti <[EMAIL PROTECTED]> wrote: Hello everyone, I had read somewhere that it is preferred to use self.__class__.attribute over ClassName.attribute to access class (aka static) attributes. It

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread Bruno Desthuilliers
Gabriel Rossetti a écrit : Larry Bates wrote: Gabriel Rossetti wrote: Hello everyone, I had read somewhere that it is preferred to use self.__class__.attribute over ClassName.attribute to access class (aka static) attributes. I had done this and it seamed to work, until I subclassed a class

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread Bruno Desthuilliers
Russ P. a écrit : On Jun 4, 4:29 am, NickC <[EMAIL PROTECTED]> wrote: On Jun 4, 4:09 am, "Russ P." <[EMAIL PROTECTED]> wrote: What is it about leading underscores that bothers me? To me, they are like a small pebble in your shoe while you are on a hike. Yes, you can live with it, and it does n

File-writing not working in Windows?

2008-06-06 Thread tdahsu
All, I have the following code: for fileTarget in dircache.listdir("directory"): (dirName, fileName) = os.path.split(fileTarget) f = open(fileTarget).readlines() copying = False for i in range(len(f)): f

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread Bruno Desthuilliers
Russ P. a écrit : On Jun 5, 4:53 am, Bruno Desthuilliers wrote: Russ P. a écrit : Given your very recent discovery of what 'dynamic' *really* means in Python (like, for exemple, dynamically adding / replacing attributes - including methods - on a per-class or per-instance basis), possibly, y

Re: parser recommendation

2008-06-06 Thread Kay Schluehr
On 6 Jun., 01:58, Alan Isaac <[EMAIL PROTECTED]> wrote: > One other possibility: > SimpleParse (for speed). > http://simpleparse.sourceforge.net/> > It is very nice. > Alan Isaac How does SimpleParse manage left-factorings, left-recursion and other ambiguities? For example according to [1] there

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread Bruno Desthuilliers
Russ P. a écrit : On Jun 5, 2:27 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: On Thu, 5 Jun 2008 11:36:28 -0700 (PDT), "Russ P." <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: would need to use a "mangled" name to access private data or methods. But you will be using the

Re: Newb question: underscore

2008-06-06 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : My question is: Why would anyone decide to obfuscate something as easy to read as Python??? They didn't decide to obfuscate; they decided to follow a strongly-expected convention for the name of that function by existing users of the 'gettext' functionality, in contex

Re: Newb question: underscore

2008-06-06 Thread Bruno Desthuilliers
John Fabiani a écrit : Skye wrote: What is this doing? print >> fd, _(__doc__) I'm guessing line-splitting __doc__ into a list, but what's that leading underscore do? Thanks! I think it is standard practice to use the underscore for unicode converts. Actually, it's for i18n, not for

Re: cgi, parse_header and semi-colon

2008-06-06 Thread Richard Brodie
"Sylvain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If we upload a file with a semi-colon (i.e : "C:/my;file.jpg") : > cgi.FieldStorage.filename returns only "my" everything after the semi- > colon is missing > > Is it a bug or i'm missing something ? I doubt it's bug in par

Re: File-writing not working in Windows?

2008-06-06 Thread jay graves
On Jun 6, 10:18 am, [EMAIL PROTECTED] wrote: > This code works PERFECTLY in Linux. Where I have a match in the file > I'm processing, it gets cut out from the start of the match until the > end of the match, and written to the temporary file in tempdir. > It does not work in Windows. It does not

How to remove read-only from a file

2008-06-06 Thread Robert Dailey
Hi, Using Python 3.0, how can I remove a read-only property from a file in Windows XP? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to remove read-only from a file

2008-06-06 Thread Tim Golden
Robert Dailey wrote: Hi, Using Python 3.0, how can I remove a read-only property from a file in Windows XP? Thanks. import os import stat os.chmod ("c:/temp/temp.txt", stat.S_IWRITE) (Haven't actually checked that on Python 3.0 but I don't believe it's changed...) TJG -- http://mail.python.

Re: Image Processing (batch)

2008-06-06 Thread Ivan Illarionov
On Thu, 05 Jun 2008 07:10:56 +, Tim Roberts wrote: > Thomas Guettler <[EMAIL PROTECTED]> wrote: >> >>I tried PIL for image batch processing. But somehow I don't like it >> - Font-Selection: You need to give the name of the font file. - >> Drawing on an image needs a different object that pas

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Gabriel Rossetti <[EMAIL PROTECTED]> wrote: > Larry Bates wrote: > > Gabriel Rossetti wrote: > >> Hello everyone, > >> > >> I had read somewhere that it is preferred to use > >> self.__class__.attribute over ClassName.attribute to access class > >> (aka static) a

SWIG -- Passing python proxy class instance to python callback

2008-06-06 Thread Keith Sabine
Hi Did you ever find a solution to this? I am having the exact same problem... - Keith I'm trying to pass a proxy class instance (SWIG generated) of CClass, to a python callback function from C++. The proxy class instance of CClass is created from a pointer to the C++ class CClass. Using the

lots of futex_wait calls

2008-06-06 Thread skunkwerk
I've got a python program written for the django web framework that starts about 100 threads. When I start the server, it sometimes eats up 100% of the CPU for a good minute or so... though none of the threads are CPU-intensive doing a strace on the program, i found lots of calls like this: sele

Re: How to kill a thread?

2008-06-06 Thread Diez B. Roggisch
Laszlo Nagy schrieb: def run(self): while True: if exit_event.isSet(): # Thread exiting return try: data = q_in.get(timeout =

The best sexy video and photo!!!

2008-06-06 Thread sexy18
http://rozrywka.yeba.pl/show.php?id=2737 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to remove read-only from a file

2008-06-06 Thread Robert Dailey
On Fri, Jun 6, 2008 at 11:05 AM, Tim Golden <[EMAIL PROTECTED]> wrote: > Robert Dailey wrote: > >> Hi, >> >> Using Python 3.0, how can I remove a read-only property from a file in >> Windows XP? Thanks. >> > > import os > import stat > > os.chmod ("c:/temp/temp.txt", stat.S_IWRITE) > > (Haven't ac

Re: lots of futex_wait calls

2008-06-06 Thread André Malo
skunkwerk wrote: > I've got a python program written for the django web framework that > starts about 100 threads. When I start the server, it sometimes eats > up 100% of the CPU for a good minute or so... though none of the > threads are CPU-intensive > > doing a strace on the program, i found

ctypes help

2008-06-06 Thread gianluca
hy, I've a huge problem with ctypes. I've compiled my C library and I'd like use it in python with ctype. One function need to pass a pointer to typed ( like this: typedef int value_type). In python I can access to that funtion but arise an exception because python don't know my value_type typedef

noob question : library versus normal python files

2008-06-06 Thread ravinder thakur
hello friends, i have a python library(rdflib) that i am using in some project using Google App Engine. I have developed everything using this on my local machine and things work fine. But in my final deployment, i have to use it in source code form rather than in library form. If i remove the li

Re: Do this as a list comprehension?

2008-06-06 Thread John Salerno
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Mensanator" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Which is exactly the purpose of zip, or its specialization enumerate! Thanks guys! Looks like the simplest is always the best yet again! :)

Where to find Visual Studio Syntax Highlighting (for python)?

2008-06-06 Thread Robert Dailey
Hi, Does anyone know of a way to get syntax coloring working in Visual Studio 2008 for Python? I did some googling but I couldn't find anything. Help is appreciated, thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Do this as a list comprehension?

2008-06-06 Thread Mensanator
On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Mensanator" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | On Jun 5, 10:42?pm, John Salerno <[EMAIL PROTECTED]> wrote: > | > Is it possible to write a list comprehension for this so as to produce > a > | > list of t

Assigning to __class__ : bad form?

2008-06-06 Thread The Pythonista
I've been wondering for a while about whether assigning to __class__ is bad form or not. Specifically, I mean doing so when some other method of implementing the functionality you're after is available (i.e. using an adapter, or something like the strategy pattern). To give an example and a no

My company provide most popular of the shoes model, bag, clothes, Bikini swimwear, sunglasses and watch of etc..

2008-06-06 Thread hongfeng13
hello ! ! !welcome to visit our website http://www.nikeadishoes.com Our main products : shoes Hoodies T-Shirt Jeans Jacket bags Electronic and so on we can supply many popular shoes model,bag,clothes ,bikini,sunglass and watch and so on. We can give you products with good quality and reasonable

My company provide most popular of the shoes model, bag, clothes, Bikini swimwear, sunglasses and watch of etc..

2008-06-06 Thread hongfeng13
hello ! ! !welcome to visit our website http://www.nikeadishoes.com Our main products : shoes Hoodies T-Shirt Jeans Jacket bags Electronic and so on we can supply many popular shoes model,bag,clothes ,bikini,sunglass and watch and so on. We can give you products with good quality and reasonable

Re: File-writing not working in Windows?

2008-06-06 Thread tdahsu
On Jun 6, 11:35 am, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 6, 10:18 am, [EMAIL PROTECTED] wrote: > > > > This code works PERFECTLY in Linux.  Where I have a match in the file > > I'm processing, it gets cut out from the start of the match until the > > end of the match, and written to the

Re: Cannot use Winpdb (or PyDev) to trace embedded Python script in MSVC++ application - ImportError: No module named _socket

2008-06-06 Thread Chris8Boyd
On Jun 6, 1:13 am, Nir <[EMAIL PROTECTED]> wrote: > You seem to be having a problem with the import path of the embedded > interpreter. I suppose the embedded interpreter includes some modules > in a particular folder and _socket is not one of them. For the sake of > debugging try adding the c:\pyt

Change in interactive interpreter?

2008-06-06 Thread The Pythonista
I remember the interactive interpreter used to define the name _ to return the value of the last expression that was evaluated. However, I tried it just today and got a NameError. Is this a change in the interpreter or is there a configuration option I need to set to enable it? Thanks! -- c

Re: Cannot use Winpdb (or PyDev) to trace embedded Python script in MSVC++ application - ImportError: No module named _socket

2008-06-06 Thread Chris8Boyd
On Jun 6, 11:25 am, [EMAIL PROTECTED] wrote: > On Jun 6, 1:13 am, Nir <[EMAIL PROTECTED]> wrote: > > > > > You seem to be having a problem with the import path of the embedded > > interpreter. I suppose the embedded interpreter includes some modules > > in a particular folder and _socket is not one

Re: Change in interactive interpreter?

2008-06-06 Thread Gary Herron
The Pythonista wrote: I remember the interactive interpreter used to define the name _ to return the value of the last expression that was evaluated. However, I tried it just today and got a NameError. Is this a change in the interpreter or is there a configuration option I need to set to ena

Re: Do this as a list comprehension?

2008-06-06 Thread The Pythonista
On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote: > Is it possible to write a list comprehension for this so as to produce a > list of two-item tuples? > > base_scores = range(8, 19) > score_costs = [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3] print zip(base_scores, > score_costs) > score_costs = [(

Re: How to kill a thread?

2008-06-06 Thread The Pythonista
It's always been my understanding that you can't forcibly kill a thread in Python (at least not in a portable way). The best you can do is politely ask it to die, IIRC. -- code.py: A blog about life, the universe, and Python http://pythonista.wordpress.com ** Posted from http://www.teranews.c

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread Russ P.
On Jun 6, 8:25 am, Bruno Desthuilliers wrote: > >>> I also realize, by the way, that Python allows a client of a class to > >>> define a new class member from completely outside the class > >>> definition. Obviously, that cannot be declared private. > >> Why so ? > > > Why should the client of a

Re: Why does python not have a mechanism for data hiding?

2008-06-06 Thread Russ P.
On Jun 6, 8:28 am, Bruno Desthuilliers wrote: > Russ P. a écrit : > > > > > On Jun 5, 2:27 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > >> On Thu, 5 Jun 2008 11:36:28 -0700 (PDT), "Russ P." > >> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>> would need to use a "man

Re: File-writing not working in Windows?

2008-06-06 Thread jay graves
On Jun 6, 1:22 pm, [EMAIL PROTECTED] wrote: > I am thinking that the "g.open(tempFileName, 'a')" command is the > issue. Is there anything different about opening a file in Windows? > Does Windows understand "append", or would I have to do control checks > for seeing if the file is created and the

Re: Assigning to __class__ : bad form?

2008-06-06 Thread [EMAIL PROTECTED]
On 6 juin, 19:51, The Pythonista <[EMAIL PROTECTED]> wrote: > I've been wondering for a while about whether assigning to __class__ is > bad form or not. Specifically, I mean doing so when some other method of > implementing the functionality you're after is available (i.e. using an > adapter, or s

Re: noob question : library versus normal python files

2008-06-06 Thread [EMAIL PROTECTED]
On 6 juin, 19:36, रवींदर ठाकुर (ravinder thakur) <[EMAIL PROTECTED]> wrote: > hello friends, > > i have a python library(rdflib) that i am using in some project using > Google App Engine. I have developed everything using this on my local > machine and things work fine. But in my final deployment,

Trying to install mysql lib for python

2008-06-06 Thread [EMAIL PROTECTED]
Hi How do I install mysql db libray for python? I went to source forg and downloaded the following zip folder MySQL_python-1.2.2-py2.4-win32 I open the folder and looked inside did not see any directions. Help -- http://mail.python.org/mailman/listinfo/python-list

Re: File-writing not working in Windows?

2008-06-06 Thread tdahsu
On Jun 6, 2:58 pm, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 6, 1:22 pm, [EMAIL PROTECTED] wrote: > > > I am thinking that the "g.open(tempFileName, 'a')" command is the > > issue.  Is there anything different about opening a file in Windows? > > Does Windows understand "append", or would I ha

Re: Do this as a list comprehension?

2008-06-06 Thread John Salerno
"Mensanator" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Mensanator" <[EMAIL PROTECTED]> wrote in message And since the OP foolishly hardcoded his range bounds Hmm, I just love the arrogance of some people. I actually

Re: File-writing not working in Windows?

2008-06-06 Thread jay graves
On Jun 6, 3:19 pm, [EMAIL PROTECTED] wrote: > This did not make a difference in my script. However, I did what you > suggested, and tried the simple script it Windows, and it works as it > should. > (It's really annoying because it works on the Mac and Linux! (I just > tested my script on the Mac

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread Casey McGinty
On Thu, Jun 5, 2008 at 11:39 AM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > If you want to access the attribute of a particular class, to read or > write, use that class. > SomeClass.attr > Note that no instance is required or relevant. > > If you want to read the attrubute of the class of an in

[ANN] Dramatis 0.1.1 released

2008-06-06 Thread Steven Parkes
The first alpha release of dramatis hit the streets today. dramatis is a library available in Python and Ruby used to write concurrent programs based on the actor model of concurrency. The dramatis web site is http://dramatis.mischance.net The release is available as a python distutils package a

Re: Guide to organizing modules?

2008-06-06 Thread Casey McGinty
> > Yes, in the above post I meant to say package where I said module. > Right now all my functions are in the __init__.py script, and I would > consider separating them out into sub-packages, if it had any rhyme or > reason, but right now that escapes me. That's mostly what I'm trying > to ask for

Re: Q about object identity

2008-06-06 Thread Ethan Furman
[EMAIL PROTECTED] wrote: Hello, I am testing object identity. If I do it from the interpreter, I get strange results. *print [] is []* *False* print id([]), id([]) 3083942700 3083942700 Why is that? Isn't this an error? If I test it in a script, all is OK. #!/usr/bin/python a =

Macro like functionality for shorthand variable names

2008-06-06 Thread Tilman Kispersky
I have python code in a class method translated from C++ that looks sort of like this: >>> self.dydt[1] = self.a * (self.b * self.y[0] - self.y[1]) To make this more readable in C++ I had made macros to achieve this: #define du (dydt[1]) #define u (y[1]) #define V (y[0]) du = a * (b * V - u);

Re: Q about object identity

2008-06-06 Thread Tommy Grav
On Jun 6, 2008, at 4:27 PM, Ethan Furman wrote: [EMAIL PROTECTED] wrote: Hello, I am testing object identity. If I do it from the interpreter, I get strange results. *print [] is []* *False* print id([]), id([]) 3083942700 3083942700 Why is that? Isn't this an error? in the first stateme

Learning which modules were loaded

2008-06-06 Thread James Stroud
I am rolling up a distribution of a program I wrote. It uses matplotlib with tkagg so the bundle is HUGE (47 MB, 14 MB after bz compression). Is there any way to run the program, put it through all of its paces, and then inspect which modules were loaded. I would like to gather these in a list

Re: Learning which modules were loaded

2008-06-06 Thread Gary Herron
James Stroud wrote: I am rolling up a distribution of a program I wrote. It uses matplotlib with tkagg so the bundle is HUGE (47 MB, 14 MB after bz compression). Is there any way to run the program, put it through all of its paces, and then inspect which modules were loaded. I would like to ga

How to send a POST request?

2008-06-06 Thread kj
Hi. Sorry for this very clueless question, but how does one write in Python an HTTP client that can send a POST request? The modules I've found (e.g. urllib, urllib2), as far as I can tell, seem to be limited to GET requests. (I could be wrong though; please correct me if this is so.) TIA!

Newbie question, list comprehension

2008-06-06 Thread Johannes Bauer
Hello group, I'm currently doing something like this: import time localtime = time.localtime(1234567890) fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime For the third line there is, I suppose, some

Re: How to send a POST request?

2008-06-06 Thread kj
In <[EMAIL PROTECTED]> kj <[EMAIL PROTECTED]> writes: >Hi. Sorry for this very clueless question, but how does one write >in Python an HTTP client that can send a POST request? The modules >I've found (e.g. urllib, urllib2), as far as I can tell, seem to >be limited to GET requests. (I could be

Re: Newbie question, list comprehension

2008-06-06 Thread Hans Nowak
Johannes Bauer wrote: Hello group, I'm currently doing something like this: import time localtime = time.localtime(1234567890) fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % (localtime[0], localtime[1], localtime[2], localtime[3], localtime[4], localtime[5]) print fmttime For the third line the

Re: Change in interactive interpreter?

2008-06-06 Thread The Pythonista
On Fri, 06 Jun 2008 11:36:13 -0700, Gary Herron wrote: > Try again. I think you'll find it's still there -- although you have to > execute a something that returns a value before it's set for the first > time. That was, indeed the problem. Boy do I feel silly now. :-) Thanks -- code.py: A

how to build a street with more than 1 house ?

2008-06-06 Thread Stef Mientki
hello, In the code below, I can build a large street like this: large_street = house * 25 but not a small street. like this: small_street = 5 * house Why is this different ? And more interesting, how do I get the right results ? thanks, Stef Mientki class type_house ( object ) : def __init_

Re: Newbie question, list comprehension

2008-06-06 Thread Johannes Bauer
Hans Nowak schrieb: In this case, you can just use a slice, as localtime is a tuple: fmttime = "%04d-%02d-%02d %02d:%02d:%02d" % localtime[:6] Hope this helps! ^_^ Ahh, how cool! That's *exactly* what I meant with "awesome Python magic" :-) Amazing language, I have to admit. Regards, J

Re: how to build a street with more than 1 house ?

2008-06-06 Thread Tommy Grav
On Jun 6, 2008, at 6:45 PM, Stef Mientki wrote: hello, In the code below, I can build a large street like this: large_street = house * 25 but not a small street. like this: small_street = 5 * house This calls the int.__mul__() code i believe. Why is this different ? And more interesting, h

Re: readline() & seek() ???

2008-06-06 Thread Kam-Hung Soh
Chris wrote: On Jun 6, 5:13 am, Kam-Hung Soh <[EMAIL PROTECTED]> wrote: Tim Roberts wrote: DataSmash <[EMAIL PROTECTED]> wrote: I have a text file that contains thousands of lines and each line is 256 characters long. This is my task: For each line in the file, move to the 25th character, if t

Re: File-writing not working in Windows?

2008-06-06 Thread John Machin
On Jun 7, 1:18 am, [EMAIL PROTECTED] wrote: > All, > [code snipped] > > This code works PERFECTLY in Linux. Where I have a match in the file > I'm processing, it gets cut out from the start of the match until the > end of the match, and written to the temporary file in tempdir. > > It does not w

Re: Python is slow

2008-06-06 Thread Jan Claeys
Op Fri, 23 May 2008 14:00:33 -0700, schreef [EMAIL PROTECTED]: > Now this I can tell is false. The problem is not that it's difficult to > "make a native compiler for" dynamic languages, the problem is that it's > difficult to write native compiler for dynamic languages that generates > code that

Re: How to send a POST request?

2008-06-06 Thread Jeff McNeil
The original urllib module will do it too, if you pass a data keyword argument to urllib.urlopen: u = urllib.urlopen('http://www.domain.com/cgi-bin/cgi.py', data=urllib.urlencode({'name': 'pythonguy'})) On Fri, Jun 6, 2008 at 6:04 PM, kj <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]> kj <[E

Re: Do this as a list comprehension?

2008-06-06 Thread Mensanator
On Jun 6, 3:19 pm, "John Salerno" <[EMAIL PROTECTED]> wrote: > "Mensanator" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > "Mensanator" <[EMAIL PROTECTED]> wrote in message > > And since the OP foolishly > hardcode

Re: Do this as a list comprehension?

2008-06-06 Thread Mensanator
On Jun 6, 1:40 pm, The Pythonista <[EMAIL PROTECTED]> wrote: > On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote: > > Is it possible to write a list comprehension for this so as to produce a > > list of two-item tuples? > > > base_scores = range(8, 19) > > score_costs = [0, 1, 1, 1, 1, 1, 1, 2

need really help

2008-06-06 Thread Golu
respected please help me i am really need of money please pay me through donation from my site. http://www.computersolution.co.cc i will be very thankful to you . please donate atleast 5$ or 2$ through my site http://www.computersolution.co.cc hope i will be able to clear my debts because of you al

Dynamically naming objects.

2008-06-06 Thread Kalibr
I've been developing a small script to fiddle with classes, and came accross the following problem. Assuming I get some user input asking for a number, how would I spawn 'n' objects from a class? i.e. I have a class class 'user' and I don't know how many of them I want to spawn. Any ideas? -- htt

Re: Dynamically naming objects.

2008-06-06 Thread Hans Nowak
Kalibr wrote: I've been developing a small script to fiddle with classes, and came accross the following problem. Assuming I get some user input asking for a number, how would I spawn 'n' objects from a class? i.e. I have a class class 'user' and I don't know how many of them I want to spawn. A

  1   2   >