Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno giovedì 22 novembre 2012 05:00:39 UTC+1, MRAB ha scritto: > On 2012-11-22 03:41, Terry Reedy wrote: > It can't return 5 because 5 isn't an index in 'spam'. > > > > It can't return 4 because 4 is below the start index. Uhm. Maybe you are right, because returning a greater value would c

Re: Suitable software stacks for simple python web service

2012-11-21 Thread Kev Dwyer
Steve Petrie wrote: > On Wednesday, November 21, 2012 2:32:40 AM UTC-5, Kev Dwyer wrote: >> Hello List, >> >> >> >> I have to build a simple web service which will: >> >> >> >> - receive queries from our other servers >> >> - forward the requests to a third party SOAP service >> >> - pr

Re: Suitable software stacks for simple python web service

2012-11-21 Thread Dieter Maurer
Kev Dwyer writes: > I have to build a simple web service which will: > > - receive queries from our other servers > - forward the requests to a third party SOAP service > - process the response from the third party > - send the result back to the original requester > > From the point of view

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Modulok
> On Wed, Nov 21, 2012 at 10:43 PM, Steven D'Aprano > wrote: >> On Wed, 21 Nov 2012 22:21:23 +1100, Chris Angelico wrote: >> >>> Counting complexity by giving a score to every statement encourages code >>> like this: >>> >>> def bletch(x,y): >>> return x + {"foo":y*2,"bar":x*3+y,"quux":math.sin(

Re: re.search when used within an if/else fails

2012-11-21 Thread Chris Angelico
On Thu, Nov 22, 2012 at 3:41 AM, Kevin T wrote: > I went back and tried version a again, blam it is/does work now ?!?!? > I am not sure what changed but version a was the original code that > wouldn't work. All the examples i had read, showed version a as a > working version. I spent significant

Re: Yet another Python textbook

2012-11-21 Thread Terry Reedy
On 11/21/2012 6:21 PM, Joshua Landau wrote: Since we've decided to derail the conversation... "{}".format() is a blessing an "" % () should go. "%" has no relevance to strings, is hard to "get" and has an appalling* syntax. Having two syntaxes just makes things less obvious, and the right choic

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-22 03:41, Terry Reedy wrote: On 11/21/2012 8:32 AM, MRAB wrote: On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: >>> 'spam'.find('') 0 >>> 'spam'.find('', 1) 1 >>> 'spam'.find('', 4) 4 'spam'.find('', 5) -1 Now, reading find's documentation: print(s

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Terry Reedy
On 11/21/2012 8:32 AM, MRAB wrote: On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: >>> 'spam'.find('') 0 >>> 'spam'.find('', 1) 1 >>> 'spam'.find('', 4) 4 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -

Re: Yet another Python textbook

2012-11-21 Thread Pavel Solin
Hi Alec, > Can you put your website—http://femhub.com/textbook-python/—on your > github—https://github.com/femhub/nclab-textbook-python? Done, thank you so much. I edited the textbook based on responses that I received. Based on several inquiries we also decided to add Python 3.2 to NCLab. New r

Re: Building python, bz2 coming up missing

2012-11-21 Thread Dan Stromberg
On Wed, Nov 21, 2012 at 12:18 PM, Dan Stromberg wrote: > > I'm attempting to build cpython 2.{5,6,7} and cpython 3.[0,1,2,3}. I find > that having them all around facilitates interversion testing and > discovering what works in which versions. > > Anyway, in 3.3, I'm getting a bz2 module, but in

Re: Yet another Python textbook

2012-11-21 Thread Ian Kelly
On Wed, Nov 21, 2012 at 4:21 PM, Joshua Landau wrote: > "{}".format() is a blessing an "" % () should go. "%" has no relevance to > strings, is hard to "get" and has an appalling* syntax. Having two syntaxes > just makes things less obvious, and the right choice rarer. > > str.format is also reall

Re: Yet another Python textbook

2012-11-21 Thread Mark Lawrence
On 21/11/2012 23:21, Joshua Landau wrote: On 21 November 2012 22:17, Chris Angelico wrote: On Thu, Nov 22, 2012 at 4:03 AM, Colin J. Williams wrote: On 20/11/2012 4:00 PM, Chris Angelico wrote: To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393 strings. Take no notice; the res

Re: Yet another Python textbook

