Re: len() should always return something

2009-07-24 Thread Diez B. Roggisch
Dr. Phillip M. Feldman schrieb: Some aspects of the Python design are remarkably clever, while others leave me perplexed. Here's an example of the latter: Why does len() give an error when applied to an int or float? len() should always return something; in particular, when applied to a scalar, i

Re: len() should always return something

2009-07-24 Thread Chris Rebert
On Thu, Jul 23, 2009 at 11:35 PM, Dr. Phillip M. Feldman wrote: > > Some aspects of the Python design are remarkably clever, while others leave > me perplexed. Here's an example of the latter: Why does len() give an error > when applied to an int or float? len() should always return something; in >

Re: len() should always return something

2009-07-24 Thread Peter Otten
Dr. Phillip M. Feldman wrote: > Some aspects of the Python design are remarkably clever, while others > leave me perplexed. Here's an example of the latter: Why does len() give > an error when applied to an int or float? len() should always return > something; in particular, when applied to a scal

Re: Looking for os.listdir() generator

2009-07-24 Thread Nick Craig-Wood
Christian Heimes wrote: > Nick Craig-Wood wrote: > > Christian Heimes wrote: > >> I'm looking for a generator version of os.listdir() for Python 2.5 and > >> newer. I know somebody has worked on it because I've seen a generator > >> version in a posting on some list or blog a while ago. I can

Re: ANN: psyco V2

2009-07-24 Thread William Dode
On 23-07-2009, Christian Tismer wrote: > On 7/17/09 4:11 AM, Bearophile wrote: >> Very good, thank you. I'll try it when I can. >> >> Is Psyco3 going to borrow/steal some ideas/code from Unladen Swallow? > > Psyco3: nice typo! :-) > > Well, I haven't so far found a new idea there that I'd want > to

Re: If Scheme is so good why MIT drops it?

2009-07-24 Thread Raffael Cavallaro
On 2009-07-23 13:15:00 -0400, Isaac Gouy said: I get the feeling I'm missing the joke? Yes, you are missing the joke. The point is that if python is 60x slower than C, even if there were not a GIL, it would require running the python program on a 60 core machine just reach parity with C. Th

Re: integer square roots

2009-07-24 Thread timro21
Thanks to all! Tim -- http://mail.python.org/mailman/listinfo/python-list

Predefined Variables

