Re: Python is readable

2012-03-22 Thread MRAB
On 23/03/2012 04:16, Steve Howell wrote: On Mar 22, 8:20 pm, rusi wrote: On Mar 23, 7:42 am, Steve Howell wrote: > Do you think we'll always have a huge number of incompatible > programming languages? I agree with you that it's a fact of life in > 2012, but will it be a fact of life i

Re: Python is readable

2012-03-22 Thread Nathan Rice
>> Do you think we'll always have a huge number of incompatible >> programming languages?  I agree with you that it's a fact of life in >> 2012, but will it be a fact of life in 2062? > > It will be a fact of life wherever Godels theorem is; which put > simplistically is: consistency and completene

Re: Python is readable

2012-03-22 Thread Steve Howell
On Mar 22, 8:20 pm, rusi wrote: > On Mar 23, 7:42 am, Steve Howell wrote: > > > Do you think we'll always have a huge number of incompatible > > programming languages?  I agree with you that it's a fact of life in > > 2012, but will it be a fact of life in 2062? > > It will be a fact of life wher

Re: Python is readable

2012-03-22 Thread rusi
On Mar 23, 7:42 am, Steve Howell wrote: > Do you think we'll always have a huge number of incompatible > programming languages?  I agree with you that it's a fact of life in > 2012, but will it be a fact of life in 2062? It will be a fact of life wherever Godels theorem is; which put simplistica

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-22 Thread Steve Howell
On Mar 22, 12:14 pm, Chris Angelico wrote: > On Fri, Mar 23, 2012 at 4:44 AM, Steven D'Aprano > > wrote: > > The typical developer knows three, maybe four languages > > moderately well, if you include SQL and regexes as languages, and might > > have a nodding acquaintance with one or two more. >

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-22 Thread Steve Howell
On Mar 22, 6:11 pm, Steven D'Aprano wrote: > On Fri, 23 Mar 2012 06:14:46 +1100, Chris Angelico wrote: > > In any case, though, I agree that there's a lot of people professionally > > writing code who would know about the 3-4 that you say. I'm just not > > sure that they're any good at coding, eve

Re: Python is readable

2012-03-22 Thread Steve Howell
On Mar 22, 10:44 am, Steven D'Aprano wrote: > On Thu, 22 Mar 2012 10:29:48 -0400, Nathan Rice wrote: > > Or at least before *I* black out. Even if somebody manages to write your > meta-language, you're going to run into the problem of who is going to be > able to use it. The typical developer know

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2012 06:14:46 +1100, Chris Angelico wrote: > On Fri, Mar 23, 2012 at 4:44 AM, Steven D'Aprano > wrote: >> The typical developer knows three, maybe four languages moderately >> well, if you include SQL and regexes as languages, and might have a >> nodding acquaintance with one or tw

Re: Best way to disconnect from ldap?

2012-03-22 Thread Tycho Andersen
On Thu, Mar 22, 2012 at 05:26:11PM +, Steven D'Aprano wrote: > On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote: > > > I've had similar experiences. In fact, in light of all this - why does > > __del__ exist at all? Novice python users may (reasonably) assume it > > behaves similarly t

Re: Odd strip behavior

2012-03-22 Thread Ian Kelly
On Thu, Mar 22, 2012 at 1:48 PM, Rodrick Brown wrote: > Why wasnt the t removed ? Because str.strip() only removes leading or trailing characters. If you want to remove all the t's, use str.replace: 'this is a test'.replace('t', '') Cheers, Ian -- http://mail.python.org/mailman/listinfo/pytho

Re: Odd strip behavior

2012-03-22 Thread Arnaud Delobelle
On 22 March 2012 20:04, Rodrick Brown wrote: > > On Mar 22, 2012, at 3:53 PM, Arnaud Delobelle wrote: > Try help(ste.strip) > > It clearly states "if chars is given and not None, remove characters in > chars instead. > > Does it mean remove only the first occurrence of char? That's the behavior >

Re: Odd strip behavior

2012-03-22 Thread Rodrick Brown
On Mar 22, 2012, at 3:53 PM, Arnaud Delobelle wrote: > > On Mar 22, 2012 7:49 PM, "Rodrick Brown" wrote: > > > > #!/usr/bin/python > > > > def main(): > > > >str1='this is a test' > >str2='t' > > > >print "".join([ c for c in str1 if c not in str2 ]) > >print(str1.strip(str2))

Re: Odd strip behavior

2012-03-22 Thread Daniel Steinberg
strip() removes leading and trailing characters, which is why the 't' in the middle of the string was not removed. To remove the 't' in the middle, str1.replace('t','') is one option. On 3/22/12 3:48 PM, Rodrick Brown wrote: #!/usr/bin/python def main(): str1='this is a test' str2=

Re: Odd strip behavior

