Re: newbie question

2011-04-01 Thread Wayne Brehaut
On Fri, 1 Apr 2011 21:52:24 +0200, Karl <8213543ggxnvjx...@kabelmail.de> wrote: >Hello, > >one beginner question: > >aList = [0, 1, 2, 3, 4] >bList = [2*i for i in aList] >sum = 0 >for j in bList: > sum = sum + bList[j] >print j > >0 >2 >4 >IndexError: 'list index out of range' >Why is j

Re: Deep vs. shallow copy?

2014-03-12 Thread Wayne Brehaut
On 12 Mar 2014 15:29:59 GMT, Alex van der Spek wrote: >On Wed, 12 Mar 2014 10:00:09 -0500, Zachary Ware wrote: > >> On Wed, Mar 12, 2014 at 9:25 AM, Alex van der Spek >> wrote: === 8< === >Having been taught programming in Algol60 Python still defeats me at times! >Particularly since Algol60 w

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On Jul 9, 11:42?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: >> On Jul 9, 11:21 pm, "Jim Langston" <[EMAIL PROTECTED]> wrote:> In Python 2.5 >> on intel, the statement >> > 2**2**2**2**2 >> > evaluates to>>> 2**2**

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 18:49:06 +0200, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >Wildemar Wildenburger wrote: >> x = [1, 2, 3] >> y = [1, 2, 3] >> id(x), id(y) >> x == y >> x is y >> >Ooops! > >Make that: > >x = [1, 2, 3] >y = [1, 2, 3] >id(x); id(y) >x == y >x is y > >(had to be a semicol

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Wed, 11 Jul 2007 21:37:00 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Evan Klitzke" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >| On 7/11/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >| > Just for curiosity: This helps to find the answer to the problem "Which >is

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 11:30:16 -0700, Paul McGuire <[EMAIL PROTECTED]> wrote: >On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" >> >> >> >> >> >> <[EMAIL PRO

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Wayne Brehaut
On Sat, 14 Jul 2007 06:01:56 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Chris Carlen a écrit : >> Hi: >> >> From what I've read of OOP, I don't get it. I have also found some >> articles profoundly critical of OOP. I tend to relate to these articles. >> === 8< === >> >> Hence,

Re: A Python newbie ask a simple question

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 14:51:52 -0400, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: >The raw_input built-in returns a string. The '[0]' subscript returns >the first character in the user supplied response as strings support >indexing. > >[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin >Type "hel

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wayne Brehaut
On Sat, 14 Jul 2007 03:18:43 +0200, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >Wayne Brehaut wrote: >>> (had to be a semicolon there) >>> >> >> Not "had to be" since a discerning reader will note that the two >> values in

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread Wayne Brehaut
On Fri, 13 Jul 2007 20:37:04 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> Chris Carlen <[EMAIL PROTECTED]> wrote: >>>From what I've read of OOP, I don't get it. >> >> For that matter, even using OOP a bit with C++ and Perl, I didn't get it >

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread Wayne Brehaut
On Sat, 14 Jul 2007 19:18:05 +0530, "Rustom Mody" <[EMAIL PROTECTED]> wrote: >On 7/14/07, Alex Martelli <[EMAIL PROTECTED]> wrote: >> >> OOP can be abused (particularly with deep or intricate inheritance >> structures). But the base concept is simple and clear: you can bundle >> state and behavio

Re: Can a low-level programmer learn OOP?

2007-07-14 Thread Wayne Brehaut
On Sat, 14 Jul 2007 11:49:48 -0600, darren kirby <[EMAIL PROTECTED]> wrote: >quoth the Wayne Brehaut: > >> (I started with Royal McBee LGP 30 machine language (hex input) in >> 1958, and their ACT IV assembler later! Then FORTRAN IV in 1965. By >> 1967 I too was usin

Re: Can a low-level programmer learn OOP?

2007-07-15 Thread Wayne Brehaut
On Sun, 15 Jul 2007 07:47:20 -, [EMAIL PROTECTED] wrote: >On Jul 13, 3:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> On Sat, 14 Jul 2007 06:01:56 +0200, Bruno Desthuilliers >> >> <[EMAIL PROTECTED]> wrote: >> >Chris Carlen a écrit : >> >

Re: 2**2**2**2**2 wrong? Bug?

2007-07-15 Thread Wayne Brehaut
On Fri, 13 Jul 2007 14:27:13 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" >> >> >> >> >> >

Re: 2**2**2**2**2 wrong? Bug?

2007-07-15 Thread Wayne Brehaut
On Fri, 13 Jul 2007 14:32:03 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >On Jul 13, 2:52 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> On Fri, 13 Jul 2007 11:30:16 -0700, Paul McGuire <[EMAIL PROTECTED]> >> wrote: >> >> >>

Re: 2**2**2**2**2 wrong? Bug?

2007-07-15 Thread Wayne Brehaut
On Sun, 15 Jul 2007 17:37:13 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >Wayne Brehaut wrote: >> On Fri, 13 Jul 2007 14:32:03 -0700, "[EMAIL PROTECTED]" >[...] >> But I digress (but only because provoked!)... >> >>>> [for purposes of t

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Wayne Brehaut
On Mon, 16 Jul 2007 10:10:05 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Wayne Brehaut a écrit : >(snip) > > after Bruno made the >> claim: "OO is about machines - at least as conceveid by Alan Key, who >> invented the term and most of the concept.&q

Re: Can a low-level programmer learn OOP?

2007-07-16 Thread Wayne Brehaut
On Mon, 16 Jul 2007 09:55:35 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Wayne Brehaut a écrit : >> On Sat, 14 Jul 2007 06:01:56 +0200, Bruno Desthuilliers >> <[EMAIL PROTECTED]> wrote: >> >>> Chris Carlen a écrit : >>>> Hi: >

Re: 2**2**2**2**2 wrong? Bug?

2007-07-16 Thread Wayne Brehaut
On Mon, 16 Jul 2007 08:51:31 +0200, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > "Wayne Brehaut" <[EMAIL PROTECTED]> wrote: > >> On Sun, 15 Jul 2007 17:37:13 -0400, Steve Holden <[EMAIL PROTECTED]> >> wrote: >> >> >

Re: How to optimise this code?

2007-08-21 Thread Wayne Brehaut
On Tue, 21 Aug 2007 21:56:18 +0200, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >Christof Winter <[EMAIL PROTECTED]> writes: > >> To get rid of the if statements, replace __init__ function with: >> >> def __init__(self, tc): >> functionToCall = eval("self.testCase%s" % tc) > >Or functio

Re: readline() - problem

2007-10-02 Thread Wayne Brehaut
On Tue, 02 Oct 2007 12:13:21 -, [EMAIL PROTECTED] wrote: >On 2 Pa , 13:39, Ben Finney <[EMAIL PROTECTED]> >wrote: >> [EMAIL PROTECTED] writes: >> > import string >> >> Why import 'string' if you're not using it? >> >> > f=open('/test/test.asc','r') >> > o=open('/test/out.asc','w') >> > for lin

Re: Python Magazine: Issue 1 Free!

2007-10-05 Thread Wayne Brehaut
On Thu, 04 Oct 2007 04:12:04 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >J. Clifford Dyer a écrit : >> On Fri, Oct 05, 2007 at 04:11:07PM -, Grant Edwards wrote >> regarding Re: Python Magazine: Issue 1 Free!: >> >>> On 2007-10-05, Steve Holden <[EMAIL PROTECTED]> wrote: >>> >

Re: Python Magazine: Issue 1 Free!

2007-10-05 Thread Wayne Brehaut
On Thu, 04 Oct 2007 04:52:13 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Wayne Brehaut a écrit : >> On Thu, 04 Oct 2007 04:12:04 +0200, Bruno Desthuilliers >> <[EMAIL PROTECTED]> wrote: >> >> >>>J. Clifford Dyer a écrit : >(snip)

Re: linear programming in Python

2007-10-17 Thread Wayne Brehaut
Hi Jorge, On Wed, 17 Oct 2007 08:44:28 -0700, [EMAIL PROTECTED] wrote: >Hi all, > >I'm new to this group so I don't know if this question has been posted >before, but does anyone knows about linear/integer programming >routines in Python that are available on the web, more specifically of >the br

Re: LaTeX tutorial updated [OT]

2007-11-07 Thread Wayne Brehaut
On Wed, 07 Nov 2007 09:00:12 -0800, John DeRosa <[EMAIL PROTECTED]> wrote: >On Wed, 07 Nov 2007 16:23:56 +0900, Byung-Hee HWANG <[EMAIL PROTECTED]> >wrote: > >>On Wed, 2007-11-07 at 00:10 +, [EMAIL PROTECTED] wrote: >>> On Nov 6, 12:30 pm, Nicola Talbot <[EMAIL PROTECTED]> wrote: >>> > Hi, >>>

Re: Questions on Using Python to Teach Data Structures and Algorithms

2007-11-07 Thread Wayne Brehaut
On Thu, 28 Sep 2006 17:23:25 +0200, "Ramon Diaz-Uriarte" <[EMAIL PROTECTED]> wrote: >Going back to the original question, a related question: does anybody >know why there are so few books on data structures and algorithms that >use Python? > >I remember that, at least ~ 12 years ago there were man

Re: Questions on Using Python to Teach Data Structures and Algorithms

2007-11-07 Thread Wayne Brehaut
On Thu, 28 Sep 2006 17:32:06 +0200, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >Ramon Diaz-Uriarte wrote: > >> Going back to the original question, a related question: does anybody >> know why there are so few books on data structures and algorithms that >> use Python? > >Probably because Python has

Re: eof

2007-11-21 Thread Wayne Brehaut
Hi braver, On Wed, 21 Nov 2007 15:17:14 -0800 (PST), braver <[EMAIL PROTECTED]> wrote: >I'd like to check, for a filehandle f, that EOF has been reached on >it. What's the way to do it? I don't want to try/except on EOF, I >want to check, after I read a line, that now we're in the EOF state. I

Re: eof

2007-11-21 Thread Wayne Brehaut
On Wed, 21 Nov 2007 17:06:15 -0800 (PST), braver <[EMAIL PROTECTED]> wrote: >On Nov 22, 3:41 am, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> If you have PythonWin 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 >> 32 bit (Intel)] on win32.for example, using He

Re: JESUS in the QURAN

2007-12-10 Thread Wayne Brehaut
On Mon, 10 Dec 2007 11:20:49 -0800 (PST), aassime abdellatif <[EMAIL PROTECTED]> wrote: > 'And they devised, and God >devised, and God devised, and God is the best of divisors. Obvious, since God is One, and so He divides 1, and 0, and -1, and all integers both positive and negative (Peace Be Up

Re: J in the Q

2007-12-10 Thread Wayne Brehaut
On Mon, 10 Dec 2007 21:41:56 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Wayne Brehaut a écrit : >(snip spam) >> Obvious, since God is One, and so He divides 1, and 0, and -1, and all >> integers both positive and negative (Peace Be Upon Them). >> >

Re: Update of Gnuplot.py

2008-01-09 Thread Wayne Brehaut
On Wed, 9 Jan 2008 03:43:38 -0800 (PST), Tom La Bone <[EMAIL PROTECTED]> wrote: > >Can someone suggest where to get a version of Gnuplot.py (for Windows) that >has been updated to use numpy? Or, is there another interface available to >use GnuPlot from Python? > >Thanks. > >Tom Gnuplot 1.7 uses

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Wayne Brehaut
On Sat, 7 Nov 2009 19:34:47 +0100, Andre Engels wrote: >On Sat, Nov 7, 2009 at 6:40 PM, Mensanator wrote: > >>> Tongue in cheek solution: >>> >>> import urllib2 >>> >>> url = 'http://primes.utm.edu/lists/small/1.txt' >>> primes = [] >>> for line in urllib2.urlopen(url).read().splitlines(): >

Re: Tutorials on Jinja

2009-06-25 Thread Wayne Brehaut
On Wed, 24 Jun 2009 11:46:55 -0700 (PDT), Saurabh wrote: >Hi All, > >I am trying to move my application on a MVC architecture and plan to >use Jinja for the same. Can anyone provide me with few quick links >that might help me to get started with Jinja? Perhaps the most useful link is: http://ww

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On Wed, 15 Jul 2009 13:37:22 +0200, Christian Heimes wrote: >pdpi wrote: >> On Jul 15, 12:08 am, Christian Heimes wrote: >>> Chris Rebert wrote: Using the xor bitwise operator is also an option: bool(x) ^ bool(y) >>> I prefer something like: >>> >>> bool(a) + bool(b) == 1 >>> >>> I

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson wrote: >On Jul 14, 7:25 pm, "Dr. Phillip M. Feldman" >wrote: >> Current Boolean operators are 'and', 'or', and 'not'.  It would be nice to >> have an 'xor' operator as well. > >Hmm. I don't think 'nice' is sufficient. You'd need to make

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On Wed, 15 Jul 2009 11:51:44 -0700 (PDT), Mark Dickinson wrote: >On Jul 15, 7:29 pm, Wayne Brehaut wrote: >> On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson >> wrote: >> >I'd also guess that 'xor' would be much less used than 'and' o

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On Tue, 14 Jul 2009 11:47:41 -0700 (PDT), Mark Dickinson wrote: >On Jul 14, 7:25 pm, "Dr. Phillip M. Feldman" >wrote: >> Current Boolean operators are 'and', 'or', and 'not'.  It would be nice to >> have an 'xor' operator as well. > >Hmm. I don't think 'nice' is sufficient. You'd need to make

Re: missing 'xor' Boolean operator

2009-07-15 Thread Wayne Brehaut
On 15 Jul 2009 09:11:44 GMT, Steven D'Aprano wrote: >On Tue, 14 Jul 2009 11:25:08 -0700, Dr. Phillip M. Feldman wrote: > >> Current Boolean operators are 'and', 'or', and 'not'. It would be nice >> to have an 'xor' operator as well. > >I've often wished there was too, for the sake of completenes

Re: analysis of algoritms

2010-09-09 Thread Wayne Brehaut
On Thu, 09 Sep 2010 18:26:52 -0400, Dave Angel wrote: > On 2:59 PM, Baba wrote: >> Hi >> >> In below code "the outer loop test in step 4 will execute ( n + 1 ) >> times (note that an extra step is required to terminate the for loop, >> hence n + 1 and not n executions), which will consume T4( n

Re: Nautilus Python

2010-09-27 Thread Wayne Brehaut
On Mon, 27 Sep 2010 20:57:09 -0700 (PDT), Peter wrote: >On Sep 28, 12:31 pm, Steven D'Aprano t...@cybersource.com.au> wrote: >> On Mon, 27 Sep 2010 15:28:34 -0700, Eduardo Ribeiro wrote: >> > But it doesn't work. >> >> What do you mean "doesn't work"? >> >> - It crashes the operating system; >> -

Re: Introducing Kids to Programming: 2 or 3?

2010-09-28 Thread Wayne Brehaut
On Mon, 27 Sep 2010 12:45:44 -0400, Andreas Waldenburger wrote: >On Mon, 27 Sep 2010 17:48:06 +0200 Marco Gallotta > wrote: > >> Since these are kids, we feel the nice changes in 3 such as removing >> integer division will help in teaching. It will also remove confusion >> when they go to downloa