2009-07-24 Thread Fred Atkinson
Is there a pre-defined variable that returns the GET line (http://www.php.net/index.php?everythingafterthequestionmark) as a single variable (rather than individual variables)? Regards, Fred -- http://mail.python.org/mailman/l

Re: Predefined Variables

2009-07-24 Thread Stephen Cuppett
os.environment('QUERY_STRING') "Fred Atkinson" wrote in message news:p2qg65d0t4kki1sh0t3v6ileamhkvl9...@4ax.com... > Is there a pre-defined variable that returns the GET line > (http://www.php.net/index.php?everythingafterthequestionmark) as a > single variable (rather than individual variables

Re: Predefined Variables

2009-07-24 Thread Stephen Cuppett
$_SERVER['QUERY_STRING']; (if it's PHP) "Fred Atkinson" wrote in message news:p2qg65d0t4kki1sh0t3v6ileamhkvl9...@4ax.com... > Is there a pre-defined variable that returns the GET line > (http://www.php.net/index.php?everythingafterthequestionmark) as a > single variable (rather than individual

Re: Gedcom and Genealogy

2009-07-24 Thread Hendrik van Rooyen
On Friday 24 July 2009 00:14:19 Gordon wrote: > We have many small libraries in JAVA or Ruby that need to be ported to > Python. Actually it's so simple a rewrite is possible too. Is this: 1 - A question? 2 - A job offer? 3 - A piece of random news? - Hendrik -- http://mail.python.org/mailman/

Adding method from one class to another class or to instance of another class

2009-07-24 Thread marekw2143
Hi, I have one class (A) that has defined method createVars. I would like to add that method to class B The code looks like this: class A(object): def createVars(self): self.v1 = 1 self.v2 = 3 pass class B(object): pass I don't want to use inheritance (because class A

mmap 2GB allocation limit on Win XP, 32-bits, Python 2.5.4

2009-07-24 Thread Slaunger
OS: Win XP SP3, 32 bit Python 2.5.4 Hi I have run into some problems with allocating numpy.memmaps exceeding and accumulated size of about 2 GB. I have found out that the real problem relates to numpy.memmap using mmap.mmap I've written a small test program to illustrate it: import itertools imp

Re: What is file.encoding convention?

2009-07-24 Thread Vinay Sajip
On Jul 24, 4:10 am, Naoki INADA wrote: > > Yes! I confused by it. > > s/I confused/I am confused/ > > > "Writing unicode to a file(-like)" is a simple requirement. > > Does python have any simple resolution for it? > > s/resolution/solution/ > Of course, Python 3 has much better Unicode support:

Re: mmap 2GB allocation limit on Win XP, 32-bits, Python 2.5.4

2009-07-24 Thread Diez B. Roggisch
Slaunger schrieb: OS: Win XP SP3, 32 bit Python 2.5.4 Hi I have run into some problems with allocating numpy.memmaps exceeding and accumulated size of about 2 GB. I have found out that the real problem relates to numpy.memmap using mmap.mmap I've written a small test program to illustrate it:

Re: What is file.encoding convention?

2009-07-24 Thread Piet van Oostrum
> Naoki INADA (NI) wrote: >NI> "Writing unicode to a file(-like)" is a simple requirement. >NI> Does python have any simple resolution for it? Yes, Python 3 will do this. For Python < 3.0 you will have to use a codecs wrapper or explicitely do the encoding. -- Piet van Oostrum URL: http://

Re: effbot.org broken (WAS: Problems in commands.getoutput(cmd) with sox)

2009-07-24 Thread Piet van Oostrum
> Chris Rebert (CR) wrote: >CR> On Thu, Jul 23, 2009 at 12:42 PM, Chris Rebert wrote: >>> You can use tabnanny to help diagnose the problem: >>> http://74.125.155.132/search?q=cache:QtxvZm3QDLsJ:effbot.org/librarybook/tabnanny.htm+tabnanny&cd=3&hl=en&ct=clnk&gl=us&client=firefox-a >CR> Anyon

Re: Adding method from one class to another class or to instance of another class

2009-07-24 Thread Peter Otten
marekw2143 wrote: > Hi, > > I have one class (A) that has defined method createVars. I would like > to add that method to class B > The code looks like this: > > > class A(object): >def createVars(self): > self.v1 = 1 > self.v2 = 3 > pass > > class B(object): >pass >

Re: available formats and params for Image.save()

2009-07-24 Thread Gabriel Genellina
En Thu, 23 Jul 2009 06:56:45 -0300, News123 escribió: Somehow I have difficulties reading the documentation for PIL (Image) Is there an easy way to know which formats are supported and what their names are? py> import PIL py> from PIL import Image py> Image.ID [] py> Image.init() py> Image.I

Re: invoke method on many instances

2009-07-24 Thread Gabriel Genellina
En Thu, 23 Jul 2009 21:27:35 -0300, Aahz escribió: In article , Gabriel Genellina wrote: NLMPI What? IHNFI -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

how to get no value

2009-07-24 Thread amrita
Hi, I have a file having lines:- 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = 85 ALA H = 8.60 N = CA = HA = 4.65 C = Now i want to make two another file in which i want to put those lines for which C is missing and another one

Re: OverflowError in RLock.acquire()

2009-07-24 Thread Gabriel Genellina
En Fri, 24 Jul 2009 01:27:10 -0300, David Roberts escribió: I'm trying to port a Python application to Windows, and I'm getting the following error (which did not occur when running on Linux): Exception in thread Thread-4: File "C:\Python26\lib\threading.py", line 803, in currentThread r

Convert points to polygon shapefile

2009-07-24 Thread Luis Pedro Almeida
Dear all, I would like to know how to convert a list of points into a polygon shapefile (esri). Thanks! Best regards, Luis Pedro Almeida -- http://mail.python.org/mailman/listinfo/python-list

Re: mmap 2GB allocation limit on Win XP, 32-bits, Python 2.5.4

2009-07-24 Thread Piet van Oostrum
> Slaunger (S) wrote: >S> OS: Win XP SP3, 32 bit >S> Python 2.5.4 >S> Hi I have run into some problems with allocating numpy.memmaps >S> exceeding and accumulated size of about 2 GB. I have found out that >S> the real problem relates to numpy.memmap using mmap.mmap On Windows XP the virtual

Re: how to get no value

2009-07-24 Thread D'Arcy J.M. Cain
On Fri, 24 Jul 2009 15:50:11 +0530 (IST) amr...@iisermohali.ac.in wrote: > but i am not getting the desired output. Show us what output you got and what you desired. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 4

Re: how to get no value

2009-07-24 Thread Diez B. Roggisch
amr...@iisermohali.ac.in schrieb: Hi, I have a file having lines:- 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = 85 ALA H = 8.60 N = CA = HA = 4.65 C = Now i want to make two another file in which i want to put those lines for

Re: Help understanding the decisions *behind* python?

2009-07-24 Thread Beni Cherniavsky
On Jul 22, 9:36 am, Hendrik van Rooyen wrote: > On Tuesday 21 July 2009 15:49:59 Inky 788 wrote: > > > My guess is that it was probably for optimization reasons long ago. > > I've never heard a *good* reason why Python needs both. > > The good reason is the immutability, which lets you use > a tup

Re: OverflowError in RLock.acquire()

2009-07-24 Thread David Roberts
Done: http://bugs.python.org/issue6562 -- David Roberts http://da.vidr.cc/ On Fri, Jul 24, 2009 at 20:24, Gabriel Genellina wrote: > En Fri, 24 Jul 2009 01:27:10 -0300, David Roberts escribió: > >> I'm trying to port a Python application to Windows, and I'm getting >> the following error (whic

Re: how to get no value

2009-07-24 Thread Piet van Oostrum
> amr...@iisermohali.ac.in (a) a écrit: >a> Hi, >a> I have a file having lines:- >a> 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 >a> 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = >a> 85 ALA H = 8.60 N = CA = HA = 4.65 C = >a> Now i want to make two another file in wh

Re: Convert points to polygon shapefile

2009-07-24 Thread pdpi
On Jul 24, 11:21 am, Luis Pedro Almeida wrote: > Dear all, > > I would like to know how to convert a list of points into a polygon > shapefile (esri). > > Thanks! > > Best regards, > > Luis Pedro Almeida I think you'd be better served by asking this question in a newsgroup dedicated to GIS softwa

Re: Convert points to polygon shapefile

2009-07-24 Thread Piet van Oostrum
> Luis Pedro Almeida (LPA) wrote: >LPA> Dear all, >LPA> I would like to know how to convert a list of points into a >LPA> polygon shapefile (esri). http://lmgtfy.com/?q=esri+shapefile+Python -- Piet van Oostrum URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoo

Re: mmap 2GB allocation limit on Win XP, 32-bits, Python 2.5.4

2009-07-24 Thread Dave Angel
Slaunger wrote: OS: Win XP SP3, 32 bit Python 2.5.4 Hi I have run into some problems with allocating numpy.memmaps exceeding and accumulated size of about 2 GB. I have found out that the real problem relates to numpy.memmap using mmap.mmap I've written a small test program to illustrate it: im

Re: doted filenames in import statements

2009-07-24 Thread Jean-Michel Pichavant
Terry Reedy wrote: Jean-Michel Pichavant wrote: Piet van Oostrum wrote: [snip] JP> file = "/home/dsp/4.6.0.0/test.py" JP> test = __import__(file) JP> => no module name blalalal found. JP> Any suggestion ? I tried multiple escape technics without any success. Rightly so. I think the be

non-owning references?

2009-07-24 Thread Utpal Sarkar
Hi, I'm not sure the subject describes what I'm looking for, but the question is the following: Is there a way I can tell a variable that the object it is pointing too is not owned by it, in the sense that if it is the only reference to the object it can be garbage collected? I want this for what

trouble with wrapping a c program

2009-07-24 Thread Sanne Korzec
Hi Mailing, I am using a c program, which first initializes for some seconds and then waits for user input (keyboard) to type something. When enter is pressed the c program continues. I have wrapped this program in a python script, which starts the c program. To start the c program, there

Re: non-owning references?

2009-07-24 Thread Peter Otten
Utpal Sarkar wrote: > Is there a way I can tell a variable that the object it is pointing > too is not owned by it, in the sense that if it is the only reference > to the object it can be garbage collected? http://docs.python.org/library/weakref.html -- http://mail.python.org/mailman/listinfo/

Re: non-owning references?

2009-07-24 Thread Gerhard Häring
Utpal Sarkar wrote: > Hi, > [...] You're looking for the weakref module. What you're describing there sounds like a nice exercise, but I cannot imagine why you'd really need to clean it up, if it really is a singleton. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: non-owning references?

2009-07-24 Thread Ben Finney
Utpal Sarkar writes: > Is there a way I can tell a variable that the object it is pointing > too is not owned by it, in the sense that if it is the only reference > to the object it can be garbage collected? Python doesn't have “pointers”, and doesn't really have “variables” either, at least not

Re: non-owning references?

2009-07-24 Thread Doetoe
On Jul 24, 3:06 pm, Ben Finney wrote: > Utpal Sarkar writes: > > Is there a way I can tell a variable that the object it is pointing > > too is not owned by it, in the sense that if it is the only reference > > to the object it can be garbage collected? > > Python doesn't have “pointers”, and doe

Re: how to get no value

2009-07-24 Thread Mark Lawrence
amr...@iisermohali.ac.in wrote: Hi, I have a file having lines:- 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = 85 ALA H = 8.60 N = CA = HA = 4.65 C = Now i want to make two another file in which i want to put those lines for w

Re: len() should always return something

2009-07-24 Thread Grant Edwards
On 2009-07-24, Dr. Phillip M. Feldman wrote: > > Some aspects of the Python design are remarkably clever, while > others leave me perplexed. Here's an example of the latter: > Why does len() give an error when applied to an int or float? > len() should always return something; in particular, when

Popen

2009-07-24 Thread Tim
Hi, I wonder if I use Popen, the parent process will wait for the child process to finish or continue without waiting? Thanks and regards! -- http://mail.python.org/mailman/listinfo/python-list

Re: non-owning references?

2009-07-24 Thread Hrvoje Niksic
Ben Finney writes: > Utpal Sarkar writes: > >> Is there a way I can tell a variable that the object it is pointing >> too is not owned by it, in the sense that if it is the only reference >> to the object it can be garbage collected? > > Python doesn't have “pointers”, and doesn't really have “v

Re: len() should always return something

2009-07-24 Thread Rhodri James
On Fri, 24 Jul 2009 14:57:02 +0100, Grant Edwards wrote: On 2009-07-24, Dr. Phillip M. Feldman wrote: Some aspects of the Python design are remarkably clever, while others leave me perplexed. Here's an example of the latter: Why does len() give an error when applied to an int or float? len()

Re: how to get no value

2009-07-24 Thread Grant Edwards
On 2009-07-24, amr...@iisermohali.ac.in wrote: > > Hi, > > I have a file having lines:- > > 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 > 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = > 85 ALA H = 8.60 N = CA = HA = 4.65 C = > > Now i want to make two another file in which

Re: non-owning references?

2009-07-24 Thread Rhodri James
On Fri, 24 Jul 2009 14:55:45 +0100, Hrvoje Niksic wrote: Ben Finney writes: Utpal Sarkar writes: Is there a way I can tell a variable that the object it is pointing too is not owned by it, in the sense that if it is the only reference to the object it can be garbage collected? Python

Re: strange python scripting error

2009-07-24 Thread nn
On Jul 23, 7:03 pm, Dave Angel wrote: > Mark Tarver wrote: > > I have a very strange error.  I have two test python files test.py and > > python.py which contain the following code > > > #!/usr/bin/python > > print "Content-type: text/html" > > print > > print "" > > print "Hello, Linux.com!" > >

Re: len() should always return something

2009-07-24 Thread Mark Dickinson
On Jul 24, 3:11 pm, "Rhodri James" wrote: > Which doesn't make your point less valid.  In fact I'd go so > far as to argue that what len() gives you is the number of > items in a container, so len(7) should return 0. Nah. 7 contains three bits, so len(7) should *clearly* return 3. Mark -- http

Re: len() should always return something

2009-07-24 Thread superpollo
Mark Dickinson wrote: On Jul 24, 3:11 pm, "Rhodri James" wrote: Which doesn't make your point less valid. In fact I'd go so far as to argue that what len() gives you is the number of items in a container, so len(7) should return 0. Nah. 7 contains three bits, so len(7) should *clearly* re

Re: len() should always return something

2009-07-24 Thread Diez B. Roggisch
Mark Dickinson schrieb: On Jul 24, 3:11 pm, "Rhodri James" wrote: Which doesn't make your point less valid. In fact I'd go so far as to argue that what len() gives you is the number of items in a container, so len(7) should return 0. Nah. 7 contains three bits, so len(7) should *clearly* re

Re: Popen

2009-07-24 Thread Kushal Kumaran
On Fri, Jul 24, 2009 at 7:33 PM, Tim wrote: > > Hi, > I wonder if I use Popen, the parent process will wait for the child process > to finish or continue without waiting? > Thanks and regards! > Assuming you mean subprocess.Popen, the child is executed asynchronously. You can use the wait() meth

Re: non-owning references?

2009-07-24 Thread Piet van Oostrum
> "Rhodri James" (RJ) wrote: >RJ> On Fri, 24 Jul 2009 14:55:45 +0100, Hrvoje Niksic >wrote: >>> Ben Finney writes: >>> Utpal Sarkar writes: > Is there a way I can tell a variable that the object it is pointing > too is not owned by it, in the sense that if it is the o

Re: Help understanding the decisions *behind* python?

2009-07-24 Thread Inky 788
On Jul 23, 3:42 am, Hendrik van Rooyen wrote: > On Wednesday 22 July 2009 16:36:51 Inky 788 wrote: > > > On Jul 22, 2:36 am, Hendrik van Rooyen > > > wrote: > > > The good reason is the immutability, which lets you use > > > a tuple as a dict key.   > > > Thanks for the reply Hendrik (and Steven

Re: len() should always return something

2009-07-24 Thread Piet van Oostrum
> "Rhodri James" (RJ) wrote: >RJ> On Fri, 24 Jul 2009 14:57:02 +0100, Grant Edwards wrote: >>> On 2009-07-24, Dr. Phillip M. Feldman wrote: Some aspects of the Python design are remarkably clever, while others leave me perplexed. Here's an example of the latter: Why doe

Re: non-owning references?

2009-07-24 Thread Ben Finney
Hrvoje Niksic writes: > The term "variable" is used in the Python language reference and > elsewhere Yes. It should also be abundantly clear from the constant stream of confused newbies on this point that its usage of that term is different to what many expect from usage elsewhere. > and is qui

Re: Popen

2009-07-24 Thread Piet van Oostrum
> Tim (T) wrote: >T> Hi, >T> I wonder if I use Popen, the parent process will wait for the child process >to finish or continue without waiting? >T> Thanks and regards! Only if you use Popen.wait(), Popen.communicate() or something similar like os.waitpid(), subprocess.call() -- P

Re: import vs imp and friends.

2009-07-24 Thread Emanuele D'Arrigo
Christian, Robert, thank you both for the replies, much appreciated. Manu -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get no value

2009-07-24 Thread Piet van Oostrum
Well actually your subject is `how to get no value'. Your code does that perfectly. :=) -- Piet van Oostrum URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list

Re: difference in printing to screen Mac / Windows

2009-07-24 Thread ryles
On Jul 18, 7:03 am, Tim Chase wrote: > Lastly, you can force all standard-output in your program to be > unbuffered without the "-u" parameter: And if you're using -u a lot, the PYTHONUNBUFFERED environment variable can also be set (but not empty), so that python adds the option automatically. --

Re: regex: multiple matching for one string

2009-07-24 Thread Scott David Daniels
ru...@yahoo.com wrote: Nick Dumas wrote: On 7/23/2009 9:23 AM, Mark Lawrence wrote: scriptlear...@gmail.com wrote: For example, I have a string "#a=valuea;b=valueb;c=valuec;", and I will like to take out the values (valuea, valueb, and valuec). How do I do that in Python? The group method wi

Re: Predefined Variables

2009-07-24 Thread Scott David Daniels
Stephen Cuppett (should have written in this order): "Fred Atkinson" wrote ... Is there a pre-defined variable that returns the GET line (http://www.php.net/index.php?everythingafterthequestionmark) as a single variable (rather than individual variables)? > os.environment('QUERY_STRING') Ma

Re: Popen

2009-07-24 Thread Tim
Thanks! Yes I mean subprocess.Popen. I was wondering the meaning of "asynchronously" Here is some code I am reading recently: " result = Popen(cmdline,shell=True,stdout=PIPE).stdout for line in result.readlines(): if find(line,"Cross") != -1: return float(split(line)[-1][0:-1]) " T

Re: Popen

2009-07-24 Thread Diez B. Roggisch
Tim schrieb: Thanks! Yes I mean subprocess.Popen. I was wondering the meaning of "asynchronously" Here is some code I am reading recently: " result = Popen(cmdline,shell=True,stdout=PIPE).stdout for line in result.readlines(): if find(line,"Cross") != -1: return float(split(line)[

Re: Popen

2009-07-24 Thread Francesco Bochicchio
On Jul 24, 6:24 pm, Tim wrote: > Thanks! > Yes I mean subprocess.Popen. > > I was wondering the meaning of "asynchronously" > Here is some code I am reading recently: > " > result = Popen(cmdline,shell=True,stdout=PIPE).stdout > for line in result.readlines(): >     if find(line,"Cross") != -1: >

SONAME for python modules is bad? (aka multiple module version)

2009-07-24 Thread mathieu
As far as I know there has not been any consensus on how to install multiple version of a same module in python ? What are the recommended mechanism ? I could not find any documentation on the subject. Does anyone sees any issue with using standard SONAME mechanism when installing a python module

Re: Popen

2009-07-24 Thread Tim
Thanks! If that is the case, i.e. the parent doesn't wait, is the code in my last post wrong? "result" could be nothing. --- On Fri, 7/24/09, Diez B. Roggisch wrote: > From: Diez B. Roggisch > Subject: Re: Popen > To: python-list@python.org > Date: Friday, July 24, 2009, 12:35 PM > Tim schrie

Re: Re: len() should always return something

2009-07-24 Thread Phillip M. Feldman
I've read the "Zen of Python", but most of these aphorisms are vague and could be understood differently by different readers.  In particular, I don't understand the statement that "explicit is better than implicit".  Some examples of this would be helpful.I've been converting Matlab codes to Pyth

Re: any suggestions to synchronize typed text and speech ?

2009-07-24 Thread Marcus Wanner
On 7/21/2009 12:13 PM, Stef Mientki wrote: hi Marcus, That sounds like a very specialized type of thing, Well from an application point of view, with the current netbooks, this looks like a perfect tool for any conversation or meeting. which only the few people with experience with wxPython, Py

Re: effbot.org broken (WAS: Problems in commands.getoutput(cmd) with sox)

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 2:38 AM, Piet van Oostrum wrote: >> Chris Rebert (CR) wrote: > >>CR> On Thu, Jul 23, 2009 at 12:42 PM, Chris Rebert wrote: You can use tabnanny to help diagnose the problem: http://74.125.155.132/search?q=cache:QtxvZm3QDLsJ:effbot.org/librarybook/tabnanny.htm+

Re: Help understanding the decisions *behind* python?

2009-07-24 Thread Uncle Roastie
On Jul 20, 12:27 pm, Phillip B Oldham wrote: > My colleagues and I have been working with python for around 6 months > now, and while we love a lot of what python has done for us and what > it enables us to do some of the decisions behind such certain > data-types and their related methods baffle

cgi.fieldstorage()

2009-07-24 Thread gert
this is a non standard way to store multi part post data on disk def application(environ, response): with open('/usr/httpd/var/wsgiTemp','w') as f: while True: chunk = environ['wsgi.input'].read(8192).decode('latin1') if not chunk: break f.write(chun

Re: Popen

2009-07-24 Thread Chris Rebert
> --- On Fri, 7/24/09, Diez B. Roggisch wrote: > >> From: Diez B. Roggisch >> Subject: Re: Popen >> To: python-list@python.org >> Date: Friday, July 24, 2009, 12:35 PM >> Tim schrieb: >> > Thanks! Yes I mean subprocess.Popen. >> > >> > I was wondering the meaning of "asynchronously" >> > Here is

Re: SONAME for python modules is bad? (aka multiple module version)

2009-07-24 Thread Diez B. Roggisch
mathieu schrieb: As far as I know there has not been any consensus on how to install multiple version of a same module in python ? What are the recommended mechanism ? I use virtualenvs for everything. Especially on unixish OSes this usually works without problems. On windows, things are a bi

Re: cgi.fieldstorage()

2009-07-24 Thread Diez B. Roggisch
gert schrieb: this is a non standard way to store multi part post data on disk def application(environ, response): with open('/usr/httpd/var/wsgiTemp','w') as f: while True: chunk = environ['wsgi.input'].read(8192).decode('latin1') if not chunk: break

Re: trouble with wrapping a c program

2009-07-24 Thread Chris Rebert
On Fri, Jul 24, 2009 at 5:34 AM, Sanne Korzec wrote: > Hi Mailing, > > I am using a c program, which first initializes for some seconds and then > waits for user input (keyboard) to type something. When enter is pressed the > c program continues. > Using the keyboard and then enter in the c progra

Re: len() should always return something

2009-07-24 Thread Rhodri James
On Fri, 24 Jul 2009 16:10:07 +0100, Piet van Oostrum wrote: "Rhodri James" (RJ) wrote: RJ> On Fri, 24 Jul 2009 14:57:02 +0100, Grant Edwards wrote: On 2009-07-24, Dr. Phillip M. Feldman wrote: Some aspects of the Python design are remarkably clever, while others leave me perplexed. He

Re: trouble with minidom

2009-07-24 Thread Ronn Ross
On Tue, Jul 21, 2009 at 7:32 PM, Gabriel Genellina wrote: > En Tue, 21 Jul 2009 21:08:57 -0300, Ronn Ross > escribió: > > > Hello I'm trying to read an xml file using minidome. The xml looks like: >> >> >> myProj >> /here/ >> >> >> >> My code looks like so: >> from xml.dom.mini

ElementTree's Element substitution in Python 3

2009-07-24 Thread André
I have a function to replace the content of an ElementTree Element by that of another one which works using Python 2 but not with Python 3. I get an assertion error. The function is as follows: def replace_element(elem, replacement): '''replace the content of an ElementTree Element by that of

Re: Re: len() should always return something

2009-07-24 Thread Chris Rebert
> Jul 24, 2009 07:02:29 AM, c...@rebertia.com wrote: > > On Thu, Jul 23, 2009 at 11:35 PM, Dr. Phillip M. > Feldman wrote: >> >> Some aspects of the Python design are remarkably clever, while others >> leave >> me perplexed. Here's an example of the latter: Why does len() give an >> error >> when a

Re: non-owning references?

2009-07-24 Thread Rhodri James
On Fri, 24 Jul 2009 16:03:58 +0100, Piet van Oostrum wrote: "Rhodri James" (RJ) wrote: RJ> On Fri, 24 Jul 2009 14:55:45 +0100, Hrvoje Niksic wrote: Ben Finney writes: Utpal Sarkar writes: Is there a way I can tell a variable that the object it is pointing too is not owned by it, i

Re: If Scheme is so good why MIT drops it?

2009-07-24 Thread Raffael Cavallaro
On 2009-07-23 23:51:02 -0400, Carl Banks said: On Jul 23, 5:52 pm, Rui Maciel wrote: fft1976 wrote: How do you explain that something as inferior as Python beat Lisp in the market place despite starting 40 years later. Probably due to similar reasons that lead php to become remotely releva

Re: cgi.fieldstorage()

2009-07-24 Thread gert
On Jul 24, 7:32 pm, "Diez B. Roggisch" wrote: > gert schrieb: > > > this is a non standard way to store multi part post data on disk > > > def application(environ, response): > >     with open('/usr/httpd/var/wsgiTemp','w') as f: > >         while True: > >             chunk = environ['wsgi.input'

exceptions.TypeError an integer is required

2009-07-24 Thread jakecjacobson
I am trying to do a post to a REST API over HTTPS and requires the script to pass a cert to the server. I am getting "exceptions.TypeError an integer is required" error and can't find the reason. I commenting out the lines of code, it is happening on the connection.request() line. Here is the pr

Re: Predefined Variables

2009-07-24 Thread Piet van Oostrum
> Scott David Daniels (SDD) wrote: >SDD> Stephen Cuppett (should have written in this order): >>> "Fred Atkinson" wrote ... Is there a pre-defined variable that returns the GET line (http://www.php.net/index.php?everythingafterthequestionmark) as a single variable (rathe

Re: len() should always return something

2009-07-24 Thread Terry Reedy
Phillip M. Feldman wrote: I've been converting Matlab codes to Python. In Matlab, a scalar is just a one-by-one matrix and has a length of 1. This convention seems no less arbitrary to me than Python's convention that the concept of length is not applicable to ints and floats. Multiplicati

How can I get the line number ?

2009-07-24 Thread kk
Hello I am writing some Python code that runs in another application(has wrapper functions). Due to lack of debugging I am printing out alot of outputs and manual messages. I want to be able to create a function that would let me print the current line number that is called from. This is not for d

Re: How can I get the line number ?

2009-07-24 Thread Maxim Khitrov
On Fri, Jul 24, 2009 at 2:51 PM, kk wrote: > Hello > > I am writing some Python code that runs in another application(has > wrapper functions). Due to lack of debugging I am printing out alot of > outputs and manual messages. I want to be able to create a function > that would let me print the curr

Re: len() should always return something

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 16:50:03 +0200, superpollo wrote: >> Nah. 7 contains three bits, so len(7) should *clearly* return 3. > > and len("7") must return 8, by the same token... but wait! > > >>> len("7") > 1 > >>> > >>> > my python installation must me outdated ;-) No no no, you're obviously

Re: Convert points to polygon shapefile

2009-07-24 Thread Robert Kern
On 2009-07-24 05:21, Luis Pedro Almeida wrote: Dear all, I would like to know how to convert a list of points into a polygon shapefile (esri). shapelib has Python bindings. http://shapelib.maptools.org/ -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless e

Re: non-owning references?

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 15:55:45 +0200, Hrvoje Niksic wrote: > The term "variable" is used in the Python > language reference and elsewhere, and is quite compatible with how other > popular languages (Java, PHP, Lisp, ...) use it. Please stop > complaining about valid terminology; it is not helpful.

list vs. tuple [Re: len() should always return something]

2009-07-24 Thread Roy Smith
In article , Terry Reedy wrote: > Better:if isinstance(x, (int, float, complex)): I never noticed this before, but it seems odd that the second argument to isinstance() should be a tuple. Using the normal arguments made about tuples vs. lists, it seems like a list would be the right data

Re: len() should always return something

2009-07-24 Thread Roy Smith
In article <0279f596$0$5185$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Fri, 24 Jul 2009 16:50:03 +0200, superpollo wrote: > > >> Nah. 7 contains three bits, so len(7) should *clearly* return 3. > > > > and len("7") must return 8, by the same token... but wait! > > > > >>> len("

Re: len() should always return something

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 00:02:28 -0700, Chris Rebert wrote: > On Thu, Jul 23, 2009 at 11:35 PM, Dr. Phillip M. > Feldman wrote: >> >> Some aspects of the Python design are remarkably clever, while others >> leave me perplexed. Here's an example of the latter: Why does len() >> give an error when appli

Re: ElementTree's Element substitution in Python 3

2009-07-24 Thread André
Sorry for replying to myself ... the following seems to be a working solution to my original problem. On Jul 24, 2:54 pm, André wrote: > I have a function to replace the content of an ElementTree Element by > that of another one which works using Python 2 but not with Python 3. > I get an asserti

Re: exceptions.TypeError an integer is required

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 11:24:58 -0700, jakecjacobson wrote: > I am trying to do a post to a REST API over HTTPS and requires the > script to pass a cert to the server. I am getting "exceptions.TypeError > an integer is required" error and can't find the reason. I commenting > out the lines of code,

Eclipse Pydev update error ?

2009-07-24 Thread Linuxguy123
Does anyone know why this error is occurring in my Eclipse Pydev update ? An error occurred while collecting items to be installed No repository found containing: org.python.pydev/osgi.bundle/1.4.7.2843 No repository found containing: org.python.pydev.ast/osgi.bundle/1.4.7.2843 No repository

Re: Adding method from one class to another class or to instance of another class

2009-07-24 Thread Terry Reedy
marekw2143 wrote: Hi, I have one class (A) that has defined method createVars. I would like to add that method to class B The code looks like this: class A(object): def createVars(self): self.v1 = 1 self.v2 = 3 pass class B(object): pass I don't want to use inheritan

Re: list vs. tuple [Re: len() should always return something]

2009-07-24 Thread Steven D'Aprano
On Fri, 24 Jul 2009 15:03:29 -0400, Roy Smith wrote: > In article , > Terry Reedy wrote: > >> Better:if isinstance(x, (int, float, complex)): > > I never noticed this before, but it seems odd that the second argument > to isinstance() should be a tuple. Using the normal arguments made > a

Re: ElementTree's Element substitution in Python 3

2009-07-24 Thread Piet van Oostrum
> André (A) a écrit: >A> I have a function to replace the content of an ElementTree Element by >A> that of another one which works using Python 2 but not with Python 3. >A> I get an assertion error. The function is as follows: >A> def replace_element(elem, replacement): >A> '''replace t

Re: Eclipse Pydev update error ?

2009-07-24 Thread Fabio Zadrozny
On Fri, Jul 24, 2009 at 4:17 PM, Linuxguy123 wrote: > Does anyone know why this error is occurring in my Eclipse Pydev > update ? > > An error occurred while collecting items to be installed >  No repository found containing: > org.python.pydev/osgi.bundle/1.4.7.2843 >  No repository found containi

  1   2   >