2012-03-22 Thread Kiuhnm
On 3/22/2012 20:48, Rodrick Brown wrote: #!/usr/bin/python def main(): str1='this is a test' str2='t' print "".join([ c for c in str1 if c not in str2 ]) print(str1.strip(str2)) if __name__ == '__main__': main() ./remove_str.py his is a es his is a tes Why wasnt the

RE: Odd strip behavior

2012-03-22 Thread Prasad, Ramit
> str1='this is a test' > str2='t' > > print "".join([ c for c in str1 if c not in str2 ]) > print(str1.strip(str2)) > > if __name__ == '__main__': > main() > > ./remove_str.py > his is a es > his is a tes > > Why wasnt the t removed ? This is not odd behavior, you just do

Re: Odd strip behavior

2012-03-22 Thread Arnaud Delobelle
On Mar 22, 2012 7:49 PM, "Rodrick Brown" wrote: > > #!/usr/bin/python > > def main(): > >str1='this is a test' >str2='t' > >print "".join([ c for c in str1 if c not in str2 ]) >print(str1.strip(str2)) > > if __name__ == '__main__': >main() > > ./remove_str.py > his is a es > hi

Re: Python is readable

2012-03-22 Thread Chris Angelico
On Fri, Mar 23, 2012 at 6:33 AM, Nathan Rice wrote: > Pipes do not provide any fine grained control over the concurrent > behavior.  If you want to change the order of calls... And to clarify: The "order of calls" in what I described is merely the order of initialization. It's like the order of y

Odd strip behavior

2012-03-22 Thread Rodrick Brown
#!/usr/bin/python def main(): str1='this is a test' str2='t' print "".join([ c for c in str1 if c not in str2 ]) print(str1.strip(str2)) if __name__ == '__main__': main() ./remove_str.py his is a es his is a tes Why wasnt the t removed ? Sent from my iPhone -- http:/

Re: Python is readable

2012-03-22 Thread Chris Angelico
On Fri, Mar 23, 2012 at 6:33 AM, Nathan Rice wrote: > Pipes do not provide any fine grained control over the concurrent > behavior.  If you want to change the order of calls, suddenly you have > to write a bash script (with its own set of issues), etc. Go back to my original post. I posited a mea

Re: Python is readable

2012-03-22 Thread Nathan Rice
>> For example, your ability to reason about the behavior of the system >> you posited as a whole is limited.  Are there parts of the different >> modules that can execute concurrently?  Is the output of module1 >> guaranteed to be acceptable as the input for module2?  Is part of >> module3 redunda

Re: Best way to disconnect from ldap?

2012-03-22 Thread Terry Reedy
On 3/22/2012 1:54 PM, Tim Chase wrote: On 03/22/12 12:26, Steven D'Aprano wrote: On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote: Given that you can't trust __del__, is there a legitimate use case for it? It is part of original or early Python and pretty well superceded by cyclic gc

Re: Python is readable

2012-03-22 Thread Chris Angelico
On Fri, Mar 23, 2012 at 1:29 AM, Nathan Rice wrote: > For example, your ability to reason about the behavior of the system > you posited as a whole is limited.  Are there parts of the different > modules that can execute concurrently?  Is the output of module1 > guaranteed to be acceptable as the

Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-22 Thread Chris Angelico
On Fri, Mar 23, 2012 at 4:44 AM, Steven D'Aprano wrote: > The typical developer knows three, maybe four languages > moderately well, if you include SQL and regexes as languages, and might > have a nodding acquaintance with one or two more. I'm not entirely sure what you mean by "moderately well",

Re: Python is readable

2012-03-22 Thread Chris Angelico
On Fri, Mar 23, 2012 at 5:26 AM, Nathan Rice wrote: [regarding Python 2 -> 3] > The extremely slow uptake?  I don't really care one way or another but > a lot of the devs have lamented the issue. By your plan, the slow uptake would be accepted, even encouraged. In fact, your plan is effectively e

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-22 Thread Ralph Heinkel
> > See "Compiling 64-bit extension modules on Windows" at > . It applies to > non-Cython extensions as well. > > MinGW-w64 also works, but you'll have to generate and use libpythonXX.a and > libmsvcr90.a link libraries. > > Christoph Th

Re: Python is readable

2012-03-22 Thread Nathan Rice
>> There is a concept in statistical/mathematical modeling called minimum >> message length (a close analog is minimum description length), which >> asserts that the optimum model for some set of information is the one >> that minimizes the sum of the length of the model and the length of the >> se

Re: Python classes: Simplify?

2012-03-22 Thread J. Cliff Dyer
The issue of explicitly naming a "self" parameter has been discussed in depth on a number of occasions. I recommend a google search for "python implicit self" for some of the reasons why it exists. Here's what Guido has to say about it: http://neopythonic.blogspot.com/2008/10/why-explicit-self-h