2012-11-21 Thread Steven D'Aprano
On Wed, 21 Nov 2012 12:03:30 -0500, Colin J. Williams wrote: > On 20/11/2012 4:00 PM, Chris Angelico wrote: >> To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393 >> strings. Take no notice; the rest of the world sees this as a huge >> advantage. Python is now in a VERY small group o

Re: Yet another Python textbook

2012-11-21 Thread Joshua Landau
On 21 November 2012 22:17, Chris Angelico wrote: > On Thu, Nov 22, 2012 at 4:03 AM, Colin J. Williams wrote: > > On 20/11/2012 4:00 PM, Chris Angelico wrote: > >> To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393 > >> strings. Take no notice; the rest of the world sees this as a h

Re: Yet another Python textbook

2012-11-21 Thread Ian Kelly
On Wed, Nov 21, 2012 at 3:58 PM, Dave Angel wrote: > Some don't realize that one very powerful use for the .format style of > working is that it makes localization much more straightforward. With > the curly brace approach, one can translate the format string into > another language, and if the p

Re: Yet another Python textbook

2012-11-21 Thread Dave Angel
On 11/21/2012 05:17 PM, Chris Angelico wrote: > > > > That said, though, I'm just glad that %-formatting is staying. It's an > extremely expressive string formatting method, and exists in many > languages (thanks to C's heritage). Pike's version is insanely > powerful, Python's is more like C's, b

Re: 10 sec poll - please reply!

2012-11-21 Thread Andrew Cooper
On 21/11/2012 07:01, Steven D'Aprano wrote: > On Wed, 21 Nov 2012 17:35:27 +1100, Chris Angelico wrote: > >> And yet, trivial though it may seem, function naming in a permanent API >> is pretty important. Threads like this can be the difference between >> coherent and useful APIs and veritable pil

Re: Yet another Python textbook

2012-11-21 Thread Chris Angelico
On Thu, Nov 22, 2012 at 4:03 AM, Colin J. Williams wrote: > On 20/11/2012 4:00 PM, Chris Angelico wrote: >> To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393 >> strings. Take no notice; the rest of the world sees this as a huge >> advantage. Python is now in a VERY small group of la

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Chris Angelico
On Wed, Nov 21, 2012 at 10:43 PM, Steven D'Aprano wrote: > On Wed, 21 Nov 2012 22:21:23 +1100, Chris Angelico wrote: > >> Counting complexity by giving a score to every statement encourages code >> like this: >> >> def bletch(x,y): >> return x + {"foo":y*2,"bar":x*3+y,"quux":math.sin(y)}.get(mod

Re: Problem with subprocess.call and windows schtasks

2012-11-21 Thread Tom Borkin
On Wed, Nov 21, 2012 at 6:01 AM, Tim Golden wrote: > subprocess.call([ > 'SchTasks', '/Create', > '/SC', 'ONCE', > '/TN', 'test', > '/TR', path, > '/ST', '23:50' > ]) > Thank you. Yes, it was the quoting of "test". Oops :-} Thanks again, Tom -- http://mail.python.org/mailman/listinfo/p

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Joshua Landau
On 21 November 2012 20:58, MRAB wrote: > On 2012-11-21 19:25, Hans Mulder wrote: > >> On 21/11/12 17:59:05, Alister wrote: >> >>> On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: 'spam'.find('', 5) >>> >> -1 Now, reading find's documentation: pr

Re: windows question: default click action points to wrong python version

2012-11-21 Thread Tim Golden
On 21/11/2012 20:53, Tony the Tiger wrote: On Wed, 21 Nov 2012 09:23:00 +0100, Gelonida N wrote: What am I missing? The PATH environment variable? Nope. PATH doesn't affect either double-clicking or running a .py file on the command line (unless, obviously, you run it by typing "python my

Re: logger doesn't roll over

2012-11-21 Thread Paul Rubin
cerr writes: > 2.2MB and should've rolled over after ever 1MB. > LOGFILE, maxBytes=(1048576*10), backupCount=5 1048576*10 is 10MB, not 1MB. -- http://mail.python.org/mailman/listinfo/python-list

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-21 19:25, Hans Mulder wrote: On 21/11/12 17:59:05, Alister wrote: On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return t

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
Il giorno mercoledì 21 novembre 2012 20:25:10 UTC+1, Hans Mulder ha scritto: > On 21/11/12 17:59:05, Alister wrote: > > > On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > > > > > >> I just came across this: > > >> > > > 'spam'.find('', 5) > > >> -1 > > >> > > >> > > >> Now

