Re: Arrange files according to a text file

2011-08-27 Thread Ric
No, it turned out to be my mistake. Your code was correct and I appreciate it very much. Thank you again On Sat, 27 Aug 2011 18:10:07 -0700, Emile van Sebille wrote: >On 8/27/2011 4:18 PM r...@rdo.python.org said... >> Thank you so much. The code worked perfectly. >> >> This is what I tried us

Re: Understanding .pth in site-packages

2011-08-27 Thread OKB (not okblacke)
Josh English wrote: > OKB, > > The setup.py script created the egg, but not the .pth file. I > created that myself. > > Thank you for clarifying about how .pth works. I know "redirect > imports" was the wrong phrase, but it worked in my head at the > time. It appears, at least on my system, tha

Re: Why do closures do this?

2011-08-27 Thread John O'Hagan
On Sun, 28 Aug 2011 00:19:07 -0400 Terry Reedy wrote: > On 8/27/2011 11:45 PM, John O'Hagan wrote: > > Somewhat apropos of the recent "function principle" thread, I was recently > > surprised by this: > > > > funcs=[] > > for n in range(3): > > def f(): > > return n > > funcs.

Re: is there any principle when writing python function

2011-08-27 Thread harrismh777
smith jack wrote: i have heard that function invocation in python is expensive, but make lots of functions are a good design habit in many other languages, so is there any principle when writing python function? for example, how many lines should form a function? Once Abraham Lincoln was asked

Re: Why do closures do this?

2011-08-27 Thread Terry Reedy
On 8/27/2011 11:45 PM, John O'Hagan wrote: Somewhat apropos of the recent "function principle" thread, I was recently surprised by this: funcs=[] for n in range(3): def f(): return n funcs.append(f) The last expression, IMO surprisingly, is [2,2,2], not [0,1,2]. Google tel

Why do closures do this?

2011-08-27 Thread John O'Hagan
Somewhat apropos of the recent "function principle" thread, I was recently surprised by this: funcs=[] for n in range(3): def f(): return n funcs.append(f) [i() for i in funcs] The last expression, IMO surprisingly, is [2,2,2], not [0,1,2]. Google tells me I'm not the only one

Re: Understanding .pth in site-packages

2011-08-27 Thread Philip Semanchuk
On Aug 27, 2011, at 6:49 PM, Josh English wrote: > When I run: os.listdir('c:\Python27\lib\site-packages') I get the contents in > order, so the folders come before .pth files (as nothing comes before > something.) That's one definition of "in order". =) > I would guess Python is using os.li

Re: Custom dict to prevent keys from being overridden

2011-08-27 Thread Steven D'Aprano
Julien wrote: > What I'd like to achieve is: > d = { > ... 'a': 1, > ... 'b': 2, > ... 'a': 3 > ... } > Error: The key 'a' already exists. > > Is that possible, and if so, how? Not if the requirements including using built-in dicts { }. But if you are happy enough to use a custom cl

Custom dict to prevent keys from being overridden

2011-08-27 Thread Julien
Hi, With a simple dict, the following happens: >>> d = { ... 'a': 1, ... 'b': 2, ... 'a': 3 ... } >>> d {'a': 3, 'b': 2} ... i.e. the value for the 'a' key gets overridden. What I'd like to achieve is: >>> d = { ... 'a': 1, ... 'b': 2, ... 'a': 3 ... } Error: The key 'a' already ex

Re: Record seperator

2011-08-27 Thread Dan Stromberg
http://stromberg.dnsalias.org/svn/bufsock/trunk does it. $ cat double-file daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh root:x:0:0:root:/roo

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 4:18 PM r...@rdo.python.org said... Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too mu

Re: Record seperator

2011-08-27 Thread Terry Reedy
On 8/27/2011 5:07 PM, Roy Smith wrote: In article, Terry Reedy wrote: On 8/27/2011 1:45 PM, Roy Smith wrote: In article<4e592852$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: open("file.txt") # opens the file .read() # reads the contents of the fi