Re: Best way to disconnect from ldap?

2012-03-22 Thread Tim Chase
On 03/22/12 12:26, Steven D'Aprano wrote: On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote: Given that you can't trust __del__, is there a legitimate use case for it? I've never found the need to write one. I've found the need to write them...then been frustrated by things falling o

Re: Python is readable

2012-03-22 Thread Steven D'Aprano
On Thu, 22 Mar 2012 10:29:48 -0400, Nathan Rice wrote: [Snip a load of stuff about the laws of physics, infinity, and of course fractals.] I'm just surprised you didn't manage to fit quantum mechanics and "the interconnectedness of all things" into it :) > TL;DR there are a huge number of inc

Re: Best way to disconnect from ldap?

2012-03-22 Thread Steven D'Aprano
On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote: > I've had similar experiences. In fact, in light of all this - why does > __del__ exist at all? Novice python users may (reasonably) assume it > behaves similarly to a C++ destructor (even though the docs warn > otherwise). What makes you

Re: Python is readable

2012-03-22 Thread Steven D'Aprano
On Thu, 22 Mar 2012 08:47:15 -0400, Nathan Rice wrote: > There is a concept in statistical/mathematical modeling called minimum > message length (a close analog is minimum description length), which > asserts that the optimum model for some set of information is the one > that minimizes the sum of

ANN: Leo 4.10 b1 released

2012-03-22 Thread Edward K. Ream
Leo 4.10 b1 is now available at: http://sourceforge.net/projects/leo/files/ Leo is a text editor, data organizer, project manager and much more. http://webpages.charter.net/edreamleo/intro.html Leo 4.10 contains 9 months of intense work on Leo. Several very important features are subtle; you coul

Re: Python is readable

2012-03-22 Thread Steve Howell
On Mar 22, 7:29 am, Nathan Rice wrote: > On Thu, Mar 22, 2012 at 9:17 AM, Chris Angelico wrote: > > On Thu, Mar 22, 2012 at 11:47 PM, Nathan Rice > > wrote: > >> Having one core language with > >> many DSLs that can interoperate is infinitely better than having many > >> languages that cannot.  

Re: Python is readable

2012-03-22 Thread Steve Howell
On Mar 22, 1:56 am, Steven D'Aprano wrote: > On Wed, 21 Mar 2012 18:35:16 -0700, Steve Howell wrote: > > On Mar 21, 11:06 am, Nathan Rice > > wrote: > >> As for syntax, we have a lot of "real" domain specific languages, such > >> as English, math and logic. They are vetted, understood and useful

RE: urllib.urlretrieve never returns???

2012-03-22 Thread Prasad, Ramit
> > I just looked at your source file on ActiveState and noticed that > > you do not import traceback. That is why you are getting the > > AttributeError. Now you should be getting a much better error > > once you import it:) > Nope. That would result in a NameError. After adding "import traceback"

Condition in C API

2012-03-22 Thread Matt Joiner
Is there a Condition-like object exposed in the CPython C API? I've found PyThread_lock_type, but nothing condition-like. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-22 Thread Nathan Rice
On Thu, Mar 22, 2012 at 9:17 AM, Chris Angelico wrote: > On Thu, Mar 22, 2012 at 11:47 PM, Nathan Rice > wrote: >> Having one core language with >> many DSLs that can interoperate is infinitely better than having many >> languages that cannot.  A language designed in such a way would also >> prev

Re: Best way to disconnect from ldap?

2012-03-22 Thread Tycho Andersen
On Thu, Mar 22, 2012 at 06:27:45AM -0700, Chris Rebert wrote: > On Thu, Mar 22, 2012 at 6:14 AM, Tycho Andersen wrote: > > On Wed, Mar 21, 2012 at 04:49:54PM -0500, Tim Chase wrote: > >> On 03/21/12 15:54, Chris Kaynor wrote: > >> >As Chris Rebert pointed out, there is no guarantee as to when the

Re: Best way to disconnect from ldap?

2012-03-22 Thread Chris Rebert
On Thu, Mar 22, 2012 at 6:14 AM, Tycho Andersen wrote: > On Wed, Mar 21, 2012 at 04:49:54PM -0500, Tim Chase wrote: >> On 03/21/12 15:54, Chris Kaynor wrote: >> >As Chris Rebert pointed out, there is no guarantee as to when the >> >__del__ method is called. CPython will generally call it immediate

Re: Python classes: Simplify?

2012-03-22 Thread Andrea Crotti
On 03/22/2012 10:51 AM, Steven Lehar wrote: It seems to me that the Python class system is needlessly confusing. Am I missing something? For example in the class Complex given in the documentation *class Complex:* *def __init__(self, realpart, imagpart):* *self.r = realpart* *