Building python, bz2 coming up missing

2012-11-21 Thread Dan Stromberg
I'm attempting to build cpython 2.{5,6,7} and cpython 3.[0,1,2,3}. I find that having them all around facilitates interversion testing and discovering what works in which versions. Anyway, in 3.3, I'm getting a bz2 module, but in 3.2, I'm not - but only when compiling on Linux Mint 14. On Linux

Re: logger doesn't roll over

2012-11-21 Thread Ron Eggler
Hooops sh*t! I outsmarted myself I guess... :o However, Thanks for the kick GC! Ron Eggler 1804 - 1122 Gilford St. Vancouver, BC V6G 2P5 (778) 230-9442 On 12-11-21 11:41 AM, Gary Chambers wrote: Ron, LOGFILE, maxBytes=(1048576*10), backupCount=5 What am I doing wrong here, I don't get it.

Re: logger doesn't roll over

2012-11-21 Thread Gary Chambers
Ron, LOGFILE, maxBytes=(1048576*10), backupCount=5 What am I doing wrong here, I don't get it. 10 * 1048576 = 10MB -- GC -- http://mail.python.org/mailman/listinfo/python-list

Re: mysql insert with tuple

2012-11-21 Thread Hans Mulder
On 21/11/12 18:19:15, Christian wrote: > Hi , > > my purpose is a generic insert via tuple , because the number of fields and > can differ. But I'm stucking . > > ilist=['hello',None,7,None,None] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(""" INSER

Re: mysql insert with tuple

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 9:19 AM, Christian wrote: > Hi , > > my purpose is a generic insert via tuple , because the number of fields and > can differ. But I'm stucking . > > ilist=['hello',None,7,None,None] > > #This version works, but all varchar fields are in extra '' enclosed. > con.execute(

logger doesn't roll over

