Re: Eclipse/PyDev - BOM Lexical Error

2010-10-13 Thread Steven D'Aprano
On Thu, 14 Oct 2010 16:41:13 +1300, Lawrence D'Oliveiro wrote: > In message , Ethan > Furman wrote: > >> Lawrence D'Oliveiro wrote: >> >>> In message , >>> Ethan Furman wrote: >>> Lawrence D'Oliveiro wrote: >In message , >Ethan Furman wrote: > MS treats those first three

Question regarding python2.5 migration from windows xp to windows 7

2010-10-13 Thread python_tsp
Hi, We have a Python based test framework which is being used in various projects. Our current environment is Python (ver 2.5.1) wxPython (wxPython2.8-win32-ansi-2.8.6.0-py25) pywin32-210.win32-py2.5 vcredist_x86.exe pyserial-2.2 Our Framework is being currently used in Windows XP. The issue is

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Chris Torek
In article Roger Davis wrote: >My understanding is that this functionality is best coded via >subprocess.Popen(). "Best" is always a big question mark. :-) >I need to read output from these spawned children >via a pipe from their stdout, hence something like > > p= subprocess.Popen(args, s

Question regarding python migration

2010-10-13 Thread Pramod Thirthachar Sridhar
Hi, We have a Python based test framework which is being used in various projects. Our current environment is Python (ver 2.5.1) wxPython (wxPython2.8-win32-ansi-2.8.6.0-py25) pywin32-210.win32-py2.5 vcredist_x86.exe pyserial-2.2 Our Framework is being currently used in Windows XP.

Question regarding python migration

2010-10-13 Thread Pramod Thirthachar Sridhar
Hi, We have a Python based test framework which is being used in various projects. Our current environment is Python (ver 2.5.1) wxPython (wxPython2.8-win32-ansi-2.8.6.0-py25) pywin32-210.win32-py2.5 vcredist_x86.exe pyserial-2.2 Our Framework is being currently used in Windows XP.

Python, Windows, and file sockets

2010-10-13 Thread culix
Hey list, I have a question about unix-style file sockets and/or named pipes with python. I have a linux server program that uses a file socket to listen for connections. It has been ported to Windows with cygwin (I'm running WinXP SP3). On linux I have a python script that acts as a client - it c

Re: Whining about "struct"

2010-10-13 Thread Ned Deily
In article , Tim Roberts wrote: > I have a bad memory. I admit it. Because of that, the Python "help" > system is invaluable to me. Up through Python 2.5, I could get a quick > reference to the format specifiers for the struct module via > import struct; help(struct) > > I used that a LOT.

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Nobody
On Wed, 13 Oct 2010 14:58:57 -0700, Roger Davis wrote: > My understanding is that this functionality is best coded via > subprocess.Popen(). I need to read output from these spawned children > via a pipe from their stdout, hence something like > > p= subprocess.Popen(args, stdout=subprocess.

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Seebs
On 2010-10-13, Roger Davis wrote: > Hi, I am new to this group, please forgive me if this is a repeat > question. I am a new Python programmer but experienced in C/Unix. I am > converting a shell script to Python which essentially loops > infinitely, each pass through the loop running commands lik

Re: Whining about "struct"

2010-10-13 Thread Terry Reedy
On 10/14/2010 12:30 AM, Tim Roberts wrote: I have a bad memory. I admit it. Because of that, the Python "help" system is invaluable to me. Up through Python 2.5, I could get a quick reference to the format specifiers for the struct module via import struct; help(struct) I used that a LOT.

Whining about "struct"

2010-10-13 Thread Tim Roberts
I have a bad memory. I admit it. Because of that, the Python "help" system is invaluable to me. Up through Python 2.5, I could get a quick reference to the format specifiers for the struct module via import struct; help(struct) I used that a LOT. But in Python 2.6, the struct module moved fr

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Paul Rubin
Steve Howell writes: > And yet nobody can recite this equally interesting ratio to thousands > of digits: > > 0.2141693770623265... That is 1/F1 where F1 is the first Feigenbaum constant a/k/a delta. The mathworld article is pretty good: http://mathworld.wolfram.com/FeigenbaumConstant.html I

Re: how to add patch

2010-10-13 Thread Steve Howell
On Oct 13, 12:36 pm, jimgardener wrote: > hi > I have some demo python  code hosted on a public host that uses > subversion..and I want to modify one of the files using a patch file > handed to me by another person..How do I do this?Generally I checkout > the code and make the change and then comm

Re: Eclipse/PyDev - BOM Lexical Error

2010-10-13 Thread Lawrence D'Oliveiro
In message , Ethan Furman wrote: > Lawrence D'Oliveiro wrote: > >> In message , Ethan >> Furman wrote: >> >>>Lawrence D'Oliveiro wrote: >>> In message , Ethan Furman wrote: >>>MS treats those first three bytes as a flag -- if they equal the BOM, MS >>>treats it as UTF-8, if they equ

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Steve Howell
On Oct 13, 12:31 pm, Steven D'Aprano wrote: 0.2141693770623265 > > Perhaps this will help illustrate what I'm talking about... the > mathematician Mitchell Feigenbaum discovered in 1975 that, for a large > class of chaotic systems, the ratio of each bifurcation interval to the > next approached a

Re: Help needed - To get path of a directory

2010-10-13 Thread Lawrence D'Oliveiro
In message , Kingsley Turner wrote: > I don't know how to enumerate all your windows device letters. There are only 26 of them, so you can try them all, right? -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread Lawrence D'Oliveiro
In message <4cb5e659$0$1650$742ec...@news.sonic.net>, John Nagle wrote: > Also note that there are some issues with doing a huge volume of > updates in one MySQL InnoDB transaction. The system has to keep the > data needed to undo the updates, and there's a limit on the amount of > pending t

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > Bulk-load strategies usually solve one or more of these problems: > > network latency That’s not an issue. This is a bulk operation, after all. > index maintenance during the upload There are usually options to temporarily turn this off. > parsing of the

Re: how to add patch

2010-10-13 Thread Lawrence D'Oliveiro
In message , Diez B. Roggisch wrote: > My first attempt would be > > cd my_project > patch -p0 < the.patch > > But it might not work, depending on how the patch was created. If the OP can post some initial part of the patch (probably the first dozen lines should be ample), we can get a bet

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Steven D'Aprano
On Wed, 13 Oct 2010 21:52:54 +0100, Arnaud Delobelle wrote: > Steven D'Aprano writes: > >> On Wed, 13 Oct 2010 16:17:19 +0200, Antoon Pardon wrote: >> >>> On Wed, Oct 13, 2010 at 01:20:30PM +, Steven D'Aprano wrote: On Tue, 12 Oct 2010 22:13:26 -0700, RG wrote: >> The formula

Re: Scheme as a virtual machine?

2010-10-13 Thread Ertugrul Söylemez
namekuseijin wrote: > On 13 out, 21:01, Ertugrul Söylemez wrote: > > What exactly is "friggin' huge" and "complex" about Haskell, and > > what's this stuff about a "very own monolithic gcc"?  Haskell isn't > > a lot more complex than Scheme.  In fact, Python is much more > > complex.  Reduced to

Re: Help with sets

2010-10-13 Thread Steve Howell
On Oct 13, 7:25 pm, Lawrence D'Oliveiro wrote: > In message > , Steve > > Howell wrote: > > I guess a lot depends on how you define "symmetry."  Is your > > definition of "symmetry" equivalent to your definition of > > "orthogonality"? > > No idea. It’s just that the example being discussed in thi

Re: Help needed - To get path of a directory

2010-10-13 Thread Kingsley Turner
On 13/10/10 15:26, Bishwarup Banerjee wrote: I want to get the absolute path of the Directory I pass explicitly. Like functionName("\abcd"). I should pass the name of the directory and the function should search for it in the Hard drives and return me the full path of location on the drive. I

Re: Help with sets

2010-10-13 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > I guess a lot depends on how you define "symmetry." Is your > definition of "symmetry" equivalent to your definition of > "orthogonality"? No idea. It’s just that the example being discussed in this thread seemed to come under the old term “orthogonality”, so

Re: Scheme as a virtual machine?

2010-10-13 Thread namekuseijin
On 13 out, 19:41, p...@informatimago.com (Pascal J. Bourguignon) wrote: > namekuseijin writes: > > On 11 out, 08:49, Oleg  Parashchenko wrote: > >> Hello, > > >> I'd like to try the idea that Scheme can be considered as a new > >> portable assembler. We could code something in Scheme and then com

Re: Scheme as a virtual machine?

2010-10-13 Thread namekuseijin
On 13 out, 21:01, Ertugrul Söylemez wrote: > What exactly is "friggin' huge" and "complex" about Haskell, and what's > this stuff about a "very own monolithic gcc"?  Haskell isn't a lot more > complex than Scheme.  In fact, Python is much more complex.  Reduced to > bare metal (i.e. leaving out sy

Re: Help with sets

2010-10-13 Thread Steve Howell
On Oct 13, 4:27 pm, Lawrence D'Oliveiro wrote: > In message > <57a322df-8e42-4da5-af96-0c21c5733...@b14g2000pro.googlegroups.com>, Steve > > Howell wrote: > > Lawrence, I was actually talking about symmetry, not orthogonality. > > So what’s the difference? I don't think there's a big difference b

Re: Using csv.DictReader with \r\n in the middle of fields

2010-10-13 Thread Tim Chase
On 10/13/10 11:33, Dennis Lee Bieber wrote: While I've not tested it, my understanding of the documentation indicates that the reader /can/ handle multi-line fields IF QUOTED... (you may still have to strip the terminator out of the description data after it has been loaded). Tha

Re: My first Python program

2010-10-13 Thread Ben Finney
Christian Heimes writes: > msg = ("WARNING: " >"Pants on fire") Ick. When the name changes to something with a different length, you'll need to change every continuation line. A name change is easily predicted and quite likely to happen often in one's code, so why invite more work when it

Re: My first Python program

2010-10-13 Thread Ben Finney
"Jonas H." writes: > On 10/13/2010 11:26 PM, Seebs wrote: > >> stderr.write( > >> "WARNING:" > >> " Pants on fire\n") > > > > Hmm. So I just indent stuff inside the ()s or whatever? I can work with > > that. > > I think common is > > stderr.write("WARNING: ", >

Re: My first Python program

2010-10-13 Thread Ben Finney
Seebs writes: > On 2010-10-13, Ben Finney wrote: > > Python borrows from C in that consecutive literal strings are > > concatenated in the bytecode:: > > > > stderr.write( > > "WARNING:" > > " Pants on fire\n") > > Hmm. So I just indent stuff inside the ()s or whatever? I can

Re: Scheme as a virtual machine?

2010-10-13 Thread Ertugrul Söylemez
namekuseijin wrote: > Take haskell and its so friggin' huge and complex that its got its > very own scary monolithic gcc. When you think of it, Scheme is the > one true high-level language with many quality perfomant backends -- > CL has a few scary compilers for native code, but not one to java

Re: Compiling as 32bit on MacOSX

2010-10-13 Thread Ned Deily
In article <8hmpchfsh...@mid.individual.net>, Gregory Ewing wrote: > Ned Deily wrote: > > You'll also need to specify the appropriate SDK using Apple's gcc > > -sysroot option. > Are you sure? I'm not asking for ppc + i386, I'm > asking for i386 + x86_64. I can get either of these > individuall

Re: Searching in str backwards

2010-10-13 Thread Chris Kaynor
Look up the string's rfind method. Chris On Wed, Oct 13, 2010 at 4:28 PM, Pratik Khemka wrote: > I want to search for a symbol in a string backwards.. > For eg: > > *line = "my/cat/dog/baby"* > ** > *line.find('/')* *# but from the back...* > > The reason I want to do this is because I want t

Re: Searching in str backwards

2010-10-13 Thread Emile van Sebille
On 10/13/2010 4:28 PM Pratik Khemka said... line = "my/cat/dog/baby" Introspection is your friend >>> line = "my/cat/dog/baby" >>> dir(line) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem_ _', '__getnewar

Re: Help with sets

2010-10-13 Thread Lawrence D'Oliveiro
In message <57a322df-8e42-4da5-af96-0c21c5733...@b14g2000pro.googlegroups.com>, Steve Howell wrote: > Lawrence, I was actually talking about symmetry, not orthogonality. So what’s the difference? -- http://mail.python.org/mailman/listinfo/python-list

Searching in str backwards

2010-10-13 Thread Pratik Khemka
I want to search for a symbol in a string backwards.. For eg: line = "my/cat/dog/baby" line.find('/') # but from the back... The reason I want to do this is because I want to print the last part of the string after the '/' . And I do not know how long the string might be or how many '/' i

Re: how to add patch

2010-10-13 Thread Diez B. Roggisch
jimgardener writes: > hi > I have some demo python code hosted on a public host that uses > subversion..and I want to modify one of the files using a patch file > handed to me by another person..How do I do this?Generally I checkout > the code and make the change and then commit again..I have ne

Re: Difficulty in easy_install

2010-10-13 Thread Diez B. Roggisch
John Nagle writes: > On 10/11/2010 1:45 AM, sankalp srivastava wrote: >> >> I am having difficulty in easy_installing >> I use a proxy server and strange errors , like it can't fetch the >> package is showing up . >> the package is pyspeech ...please help me :( >> >> I don't know if the proxy s

Re: what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Mike Kent
You might want to check out the Python 2.7 'pipes' standard library module: http://docs.python.org/library/pipes.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Scheme as a virtual machine?

2010-10-13 Thread Pascal J. Bourguignon
namekuseijin writes: > On 11 out, 08:49, Oleg Parashchenko wrote: >> Hello, >> >> I'd like to try the idea that Scheme can be considered as a new >> portable assembler. We could code something in Scheme and then compile >> it to PHP or Python or Java or whatever. >> >> Any suggestions and point

Re: My first Python program

2010-10-13 Thread Christian Heimes
Am 14.10.2010 00:00, schrieb Jonas H.: > If you haven't got braces around an expression and you want it to be > multi-line, you need a '\' at the end of each line, just like C macros: > > msg = "WARNING: " \ >"Pants on fire" or msg = ("WARNING: " "Pants on fire") Christ

Re: Compiling as 32bit on MacOSX

2010-10-13 Thread Gregory Ewing
Ned Deily wrote: You'll also need to specify the appropriate SDK using Apple's gcc -sysroot option. Are you sure? I'm not asking for ppc + i386, I'm asking for i386 + x86_64. I can get either of these individually without switching SDKs. -- Greg -- http://mail.python.org/mailman/listinfo/pyth

Re: Hyperlink to a file using python

2010-10-13 Thread Chris Rebert
>> To: python-list@python.org >> From: em...@fenx.com >> Subject: Re: Hyperlink to a file using python >> Date: Wed, 13 Oct 2010 14:19:36 -0700 >> >> On 10/13/2010 1:57 PM Pratik Khemka said... >> > >> > I want to create a hyperlink in my excel sheet using python such that >> > when you click on th

RE: Hyperlink to a file using python

2010-10-13 Thread Pratik Khemka
This file is present on my hardrive..This file is present in the same folder in which the python code file is present...so http: wont work.. > To: python-list@python.org > From: em...@fenx.com > Subject: Re: Hyperlink to a file using python > Date: Wed, 13 Oct 2010 14:19:36 -0700 > > On 10/13

what happens to Popen()'s parent-side file descriptors?

2010-10-13 Thread Roger Davis
Hi, I am new to this group, please forgive me if this is a repeat question. I am a new Python programmer but experienced in C/Unix. I am converting a shell script to Python which essentially loops infinitely, each pass through the loop running commands like set output = `cat this | grep that

Re: My first Python program

2010-10-13 Thread Jonas H.
On 10/13/2010 11:26 PM, Seebs wrote: stderr.write( "WARNING:" " Pants on fire\n") Hmm. So I just indent stuff inside the ()s or whatever? I can work with that. I think common is stderr.write("WARNING: ", "Pants on fire") or stderr.write(

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Pascal J. Bourguignon
Steven D'Aprano writes: > On Wed, 13 Oct 2010 17:28:42 +0200, Pascal J. Bourguignon wrote: > But what exactly *is* this number? Is it 0.25, 1.57 or 90? >>> >>> That's the wrong question. It's like asking, what exactly "is" the >>> number twenty-one -- is it "one and twenty", or 21, or 0x15,

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Ben Finney wrote: > Python borrows from C in that consecutive literal strings are > concatenated in the bytecode:: > > stderr.write( > "WARNING:" > " Pants on fire\n") Hmm. So I just indent stuff inside the ()s or whatever? I can work with that. -s -- Copyri

PyCharm

2010-10-13 Thread Robert H
Since the new IDE from Jetbrains is out I was wondering if "you" are using it and what "you" think about it. I have to start learning Python for a project at work and I am looking around for options. Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: My first Python program

2010-10-13 Thread Hallvard B Furuseth
Ethan Furman writes: >Seebs wrote: >>On 2010-10-12, Hallvard B Furuseth wrote: self.type, self.name = None, None >> >>> Actually you can write self.type = self.name = None, >>> though assignment statements are more limited than in C. >>> (And I think they're assigned left-to-right.) > > Pytho

Re: Hyperlink to a file using python

2010-10-13 Thread Emile van Sebille
On 10/13/2010 1:57 PM Pratik Khemka said... I want to create a hyperlink in my excel sheet using python such that when you click on that link (which is a file name (html file)), the file automatically opens. This file is present in the same folder in which the python code file is present. I

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Gregory Ewing
RG wrote: I just couldn't wrap my brain around what it meant to square a second. That's nothing. Magnetic permeability is measured in newtons per square amp... -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Hyperlink to a file using python

2010-10-13 Thread Chris Rebert
On Wed, Oct 13, 2010 at 1:57 PM, Pratik Khemka wrote: > I want to create a hyperlink in my excel sheet using python such that when > you click on that link (which is a file name (html file)), the file > automatically opens. This file is present in the same folder in which the > python code file is

Re: Scheme as a virtual machine?

2010-10-13 Thread namekuseijin
On 11 out, 08:49, Oleg Parashchenko wrote: > Hello, > > I'd like to try the idea that Scheme can be considered as a new > portable assembler. We could code something in Scheme and then compile > it to PHP or Python or Java or whatever. > > Any suggestions and pointers to existing and related work

Re: Exceptions are not just for errors (was: My first Python program)

2010-10-13 Thread Emmanuel Surleau
> Seebs writes: > > On 2010-10-13, Chris Rebert wrote: > > > For future reference, the significant majority of things in Python > > > raise exceptions upon encountering errors rather than returning > > > error values of some sort. > > > > Yes. I'm getting used to that -- it's a bit of a shift,

Hyperlink to a file using python

2010-10-13 Thread Pratik Khemka
I want to create a hyperlink in my excel sheet using python such that when you click on that link (which is a file name (html file)), the file automatically opens. This file is present in the same folder in which the python code file is present. I am using xlwt module link= 'abcd.html'

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Arnaud Delobelle
Steven D'Aprano writes: > On Wed, 13 Oct 2010 16:17:19 +0200, Antoon Pardon wrote: > >> On Wed, Oct 13, 2010 at 01:20:30PM +, Steven D'Aprano wrote: >>> On Tue, 12 Oct 2010 22:13:26 -0700, RG wrote: >>> >>> >> The formula: circumference = 2 x pi x radius is taught in primary >>> >> schools,

Re: My first Python program

2010-10-13 Thread Ben Finney
Seebs writes: > 1. If I have a message that I wish to print, it is quite possible that > message + indentation exceeds 80 lines. What's the idiomatic way to > solve this? Do I just break the string up into parts, or do I just > accept that some lines are over 80 characters, or what? Python borro

Exceptions are not just for errors (was: My first Python program)

2010-10-13 Thread Ben Finney
Seebs writes: > On 2010-10-13, Chris Rebert wrote: > > For future reference, the significant majority of things in Python > > raise exceptions upon encountering errors rather than returning > > error values of some sort. > > Yes. I'm getting used to that -- it's a bit of a shift, because I'm >

Re: how to add patch

2010-10-13 Thread Jason Swails
On Wed, Oct 13, 2010 at 3:36 PM, jimgardener wrote: > hi > I have some demo python code hosted on a public host that uses > subversion..and I want to modify one of the files using a patch file > handed to me by another person..How do I do this?Generally I checkout > the code and make the change

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Aleksej Saushev
"BartC" writes: > "Thomas A. Russ" wrote in message > news:ymi1v7vgyp8@blackcat.isi.edu... >> torb...@diku.dk (Torben ZÆgidius Mogensen) writes: >> >>> Trigonometric functions do take arguments of particular units: radians >>> or (less often) degrees, with conversion needed if you use the "w

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Steven D'Aprano
On Wed, 13 Oct 2010 17:28:42 +0200, Pascal J. Bourguignon wrote: >>> But what exactly *is* this number? Is it 0.25, 1.57 or 90? >> >> That's the wrong question. It's like asking, what exactly "is" the >> number twenty-one -- is it "one and twenty", or 21, or 0x15, or 0o25, >> or 21.0, or 20.999...

how to add patch

2010-10-13 Thread jimgardener
hi I have some demo python code hosted on a public host that uses subversion..and I want to modify one of the files using a patch file handed to me by another person..How do I do this?Generally I checkout the code and make the change and then commit again..I have never done through patch..Can some

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Steven D'Aprano
On Wed, 13 Oct 2010 16:17:19 +0200, Antoon Pardon wrote: > On Wed, Oct 13, 2010 at 01:20:30PM +, Steven D'Aprano wrote: >> On Tue, 12 Oct 2010 22:13:26 -0700, RG wrote: >> >> >> The formula: circumference = 2 x pi x radius is taught in primary >> >> schools, yet it's actually a very difficult

Re: My first Python program

2010-10-13 Thread MRAB
On 13/10/2010 20:03, Seebs wrote: On 2010-10-13, Chris Rebert wrote: For future reference, the significant majority of things in Python raise exceptions upon encountering errors rather than returning error values of some sort. Yes. I'm getting used to that -- it's a bit of a shift, because I

Re: My first Python program

2010-10-13 Thread Chris Kaynor
On Wed, Oct 13, 2010 at 12:12 PM, Seebs wrote: > On 2010-10-13, Jonas H. wrote: > > Not really. Files will be closed when the garbage collector collects the > > file object, but you can't be sure the GC will run within the next N > > seconds/instructions or something like that. So you should *al

Re: My first Python program

2010-10-13 Thread Chris Kaynor
On Wed, Oct 13, 2010 at 12:13 PM, Seebs wrote: > On 2010-10-13, Chris Torek wrote: > > Unfortunately "with" is newish and this code currently has to > > support python 2.3 (if not even older versions). > > I think it might be 2.4 and later. I'm not sure. Of course, this being > the real world,

Re: My first Python program

2010-10-13 Thread Chris Kaynor
On Wed, Oct 13, 2010 at 12:10 PM, Seebs wrote: > On 2010-10-13, Jean-Michel Pichavant wrote: > > If you wonder about some defects reported by such linters, you can then > > ask in this list why something is not that good, because it may not be > > always obvious. > > > 'pylint' is one them, pret

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Chris Torek wrote: > Unfortunately "with" is newish and this code currently has to > support python 2.3 (if not even older versions). I think it might be 2.4 and later. I'm not sure. Of course, this being the real world, the chances that I'll be able to stick with "Python 2" and

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Jonas H. wrote: > Not really. Files will be closed when the garbage collector collects the > file object, but you can't be sure the GC will run within the next N > seconds/instructions or something like that. So you should *always* make > sure to close files after using them. Tha

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Jean-Michel Pichavant wrote: > If you wonder about some defects reported by such linters, you can then > ask in this list why something is not that good, because it may not be > always obvious. > 'pylint' is one them, pretty effective. Okay, several questions about stuff pylint

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Steven D'Aprano
On Wed, 13 Oct 2010 15:07:07 +0100, Tim Bradshaw wrote: > On 2010-10-13 14:20:30 +0100, Steven D'Aprano said: > >> ncorrect -- it's not necessarily so that the ratio of the circumference >> to the radius of a circle is always the same number. It could have >> turned out that different circles had

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-13, Chris Rebert wrote: > For future reference, the significant majority of things in Python > raise exceptions upon encountering errors rather than returning error > values of some sort. Yes. I'm getting used to that -- it's a bit of a shift, because I'm used to exceptions being *exc

Re: My first Python program

2010-10-13 Thread Chris Torek
In article Jonas H. wrote: >On 10/13/2010 06:48 PM, Seebs wrote: >> Is it safe for me to assume that all my files will have been flushed and >> closed? I'd normally assume this, but I seem to recall that not every >> language makes those guarantees. > >Not really. Files will be closed when the g

Re: My first Python program

2010-10-13 Thread Chris Torek
In article Seebs wrote: >> * raising `Exception` rather than a subclass of it is uncommon. > >Okay. I did that as a quick fix when, finally having hit one of them, >I found out that 'raise "Error message"' didn't work. :) I'm a bit unsure >as to how to pick the right subclass, though. For ex

Re: My first Python program

2010-10-13 Thread Ian Kelly
On Wed, Oct 13, 2010 at 11:28 AM, Ethan Furman wrote: > Seebs wrote: > >> On 2010-10-12, Hallvard B Furuseth wrote: >> > > > >> self.type, self.name = None, None >>> >> Actually you can write self.type = self.name = None, >>> though assignment statements are more limited than in C. >>> (A

Re: how do I search python mailing list archives?

2010-10-13 Thread Ned Deily
In article , Daniel Fetchinson wrote: > > What are the various ways to search the python mailing list archives? > > If you are searching for 'foo' and 'bar' you can try this in google: > > foo bar site:mail.python.org inurl:python-list The mailing list is also mirrored at gmane.org under the

Re: My first Python program

2010-10-13 Thread Jonas H.
On 10/13/2010 06:48 PM, Seebs wrote: Is it safe for me to assume that all my files will have been flushed and closed? I'd normally assume this, but I seem to recall that not every language makes those guarantees. Not really. Files will be closed when the garbage collector collects the file ob

Re: My first Python program

2010-10-13 Thread MRAB
On 13/10/2010 18:17, Chris Rebert wrote: On Wed, Oct 13, 2010 at 9:56 AM, Seebs wrote: On 2010-10-12, MRAB wrote: Line 51 The __init__ method should always return None. There's no need to be explicit about it, just use a plain "return". The real issue here is that I was assuming that o

Re: My first Python program

2010-10-13 Thread Jean-Michel Pichavant
Seebs wrote: So, I'm new to Python, though I've got a bit of experience in a few other languages. My overall impressions are pretty mixed, but overall positive; it's a reasonably expressive language which has a good mix between staying out of my way and taking care of stuff I don't want to waste

Re: if the else short form

2010-10-13 Thread John Nagle
On 10/10/2010 6:46 PM, Lawrence D'Oliveiro wrote: Languages that insisted on being able to do proper compiler-level cross checks between separately-compiled modules (e.g. Modula-2, Ada) never really became that popular. This saddened me. It's an sad consequence of a UNIX mindset that "you c

Re: My first Python program

2010-10-13 Thread Ethan Furman
Seebs wrote: On 2010-10-12, Hallvard B Furuseth wrote: > self.type, self.name = None, None Actually you can write self.type = self.name = None, though assignment statements are more limited than in C. (And I think they're assigned left-to-right.) Python 2.5.4 (r254:67916, Dec 23 2008, 15:

Re: how do I search python mailing list archives?

2010-10-13 Thread Daniel Fetchinson
> What are the various ways to search the python mailing list archives? If you are searching for 'foo' and 'bar' you can try this in google: foo bar site:mail.python.org inurl:python-list Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.or

Re: My first Python program

2010-10-13 Thread Chris Rebert
On Wed, Oct 13, 2010 at 9:56 AM, Seebs wrote: > On 2010-10-12, MRAB wrote: >> Line 51 > >> The __init__ method should always return None. There's no need to be >> explicit about it, just use a plain "return". > > The real issue here is that I was assuming that open('nonexistent') returned > None

Re: Difficulty in easy_install

2010-10-13 Thread John Nagle
On 10/11/2010 1:45 AM, sankalp srivastava wrote: I am having difficulty in easy_installing I use a proxy server and strange errors , like it can't fetch the package is showing up . the package is pyspeech ...please help me :( I don't know if the proxy server is causing the problems , in linux

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread John Nagle
On 10/12/2010 6:01 PM, Lawrence D'Oliveiro wrote: In message<4cb4ba4e$0$1641$742ec...@news.sonic.net>, John Nagle wrote: In general, if you find yourself making millions of SQL database requests in a loop, you're doing it wrong. I’ve done this. Not millions, but certainly on the order of tens

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Hallvard B Furuseth wrote: >> list = map(lambda x: x.call(), self.args) >> return ', '.join(list) > > return ', '.join([x.call() for x in self.args]) I think I wrote that before I found out about list comprehensions. How new are list comprehensions? I do like that, it's clearer

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, MRAB wrote: > The code does require Python 2 and the use of except ... as ... requires > at least version 2.6. Whoops. > Line 51 > The __init__ method should always return None. There's no need to be > explicit about it, just use a plain "return". The real issue here is that I

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Chris Rebert wrote: > 2. > self.f = file(path, 'r') > if not self.f: > return None > > The "if" here is pointless; I'm reasonably sure files are always > considered boolean true. I actually seem to have done this wrong anyway -- I was thinking in terms of the C-like idiom of re

Re: My first Python program

2010-10-13 Thread Seebs
On 2010-10-12, Jonas H. wrote: > Just a few pointers, looks quite good to me for a newbie :) Thanks! > * Less action in __init__. I'm a bit curious about this. The __init__ functions in this are, at least for now, pretty much doing only what's needed to create the objects from their inputs. >

how do I search python mailing list archives?

2010-10-13 Thread Sean Choi
What are the various ways to search the python mailing list archives? -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Pascal J. Bourguignon
Steven D'Aprano writes: > Hmmm, my ISP's news software really doesn't like it when I cross-post to > more than three newsgroups. So, trying again without comp.lang.c. > > On Wed, 13 Oct 2010 02:00:46 +0100, BartC wrote: > >> "RG" wrote in message >> news:rnospamon-20651e.17410012102...@news.alba

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Keith Thompson
RG writes: > In article <8hl2ucfdv...@mid.individual.net>, > Gregory Ewing wrote: >> Tim Bradshaw wrote: >> > In general any function >> > which raises its argument to more than one power ... doesn't make >> > much sense if its argument has units. >> >> That's not true. Consider the distance

Re: Compiling as 32bit on MacOSX

2010-10-13 Thread Philip Semanchuk
On Oct 13, 2010, at 3:54 AM, Gregory Ewing wrote: > Philip Semanchuk wrote: > >> Hi Greg, >> Are you talking about compiling Python itself or extensions? > > I've managed to get Python itself compiled as 32 bit, > and that also seems to take care of extensions built > using 'python setup.py ...

Re: Using csv.DictReader with \r\n in the middle of fields

2010-10-13 Thread Neil Cerutti
On 2010-10-13, pstatham wrote: > Hopefully this will interest some, I have a csv file (can be > downloaded from http://www.paulstathamphotography.co.uk/45.txt) which > has five fields separated by ~ delimiters. To read this I've been > using a csv.DictReader which works in 99% of the cases. Occasi

Re: Tkinter: Exception RuntimeError: 'maximum recursion depth exceeded'

2010-10-13 Thread Jeff Hobbs
On Oct 13, 2:18 am, o...@dtrx.de (Olaf Dietrich) wrote: > Jeff  Hobbs : > > > > > > > On Oct 12, 9:43 am, o...@dtrx.de (Olaf Dietrich) wrote: > > >> After some somewhat heavy mouse action inside the > >> canvas (with the left button pressed), the application throws: > > >> | Exception RuntimeError:

Re: "Strong typing vs. strong testing"

2010-10-13 Thread Steve Schafer
On Wed, 13 Oct 2010 06:05:27 -0500, r...@rpw3.org (Rob Warnock) wrote: >Why should it?!? If you look way under the covers, I suspect that even >the "c^2" in "E = mc^2" is a "collected" term in the above sense [that is, >if I recall my classes in introductory special relativity correctly]. In spec

Re: send command to parent shell

2010-10-13 Thread Nobody
On Wed, 13 Oct 2010 06:30:15 -0700, Martin Landa wrote: > is there a way how to send command from python script to the shell > (known id) from which the python script has been called? For Unix, this should work, but in general it's the wrong thing to do: import os import signal

Re: "Strong typing vs. strong testing" [OT]

2010-10-13 Thread Antoon Pardon
On Wed, Oct 13, 2010 at 01:20:30PM +, Steven D'Aprano wrote: > On Tue, 12 Oct 2010 22:13:26 -0700, RG wrote: > > >> The formula: circumference = 2 x pi x radius is taught in primary > >> schools, yet it's actually a very difficult formula to prove! > > > > What's to prove? That's the definit

  1   2   >