Re: Python is readable

2012-03-22 Thread Chris Angelico
On Thu, Mar 22, 2012 at 11:47 PM, Nathan Rice wrote: > Having one core language with > many DSLs that can interoperate is infinitely better than having many > languages that cannot.  A language designed in such a way would also > prevent issues like the Python 2 -> 3 fiasco, because two versions o

Re: Best way to disconnect from ldap?

2012-03-22 Thread Tycho Andersen
On Wed, Mar 21, 2012 at 04:49:54PM -0500, Tim Chase wrote: > On 03/21/12 15:54, Chris Kaynor wrote: > >As Chris Rebert pointed out, there is no guarantee as to when the > >__del__ method is called. CPython will generally call it immediately, > >however if there are reference cycles it may never cal

Re: Accessing the files by last modified time

2012-03-22 Thread Neil Cerutti
On 2012-03-22, Tim Williams wrote: > On Mar 22, 7:33?am, Sangeet wrote: >> Hi >> >> I am new to the python programming language. >> >> I've been trying to write a script that would access the last >> modified file in one of my directories. I'm using Win XP. >> >> I saw a similar topic, on the for

Re: Python is readable

2012-03-22 Thread Nathan Rice
>> If I'm reading you correctly, you're expressing frustration with the >> state of language syntax unification in 2012. You mention language in a >> broad sense (not just programming languages, but also English, math, >> logic, etc.), but even in the narrow context of programming languages, >> th

Re: Accessing the files by last modified time

2012-03-22 Thread Peter Otten
Sangeet wrote: > I've been trying to write a script that would access the last modified > file in one of my directories. I'm using Win XP. import os import glob path = r"c:\one\of\my directories\*" youngest_file = max(glob.glob(path), key=os.path.getmtime) -- http://mail.python.org/mailman/li

Re: Accessing the files by last modified time

2012-03-22 Thread Tim Williams
On Mar 22, 7:33 am, Sangeet wrote: > Hi > > I am new to the python programming language. > > I've been trying to write a script that would access the last modified file > in one of my directories. I'm using Win XP. > > I saw a similar topic, on the forum before, however the reply using > (os.pop

Re: Accessing the files by last modified time

2012-03-22 Thread Chris Rebert
On Thu, Mar 22, 2012 at 4:33 AM, Sangeet wrote: > Hi > > I am new to the python programming language. > > I've been trying to write a script that would access the last modified file > in one of my directories. I'm using Win XP. > > I saw a similar topic, on the forum before, however the reply usi

Re: Python is readable (OT)

2012-03-22 Thread Jon Clements
On Thursday, 22 March 2012 08:56:17 UTC, Steven D'Aprano wrote: > On Wed, 21 Mar 2012 18:35:16 -0700, Steve Howell wrote: > > > On Mar 21, 11:06 am, Nathan Rice > > wrote: [snip]. > > Different programming languages are good for different things because > they have been designed to work in dif

Re: Python classes: Simplify?

2012-03-22 Thread Chris Rebert
On Thu, Mar 22, 2012 at 3:51 AM, Steven Lehar wrote: > It seems to me that the Python class system is needlessly confusing. Am I > missing something? Explicit `self` is slightly annoying, but you'll get over it quickly (trust me). > For example in the class Complex given in the documentation > >

Re: Python classes: Simplify?

2012-03-22 Thread Chris Angelico
On Thu, Mar 22, 2012 at 9:51 PM, Steven Lehar wrote: > It seems to me that the Python class system is needlessly confusing. Am I > missing something? > > For example in the class Complex given in the documentation > > class Complex: >     def __init__(self, realpart, imagpart): >         self.r =

Python classes: Simplify?

2012-03-22 Thread Steven Lehar
It seems to me that the Python class system is needlessly confusing. Am I missing something? For example in the class Complex given in the documentation *class Complex:* *def __init__(self, realpart, imagpart):* *self.r = realpart* *self.i = imagpart* * * *x = Complex(3.0, -4.

Re: Python is readable

2012-03-22 Thread Steven D'Aprano
On Wed, 21 Mar 2012 18:35:16 -0700, Steve Howell wrote: > On Mar 21, 11:06 am, Nathan Rice > wrote: >> As for syntax, we have a lot of "real" domain specific languages, such >> as English, math and logic. They are vetted, understood and useful >> outside the context of programming.  We should app

Re: Compiling Python (modules) on 64bit Windows - which compiler suite?

2012-03-22 Thread Stefan Behnel
Thomas Bach, 21.03.2012 20:03: > Ralph Heinkel writes: >> when processing our mass spectrometry data we are running against the >> 2GB memory limit on our 32 bit machines. So we are planning to move to >> 64bit. Downloading and installing the 64bit version of Python for >> Windows is trivial, but h