2012-11-21 Thread cerr
Hi, I'm using Python's logger for logging but it doesn't seem to roll over, my file is now 2.2MB and should've rolled over after ever 1MB. My code: logger = logging.getLogger("") logger.setLevel(logging.DEBUG) handler = logging.handlers.RotatingFileHandler( LOGFILE

Re: windows question: default click action points to wrong python version

2012-11-21 Thread Gelonida N
Hi Tim, Thanks a lot for your answer. On 11/21/2012 10:34 AM, Tim Golden wrote: On 21/11/2012 08:23, Gelonida N wrote: Hi, I installed python 2.6 and python 2.7 on a windows 7 machine. At the moment Python 2.7 is the interpreter being used if I 'start' a python script without explicit inter

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Hans Mulder
On 21/11/12 17:59:05, Alister wrote: > On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > >> I just came across this: >> > 'spam'.find('', 5) >> -1 >> >> >> Now, reading find's documentation: >> > print(str.find.__doc__) >> S.find(sub [,start [,end]]) -> int >> >> Return the lowe

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 10:57 AM, rh wrote: > On Wed, 21 Nov 2012 10:12:26 -0800 > Chris Rebert wrote: >> On Wed, Nov 21, 2012 at 9:49 AM, rh >> wrote: >> > On Tue, 20 Nov 2012 20:41:42 +0300 >> > Andriy Kornatskyy wrote: >> > I'm looking at different technology right now on which to base a >>

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 7:48 AM, MRAB wrote: > On 2012-11-21 14:59, saikari78 wrote: >> >> Hi, >> >> I'm using the json module to create a JSON string, then inserting that >> string into a html template containing a javascript function (from the >> highcharts library: http://www.highcharts.com/)

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
Richard, Thank you for the comment. I have examined web frameworks for PEP8 and CC metrics already. Results are here: http://mindref.blogspot.com/2012/10/python-web-pep8-consistency.html http://mindref.blogspot.com/2012/11/python-web-excessive-complexity.html Same applies to performance benchm

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Chris Rebert
On Wed, Nov 21, 2012 at 9:49 AM, rh wrote: > On Tue, 20 Nov 2012 20:41:42 +0300 > Andriy Kornatskyy wrote: >> Cyclomatic (or conditional) complexity is a metric used to indicate >> the complexity of a source code. Excessive complexity is something >> that is beyond recommended level of 10 (thresh

Re: 10 sec poll - please reply!

2012-11-21 Thread Michael Herrmann
Dear all, thanks so much for your replies. Based on your inputs, we have started to experiment with changes to our API. I hope to be able to present the results to you tomorrow. Thanks again, Michael On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote: > Hi, > > > > I'm

mysql insert with tuple

2012-11-21 Thread Christian
Hi , my purpose is a generic insert via tuple , because the number of fields and can differ. But I'm stucking . ilist=['hello',None,7,None,None] #This version works, but all varchar fields are in extra '' enclosed. con.execute(""" INSERT INTO {} VALUES %r; """.format(table) , (tuple(ilist),))

Re: Yet another Python textbook

2012-11-21 Thread Colin J. Williams
On 20/11/2012 4:00 PM, Chris Angelico wrote: On Wed, Nov 21, 2012 at 1:57 AM, wrote: Le mardi 20 novembre 2012 09:09:50 UTC+1, Chris Angelico a écrit : On Tue, Nov 20, 2012 at 7:02 PM, Pavel Solin wrote: Perhaps you are right. Is there any statistics of how many Python programmers are u

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Alister
On Wed, 21 Nov 2012 04:43:57 -0800, Giacomo Alzetta wrote: > I just came across this: > 'spam'.find('', 5) > -1 > > > Now, reading find's documentation: > print(str.find.__doc__) > S.find(sub [,start [,end]]) -> int > > Return the lowest index in S where substring sub is found, > su

Re: re.search when used within an if/else fails

2012-11-21 Thread Kevin T
On Nov 20, 1:37 pm, Ian Kelly wrote: > On Tue, Nov 20, 2012 at 12:09 PM, Kevin T wrote: > > #if re.search( "rsrvd", sigName ) :   #version a > > #if re.search( "rsrvd", sigName ) == None :   #version b > > if re.search( "rsrvd", sigName ) is None :   #version bb > >    print sigName > >    newVal

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 16:27, MRAB wrote:> On 2012-11-21 16:04, hfo...@gmail.com wrote: >> On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: >>> On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a ht

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 16:04, hfo...@gmail.com wrote: On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a html template containing a javascript >>> function (from th

Re: Suitable software stacks for simple python web service

2012-11-21 Thread Steve Petrie
On Wednesday, November 21, 2012 2:32:40 AM UTC-5, Kev Dwyer wrote: > Hello List, > > > > I have to build a simple web service which will: > > > > - receive queries from our other servers > > - forward the requests to a third party SOAP service > > - process the response from the third pa

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread Grant Edwards
On 2012-11-21, MRAB wrote: >> However, I don't know how to do that because dictionary keys in >> python need to be strings. If I try to do the following, Python,of >> course, complains that y,color,drilldown, etc are not defined. > > Just quote them: > > data = [ { 'y':55.11, 'color':colors[0], '

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread hfolch
Thanks for your reply, but the javascript function expects option names to be unquoted, otherwise it won't work. On Wednesday, November 21, 2012 3:48:07 PM UTC, MRAB wrote: > On 2012-11-21 14:59, saikari78 wrote: > > > Hi, > > > > > > I'm using the json module to create a JSON string, then

Re: Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread MRAB
On 2012-11-21 14:59, saikari78 wrote: Hi, I'm using the json module to create a JSON string, then inserting that string into a html template containing a javascript function (from the highcharts library: http://www.highcharts.com/) The json string I'm trying to create is to initialize a data

Constructing JSON data structures from non-string key python dictionaries

2012-11-21 Thread saikari78
Hi, I'm using the json module to create a JSON string, then inserting that string into a html template containing a javascript function (from the highcharts library: http://www.highcharts.com/) The json string I'm trying to create is to initialize a data variable in the javascript function, th

Re: Yet another Python textbook

2012-11-21 Thread wxjmfauth
Le mardi 20 novembre 2012 22:00:49 UTC+1, Chris Angelico a écrit : > On Wed, Nov 21, 2012 at 1:57 AM, wrote: > - > To the OP: jmf has an unnatural hatred of Python 3.3 and PEP 393 > > strings. No. Not at all. I'm mainly and deeply disappointed. jmf -- http://mail.python.org/mailman/lis

Re: Index Error

2012-11-21 Thread inshu chauhan
I guess I have to use try and except as Chris suggested, this isn't working. -- http://mail.python.org/mailman/listinfo/python-list

Update slider widget range

2012-11-21 Thread moadeep
I am trying to write a small bit of code that interactively deletes selected slices in an image series using matplotlib. I have created a button 'delete' which stores a number of indices to be deleted when the button 'update' is selected. However, I am currently unable to reset the range of my s

Re: Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread MRAB
On 2012-11-21 12:43, Giacomo Alzetta wrote: I just came across this: 'spam'.find('', 5) -1 Now, reading find's documentation: print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:en

Re: Index Error

2012-11-21 Thread Dave Angel
> > > >> >> Back to an earlier comment. I asked if N was ever bigger than x or >> bigger than y, and you said never. But your ComputeClasses will have >> such a case the very first time around, when cx==0, cy==0, and >> ring_number == 1. >> > > I doubt this , M confused.. > I'll paste an e

Re: Index Error

2012-11-21 Thread Dave Angel
On 11/21/2012 05:11 AM, inshu chauhan wrote: >> >>> >> I must confess I have no idea what data represents. When you're doing >> rings, you use deltas on the cx and cy values. But when you're >> computing radius, you use the 3d coordinates returned by data[cx, cy]. >> So is data some kind

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 12:47, Andriy Kornatskyy wrote: Hm... what serves an evidence purpose for you? Well-done empirical studies, like the one I gave you. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to inte

Re: Encoding conundrum

2012-11-21 Thread Dave Angel
On 11/21/2012 06:24 AM, danielk wrote: > On Tuesday, November 20, 2012 6:03:47 PM UTC-5, Ian wrote: >>> >> >> In Linux, your terminal encoding is probably either UTF-8 or Latin-1, >> >> and either way it has no problems encoding that data for output. In a >> >> Windows cmd terminal, the default t

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
Hm... what serves an evidence purpose for you? See functions at line 2619 and 2974 as an example for CC 20+: https://github.com/defnull/bottle/blob/master/bottle.py Andriy > To: python-list@python.org > From: robert.k...@gmail.com > Subject: Re: Web Fra

Inconsistent behaviour os str.find/str.index when providing optional parameters

2012-11-21 Thread Giacomo Alzetta
I just came across this: >>> 'spam'.find('', 5) -1 Now, reading find's documentation: >>> print(str.find.__doc__) S.find(sub [,start [,end]]) -> int Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are

Re: 10 sec poll - please reply!

2012-11-21 Thread Hans Mulder
On 21/11/12 02:17:26, Steven D'Aprano wrote: > On Tue, 20 Nov 2012 18:00:59 -0600, Tim Chase wrote: > >> On 11/20/12 06:18, Michael Herrmann wrote: >>> am having difficulty picking a name for the function that simulates key >>> strokes. I currently have it as 'type' but that clashes with the >>> b

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 12:17, Andriy Kornatskyy wrote: Agreed. I think we have pretty much the same point of view on this. All these metrics advise you... this is again depends how you look at this. If you are a new comer to a project, you usually spend some time on code review, talk to people, read d

Re: Encoding conundrum

2012-11-21 Thread Nobody
On Wed, 21 Nov 2012 03:24:01 -0800, danielk wrote: >> >>> import sys >> >>> sys.stdout.encoding >> 'cp437' > > Hmmm. So THAT'S why I am only able to use 'cp437'. I had (mistakenly) > thought that I could just indicate whatever encoding I wanted, as long as > the codec supported it. sys.stdout.enc

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
Agreed. I think we have pretty much the same point of view on this. All these metrics advise you... this is again depends how you look at this. If you are a new comer to a project, you usually spend some time on code review, talk to people, read docs if any. The qa tools for static code analysi

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 11:02, Andriy Kornatskyy wrote: Robert, You would never get a better product by accident. The meaning of better product might differ from team to team but you can not ignore excessive complexity. Earlier or later you get back to that code and refactor it, thus existence of such

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
I believe for the quality of code you produce. Thanks. Andriy > From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: Web Frameworks Excessive Complexity > Date: Wed, 21 Nov 2012 11:43:10 + > To: python-list@python.org > > On Wed, 21 Nov 2012 22

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Robert Kern
On 21/11/2012 01:43, Steven D'Aprano wrote: On Tue, 20 Nov 2012 20:07:54 +, Robert Kern wrote: The source of bugs is not excessive complexity in a method, just excessive lines of code. Taken literally, that cannot possibly the case. def method(self, a, b, c): do_this(a) do_that

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
Chris, The focus of development team is controlled by setting a metric threshold or just excluding some. So you do not have an overhead for the development team from the point it set forward, assuming them team committed to adherence it. Your strategy for perfection may vary. You can start wit

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Steven D'Aprano
On Wed, 21 Nov 2012 22:21:23 +1100, Chris Angelico wrote: > Counting complexity by giving a score to every statement encourages code > like this: > > def bletch(x,y): > return x + {"foo":y*2,"bar":x*3+y,"quux":math.sin(y)}.get(mode,0) > > instead of: > > def bletch(x,y): > if mode=="foo": r

Re: Encoding conundrum

2012-11-21 Thread danielk
On Tuesday, November 20, 2012 6:03:47 PM UTC-5, Ian wrote: > On Tue, Nov 20, 2012 at 2:49 PM, Daniel Klein wrote: > > > With the assistance of this group I am understanding unicode encoding issues > > > much better; especially when handling special characters that are outside of > > > the ASCII

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
We choose Python for its readability. This is essential principal of language and thousands around reading the open source code. Things like PEP8, CC, LoC are all to serve you one purpose: bring your attention, teach you make your code better. Thanks. Andriy

RE: Web Frameworks Excessive Complexity

2012-11-21 Thread Andriy Kornatskyy
Robert, You would never get a better product by accident. The meaning of better product might differ from team to team but you can not ignore excessive complexity. Earlier or later you get back to that code and refactor it, thus existence of such fact was driven by your intention to make it a

Re: Index Error

2012-11-21 Thread inshu chauhan
> > > > def GenerateRing(x,y, N): Generates square rings around a point in data > which has 300 columns(x) and 3000 > > rows(y) > > indices = [] > > for i in xrange(-N, N): > > indices.append((x+i, y-N)) > > indices.append((x+N, y+i)) > > indices.append((x-i, y+N)) >

Re: Index Error

2012-11-21 Thread inshu chauhan
> > > > >> Yes i tried "or" also but no use . > > Explain "no use". If you mean you still fail, then what else did you > try? For example, did you try interchanging the two subscripts? I've > suspected all along that the meanings of row and column, x and y, [0] > and [1], height and width ar

Re: Problem with subprocess.call and windows schtasks

2012-11-21 Thread Tim Golden
On 20/11/2012 23:41, Tom Borkin wrote: > Using shlex, I now have this: > #!\Python27\python > import os, subprocess > path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2", > "htdocs", "ccc", "run_alert.py") > #subprocess.call(['SchTasks', '/Create', '/SC', 'ONCE', '/TN', '"test"',

Re: windows question: default click action points to wrong python version

2012-11-21 Thread Tim Golden
On 21/11/2012 08:23, Gelonida N wrote: > Hi, > > I installed python 2.6 and python 2.7 on a windows 7 machine. > > At the moment Python 2.7 is the interpreter being used if I 'start' a > python script without explicit interpreter. > > I always thought, that 'repairing' Python 2.6 (reinstalling i

Re: 10 sec poll - please reply!

2012-11-21 Thread markus . moldaschl
Am Dienstag, 20. November 2012 13:18:38 UTC+1 schrieb Michael Herrmann: > Hi, > > > > I'm developing a GUI Automation library (http://www.getautoma.com) and am > having difficulty picking a name for the function that simulates key strokes. > I currently have it as 'type' but that clashes with

Re: Web Frameworks Excessive Complexity

2012-11-21 Thread Ulrich Eckhardt
Am 21.11.2012 02:43, schrieb Steven D'Aprano: On Tue, 20 Nov 2012 20:07:54 +, Robert Kern wrote: The source of bugs is not excessive complexity in a method, just excessive lines of code. Taken literally, that cannot possibly the case. def method(self, a, b, c): do_this(a) do_tha

windows question: default click action points to wrong python version

2012-11-21 Thread Gelonida N
Hi, I installed python 2.6 and python 2.7 on a windows 7 machine. At the moment Python 2.7 is the interpreter being used if I 'start' a python script without explicit interpreter. I always thought, that 'repairing' Python 2.6 (reinstalling it) would set the default settings back to Python 2.