packaging a python application

2011-08-27 Thread suresh
Hi I created a python application which consists of multiple python files and a configuration file. I am not sure, how can I distribute it. I read distutils2 documentation and a few blogs on python packaging. But I still have the following questions. 1. My package has a configuration file whic

Re: Arrange files according to a text file

2011-08-27 Thread Ric
On Sun, 28 Aug 2011 00:48:20 +0100, MRAB wrote: >On 28/08/2011 00:18, r...@rdo.python.org wrote: >> Thank you so much. The code worked perfectly. >> >> This is what I tried using Emile code. The only time when it picked >> wrong name from the list was when the file was named like this. >> >> Data

Re: Arrange files according to a text file

2011-08-27 Thread MRAB
On 28/08/2011 00:18, r...@rdo.python.org wrote: Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too muc

Re: Understanding .pth in site-packages

2011-08-27 Thread Stephen Hansen
On 8/27/11 3:41 PM, Josh English wrote: > I have .egg files in my system path. The Egg file created by my setup script > doesn't include anything but the introductory text. If I open other eggs I > see the zipped data, but not for my own files. Sounds like your setup.py isn't actually including

Re: Arrange files according to a text file

2011-08-27 Thread Stephen Hansen
On 8/27/11 11:06 AM, Emile van Sebille wrote: > from difflib import SequenceMatcher as SM > > def ignore(x): > return x in ' ,.' > > for filename in filenames: > ratios = [SM(ignore,filename,username).ratio() for username in > usernames] > best = max(ratios) > owner = usernames[ra

Re: is there any principle when writing python function

2011-08-27 Thread Stephen Hansen
On 8/27/11 3:21 PM, Emile van Sebille wrote: > On 8/27/2011 2:57 PM Ben Finney said... >> Emile van Sebille writes: >> >>> Code is first and foremost written to be executed. >> > > >> “Programs must be written for people to read, and only >> incidentally for >> machines to execute.” >>

Re: Arrange files according to a text file

2011-08-27 Thread Ric
Thank you so much. The code worked perfectly. This is what I tried using Emile code. The only time when it picked wrong name from the list was when the file was named like this. Data Mark Stone.doc How can I fix this? Hope I am not asking too much? import os from difflib import SequenceMatche

Re: is there any principle when writing python function

2011-08-27 Thread Roy Smith
In article , Emile van Sebille wrote: > code that doesn't execute will need to be read to be understood, and > to be fixed so that it does run. That is certainly true, but it's not the whole story. Even code that works perfectly today will need to be modified in the future. Business requir

Re: is there any principle when writing python function

2011-08-27 Thread rantingrick
On Aug 27, 5:21 pm, Emile van Sebille wrote: > On 8/27/2011 2:57 PM Ben Finney said... > > > Emile van Sebille  writes: > > >> Code is first and foremost written to be executed. > > >      “Programs must be written for people to read, and only incidentally for > >      machines to execute.” > >  

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
OKB, The setup.py script created the egg, but not the .pth file. I created that myself. Thank you for clarifying about how .pth works. I know "redirect imports" was the wrong phrase, but it worked in my head at the time. It appears, at least on my system, that Python will find site-packages/fo

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
When I run: os.listdir('c:\Python27\lib\site-packages') I get the contents in order, so the folders come before .pth files (as nothing comes before something.) I would guess Python is using os.listdir. Why wouldn't it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
I have .egg files in my system path. The Egg file created by my setup script doesn't include anything but the introductory text. If I open other eggs I see the zipped data, but not for my own files. Is having a zipped egg file any faster than a regular package? or does it just prevent people fr

Re: is there any principle when writing python function

2011-08-27 Thread Emile van Sebille
On 8/27/2011 2:57 PM Ben Finney said... Emile van Sebille writes: Code is first and foremost written to be executed. “Programs must be written for people to read, and only incidentally for machines to execute.” —Abelson& Sussman, _Structure and Interpretation of Computer

Re: is there any principle when writing python function

2011-08-27 Thread Ben Finney
Emile van Sebille writes: > Code is first and foremost written to be executed. −1 QotW. I disagree, and have a counter-aphorism: “Programs must be written for people to read, and only incidentally for machines to execute.” —Abelson & Sussman, _Structure and Interpretation of Compute

Re: UnicodeEncodeError -- 'character maps to '

2011-08-27 Thread Ben Finney
Steven D'Aprano writes: > >>> s = u'BIEBER FEVER \u2665' > >>> print s # Printing Unicode is fine. > BIEBER FEVER ♥ You're a cruel man. Why do you hate me? -- \ “If nature has made any one thing less susceptible than all | `\others of exclusive property, it is the action of the

Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams
On 27-Aug-11 11:53 AM, Hans Mulder wrote: On 27/08/11 17:16:51, Colin J. Williams wrote: What about: cond= isinstance(left, PyCompare) and isinstance(right, PyCompare) and left.complist[-1] is right.complist[0] py_and= PyCompare(left.complist + right.complist[1:])if cond else: py_and = PyBoolea

Re: is there any principle when writing python function

2011-08-27 Thread Roy Smith
In article <4e595334$0$3$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > and then there are languages with few, or no, design principles to speak of Oh, like PHP? -- http://mail.python.org/mailman/listinfo/python-list

Re: Record seperator

2011-08-27 Thread Roy Smith
In article , Terry Reedy wrote: > On 8/27/2011 1:45 PM, Roy Smith wrote: > > In article<4e592852$0$29965$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: > > > >> open("file.txt") # opens the file > >> .read() # reads the contents of the file > >> .split("\n\n")

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 1:15 PM r...@rdo.python.org said... Hello Emile , Thank you for the code below as I have not encountered SequenceMatcher before and would have to take a look at it closer. My question would it work for a text file list of names about 25k lines and a directory with say 100 files in

Re: is there any principle when writing python function

2011-08-27 Thread Chris Angelico
On Sun, Aug 28, 2011 at 6:27 AM, Steven D'Aprano wrote: > You've never noticed the masses of code written in text books, blogs, web > pages, discussion forums like this one, etc.? > > Real world code for production is usually messy and complicated and filled > with data validation and error checki

Re: is there any principle when writing python function

2011-08-27 Thread Steven D'Aprano
Chris Angelico wrote: > On Sun, Aug 28, 2011 at 3:27 AM, Emile van Sebille wrote: >> Code is first and foremost written to be executed. >> > > +1 QOTW. Yes, it'll be read, and most likely read several times, by > humans, but ultimately its purpose is to be executed. You've never noticed the mas

Re: Understanding .pth in site-packages

2011-08-27 Thread Philip Semanchuk
On Aug 27, 2011, at 4:14 PM, Terry Reedy wrote: > On 8/27/2011 2:07 PM, Philip Semanchuk wrote: >> >> On Aug 27, 2011, at 1:57 PM, Josh English wrote: >> >>> Philip, >>> >>> Yes, the proper path should be c:\dev\XmlDB, which has the >>> setup.py, xmldb subfolder, the docs subfolder, and exampl

Re: Understanding .pth in site-packages

2011-08-27 Thread Terry Reedy
On 8/27/2011 2:07 PM, Philip Semanchuk wrote: On Aug 27, 2011, at 1:57 PM, Josh English wrote: Philip, Yes, the proper path should be c:\dev\XmlDB, which has the setup.py, xmldb subfolder, the docs subfolder, and example subfolder, and the other text files proscribed by the package developmen

Re: Arrange files according to a text file

2011-08-27 Thread Ric
Hello Emile , Thank you for the code below as I have not encountered SequenceMatcher before and would have to take a look at it closer. My question would it work for a text file list of names about 25k lines and a directory with say 100 files inside? Thank you once again. On Sat, 27 Aug 2011

Re: typing question

2011-08-27 Thread Terry Reedy
On 8/27/2011 9:42 AM, Jason Swails wrote: P.S. I'll note that my "preferred" behavior is how python3.2 actually operates Python core developers agree. This is one of the reasons for breaking a bit from 2.x to make Python 3. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/py

Re: Record seperator

2011-08-27 Thread Chris Angelico
On Sun, Aug 28, 2011 at 6:03 AM, Terry Reedy wrote: >      yield para # or ''.join(para), as desired > Or possibly '\n'.join(para) if you want to keep the line breaks inside paragraphs. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Record seperator

2011-08-27 Thread Terry Reedy
On 8/27/2011 1:45 PM, Roy Smith wrote: In article<4e592852$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: open("file.txt") # opens the file .read() # reads the contents of the file .split("\n\n")# splits the text on double-newlines. The biggest prob

Re: Understanding .pth in site-packages

2011-08-27 Thread OKB (not okblacke)
Josh English wrote: > Philip, > > Yes, the proper path should be c:\dev\XmlDB, which has the > setup.py, xmldb subfolder, the docs subfolder, and example > subfolder, and the other text files proscribed by the package > development folder. > > I could only get it to work, though, by renaming th

How can I solve a equation like solve a function containint expressions like sqrt(log(x) - 1) = 2 and exp((log(x) - 1.5)**2 - 3) = 5

2011-08-27 Thread Xiong Deng
HI, Hi, I am trying to solve an equation containing both exp, log, erfc, and they may be embedded into each otherBut sympy cannot handle this, as shown below: >>> from sympy import solve, exp, log, pi >>>from sympy.mpmath import * >>>from sympy import Symbol >>>x=Symbol('x') >>>sigma = 4 >>>m

Re: Run time default arguments

2011-08-27 Thread Stephen Hansen
On 8/25/11 1:54 PM, t...@thsu.org wrote: > On Aug 25, 10:35 am, Arnaud Delobelle wrote: >> You're close to the usual idiom: >> >> def doSomething(debug=None): >> if debug is None: >> debug = defaults['debug'] >> ... >> >> Note the use of 'is' rather than '==' >> HTH > > Hmm, from

Re: Record seperator

2011-08-27 Thread ChasBrown
On Aug 27, 10:45 am, Roy Smith wrote: > In article <4e592852$0$29965$c3e8da3$54964...@news.astraweb.com>, >  Steven D'Aprano wrote: > > > open("file.txt")   # opens the file > >  .read()           # reads the contents of the file > >  .split("\n\n")    # splits the text on double-newlines. > > Th

Re: Understanding .pth in site-packages

2011-08-27 Thread Philip Semanchuk
On Aug 27, 2011, at 1:57 PM, Josh English wrote: > Philip, > > Yes, the proper path should be c:\dev\XmlDB, which has the setup.py, xmldb > subfolder, the docs subfolder, and example subfolder, and the other text > files proscribed by the package development folder. > > I could only get it to

Re: Arrange files according to a text file

2011-08-27 Thread Emile van Sebille
On 8/27/2011 10:03 AM r...@rdo.python.org said... Hello, What would be the best way to accomplish this task? I'd do something like: usernames = """Adler, Jack Smith, John Smith, Sally Stone, Mark""".split('\n') filenames = """Smith, John - 02-15-75 - business files.doc Random Data - Adler J

Re: Understanding .pth in site-packages

2011-08-27 Thread Josh English
Philip, Yes, the proper path should be c:\dev\XmlDB, which has the setup.py, xmldb subfolder, the docs subfolder, and example subfolder, and the other text files proscribed by the package development folder. I could only get it to work, though, by renaming the xmldb folder in the site-packages

Re: Record seperator

2011-08-27 Thread Roy Smith
In article <4e592852$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > open("file.txt") # opens the file > .read() # reads the contents of the file > .split("\n\n")# splits the text on double-newlines. The biggest problem with this code is that read() slurp

Re: typing question

2011-08-27 Thread Chris Rebert
On Sat, Aug 27, 2011 at 6:42 AM, Jason Swails wrote: > Hello everyone, > > This is probably a basic question with an obvious answer, but I don't quite > get why the type(foo).__name__ works differently for some class instances > and not for others.  If I have an "underived" class, any instance of

Re: Understanding .pth in site-packages

2011-08-27 Thread Peter Otten
Josh English wrote: > I have a development version of a library in c:\dev\XmlDB\xmldb > > After testing the setup script I also have > c:\python27\lib\site-packages\xmldb > > Now I'm continuing to develop it and simultaneously building an > application with it. > > I thought I could plug into m

Re: is there any principle when writing python function

2011-08-27 Thread Chris Angelico
On Sun, Aug 28, 2011 at 3:27 AM, Emile van Sebille wrote: > Code is first and foremost written to be executed. > +1 QOTW. Yes, it'll be read, and most likely read several times, by humans, but ultimately its purpose is to be executed. And in the case of some code, the programmer needs the same t

Re: Record seperator

2011-08-27 Thread Steven D'Aprano
greymaus wrote: > On 2011-08-26, D'Arcy J.M. Cain wrote: >> On 26 Aug 2011 18:39:07 GMT >> greymaus wrote: >>> >>> Is there an equivelent for the AWK RS in Python? >>> >>> >>> as in RS='\n\n' >>> will seperate a file at two blank line intervals >> >> open("file.txt").read().split("\n\n") >> >

Re: is there any principle when writing python function

2011-08-27 Thread Emile van Sebille
On 8/27/2011 9:41 AM Roy Smith said... Chris Angelico wrote: the important considerations are not "will it take two extra nanoseconds to execute" but "can my successor understand what the code's doing" and "will he, if he edits my code, have a reasonable expectation that he's not breaking stuf

Re: Arrange files according to a text file

2011-08-27 Thread MRAB
On 27/08/2011 18:03, r...@rdo.python.org wrote: Hello, What would be the best way to accomplish this task? I have many files in separate directories, each file name contain a persons name but never in the same spot. I need to find that name which is listed in a large text file in the following f

Re: Understanding .pth in site-packages

2011-08-27 Thread Philip Semanchuk
On Aug 27, 2011, at 12:56 PM, Josh English wrote: > (This may be a shortened double post) > > I have a development version of a library in c:\dev\XmlDB\xmldb > > After testing the setup script I also have c:\python27\lib\site-packages\xmldb > > Now I'm continuing to develop it and simultaneous

Arrange files according to a text file

2011-08-27 Thread Ric
Hello, What would be the best way to accomplish this task? I have many files in separate directories, each file name contain a persons name but never in the same spot. I need to find that name which is listed in a large text file in the following format. Last name, comma and First name. The last n

Understanding .pth in site-packages

2011-08-27 Thread Josh English
(This may be a shortened double post) I have a development version of a library in c:\dev\XmlDB\xmldb After testing the setup script I also have c:\python27\lib\site-packages\xmldb Now I'm continuing to develop it and simultaneously building an application with it. I thought I could plug into

Re: Record seperator

2011-08-27 Thread greymaus
On 2011-08-26, D'Arcy J.M. Cain wrote: > On 26 Aug 2011 18:39:07 GMT > greymaus wrote: >> >> Is there an equivelent for the AWK RS in Python? >> >> >> as in RS='\n\n' >> will seperate a file at two blank line intervals > > open("file.txt").read().split("\n\n") > Ta!.. bit awkard. :)) -

Re: is there any principle when writing python function

2011-08-27 Thread Chris Angelico
On Sun, Aug 28, 2011 at 2:41 AM, Roy Smith wrote: > Forget about your successor.  Will *you* be able to figure out what you > did 6 months from now?  I can't tell you how many times I've looked at > some piece of code, muttered, "Who wrote this crap?" and called up the > checkin history only to di

Understanding .pth files

2011-08-27 Thread Josh English
I am developing a library for Python 2.7. I'm on Windows XP. I am also learning the "proper" way to do this (per PyPi) but not in a linear fashion: I've built a prototype for the library, created my setup script, and run the install to make sure I had that bit working properly. Now I'm continu

Re: is there any principle when writing python function

2011-08-27 Thread Roy Smith
Chris Angelico wrote: > the important > considerations are not "will it take two extra nanoseconds to execute" > but "can my successor understand what the code's doing" and "will he, > if he edits my code, have a reasonable expectation that he's not > breaking stuff". These are always important.

Re: how to format long if conditions

2011-08-27 Thread Roy Smith
In article , Arnaud Delobelle wrote: > Hi all, > > I'm wondering what advice you have about formatting if statements with > long conditions (I always format my code to <80 colums) > [...] > if (isinstance(left, PyCompare) and isinstance(right, PyCompare) > and left.compl

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 17:16:51, Colin J. Williams wrote: What about: cond= isinstance(left, PyCompare) and isinstance(right, PyCompare) and left.complist[-1] is right.complist[0] py_and= PyCompare(left.complist + right.complist[1:])if cond else: py_and = PyBooleanAnd(left, right) Colin W

Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams
On 27-Aug-11 03:50 AM, Hans Mulder wrote: On 27/08/11 09:08:20, Arnaud Delobelle wrote: I'm wondering what advice you have about formatting if statements with long conditions (I always format my code to<80 colums) Here's an example taken from something I'm writing at the moment and how I've for

Re: UnicodeEncodeError -- 'character maps to '

2011-08-27 Thread Steven D'Aprano
J wrote: > Hi there, > > I'm attempting to print a dictionary entry of some twitter data to screen > but every now and then I get the following error: > > (, UnicodeEncodeError('charmap', > u'RT @ciaraluvsjb26: BIEBER FEVER \u2665', 32, 33, 'character maps to > '), ) Showing the actual tracebac

UnicodeEncodeError -- 'character maps to '

2011-08-27 Thread J
Hi there, I'm attempting to print a dictionary entry of some twitter data to screen but every now and then I get the following error: (, UnicodeEncodeError('charmap', u'RT @ciaraluvsjb26: BIEBER FEVER \u2665', 32, 33, 'character maps to '), ) I have googled this but haven't really found any w

Re: typing question

2011-08-27 Thread Chris Angelico
On Sat, Aug 27, 2011 at 11:42 PM, Jason Swails wrote: > I can't explain this behavior (since doesn't every class inherit from object > by default? And if so, there should be no difference between any of my class > definitions). That is true in Python 3, but not in Python 2. That's why your exampl

typing question

2011-08-27 Thread Jason Swails
Hello everyone, This is probably a basic question with an obvious answer, but I don't quite get why the type(foo).__name__ works differently for some class instances and not for others. If I have an "underived" class, any instance of that class is simply of type "instance". If I include an expli

[ANN] Oktest 0.9.0 released - a new-style testing library

2011-08-27 Thread Makoto Kuwata
Hi, I released Oktest 0.9.0. http://pypi.python.org/pypi/Oktest/ http://packages.python.org/Oktest/ Oktest is a new-style testing library for Python. :: from oktest import ok, NG ok (x) > 0 # same as assert_(x > 0) ok (s) == 'foo'# same as assertEqual(s, '

Re: how to format long if conditions

2011-08-27 Thread Ben Finney
Steven D'Aprano writes: > I believe that PEP 8 now Specifically the “Indentation” section contains:: When using a hanging indent the following considerations should be applied; there should be no arguments on the first line and further indentation should be used to clearly distingui

Re: Run time default arguments

2011-08-27 Thread Carl Banks
On Thursday, August 25, 2011 1:54:35 PM UTC-7, ti...@thsu.org wrote: > On Aug 25, 10:35 am, Arnaud Delobelle wrote: > > You're close to the usual idiom: > > > > def doSomething(debug=None): > >     if debug is None: > >         debug = defaults['debug'] > >     ... > > > > Note the use of 'is' rat

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 11:05:25, Steven D'Aprano wrote: Hans Mulder wrote: [...] It may look ugly, but it's very clear where the condition part ends and the 'then' part begins. Immediately after the colon, surely? On the next line, actually :-) The point is, that this layout makes it very clear that

Re: how to format long if conditions

2011-08-27 Thread Arnaud Delobelle
On 27 August 2011 08:24, Steven D'Aprano wrote: > Arnaud Delobelle wrote: > >> Hi all, >> >> I'm wondering what advice you have about formatting if statements with >> long conditions (I always format my code to <80 colums) >> >> Here's an example taken from something I'm writing at the moment and

Re: Catch and name an exception in Python 2.5 +

2011-08-27 Thread Thomas Jollans
On 27/08/11 05:45, Steven D'Aprano wrote: > Thomas Jollans wrote: > >> On 26/08/11 21:56, Steven D'Aprano wrote: > >>> Is there any way to catch an exception and bind it to a name which will >>> work across all Python versions from 2.5 onwards? >>> >>> I'm pretty sure there isn't, but I thought I

Re: how to format long if conditions

2011-08-27 Thread Steven D'Aprano
Hans Mulder wrote: [...] > It may look ugly, but it's very clear where the condition part ends > and the 'then' part begins. Immediately after the colon, surely? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE/Eclipse

2011-08-27 Thread UncleLaz
On Aug 26, 5:18 pm, Dave Boland wrote: > I'm looking for a good IDE -- easy to setup, easy to use -- for Python. >   Any suggestions? > > I use Eclipse for other projects and have no problem with using it for > Python, except that I can't get PyDev to install.  It takes forever, > then produces an

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 09:08:20, Arnaud Delobelle wrote: I'm wondering what advice you have about formatting if statements with long conditions (I always format my code to<80 colums) Here's an example taken from something I'm writing at the moment and how I've formatted it: if (isinstance(left,

Re: how to format long if conditions

2011-08-27 Thread Steven D'Aprano
Arnaud Delobelle wrote: > Hi all, > > I'm wondering what advice you have about formatting if statements with > long conditions (I always format my code to <80 colums) > > Here's an example taken from something I'm writing at the moment and > how I've formatted it: > > > if (isinstance(

how to format long if conditions

2011-08-27 Thread Arnaud Delobelle
Hi all, I'm wondering what advice you have about formatting if statements with long conditions (I always format my code to <80 colums) Here's an example taken from something I'm writing at the moment and how I've formatted it: if (isinstance(left, PyCompare) and isinstance(right, PyComp

Re: The RAISE_VARARGS opcode in Python 3

2011-08-27 Thread Arnaud Delobelle
On 27 August 2011 07:49, Peter Otten <__pete...@web.de> wrote: > Arnaud Delobelle wrote: > >> Here is an extract from the dis module doc [1] >> >> """ >> RAISE_VARARGS(argc) >> Raises an exception. argc indicates the number of parameters to the >> raise statement, ranging from 0 to 3. The handler w

comp.lang.python is a high-volume Usenet open (not moderated) newsgroup for general discussions and questions about Python. You can also access it as a ...

2011-08-27 Thread shenba valli
comp.lang.python · Discussions · + new post · About this group · Subscribe to this group. This is a Usenet group - learn more. View this group in the new Google ... http://123maza.com/65/purple505/ -- http://mail.python.org/mailman/listinfo/python-list