Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread Lie Ryan
On Thu, 29 Jan 2009 12:22:29 +, Alan Gauld wrote: > "spir" wrote > >> Here is an overal and a trial to introduce my view on this topic. > ... >> * The mix of "extended logic" on non-logical types and treating >> integers >>as bit sequences provakes a kind of conceptual collision. >> * As

Re: [Tutor] Properties of an object

2009-01-29 Thread Jervis Whitley
> > > > For me, the "()" look like artificial, not necessary. I would prefer just > to type"a.list_1stpart" , a property. > > > > -- > > Others have explained their preference for using get methods for accessing internal data structures, However it does look like you have specifically mention

Re: [Tutor] Properties of an object

2009-01-29 Thread Alan Gauld
"Vicent" wrote This is an easy question, I guess, but I am not able to find out the answer. Or in fact a series of not so easy questions! :-) Andre has already answered most of them but I'll add a few extras. (1) Where are the right places to define PROPERTIES for my class, and how (I mea

Re: [Tutor] Properties of an object

2009-01-29 Thread spir
Le Thu, 29 Jan 2009 19:59:09 +0100, Vicent a écrit : > This is an easy question, I guess, but I am not able to find out the answer. > > In fact, it is both a Python question and a general programming "style" > question. > > I want to define a class that contains a list (or a NumPy array) of ele

Re: [Tutor] Properties of an object

2009-01-29 Thread Andre Engels
On Thu, Jan 29, 2009 at 7:59 PM, Vicent wrote: > This is an easy question, I guess, but I am not able to find out the answer. > > In fact, it is both a Python question and a general programming "style" > question. > > I want to define a class that contains a list (or a NumPy array) of elements > o

[Tutor] Properties of an object

2009-01-29 Thread Vicent
This is an easy question, I guess, but I am not able to find out the answer. In fact, it is both a Python question and a general programming "style" question. I want to define a class that contains a list (or a NumPy array) of elements of a certain type, and an integer: class ExampleList : d

Re: [Tutor] Problem with nested for-in (Alan Gauld)

2009-01-29 Thread Kent Johnson
On Thu, Jan 29, 2009 at 12:21 PM, emmanuel.delaborde wrote: > On 29 Jan 2009, at 15:26, Kent Johnson wrote: >> What are you trying to do? Generally problems of the form >> for item in list1: >> if item in list2: >> # do something with item >> > > the first csv file is a list of rows like this

Re: [Tutor] Find a Word in *.py (Win XP)

2009-01-29 Thread bob gailer
Justin Ezequiel wrote: How insane that XP doesn't search the text in "non text" files! -- Alan Gauld http://support.microsoft.com/default.aspx?scid=KB;EN-US;q309173 I used Method 2 under Resolution recently when I reinstalled XP on a new harddisk. Thanks for that. Also works with 2003

Re: [Tutor] building Python 2.6?

2009-01-29 Thread Bernard Rankin
> > Python 2.5 builds fine, but I am getting an error when I run "make" for > > 2.6.1 > > > > Here is the command line I am using: > > ../configure -prefix=/home/username/local-python/ --enable-unicode=ucs4 > > > > (I don't know what the ucs4 thing is, but all the HOWTOs I saw say to use >

Re: [Tutor] IDLE vs PythonWin

2009-01-29 Thread Wayne Watson
Title: Signature.html vim? I'm looking at the interactive window now. Here are two choices for what you say: 1. alt-tab vim Traceback (  File "", line 1     alt-tab vim   ^ SyntaxError: invalid syntax 2. Pressing the alt-tab keys moves me to the next Windows window, which happens t

Re: [Tutor] IDLE vs PythonWin

2009-01-29 Thread Wayne Watson
Title: Signature.html (Lateness of post here from the old Reply to All disease! It just worse. I reissued it to Alan again. Yi, yi, ...) Alan Gauld wrote: "Wayne Watson" wrote About three weeks ago I decided to give PythonWin a whirl. I believe I've noticed about as many code "wrecks" as w

Re: [Tutor] Problem with nested for-in

2009-01-29 Thread spir
Le Thu, 29 Jan 2009 11:06:57 +, "emmanuel.delaborde" a écrit : > Hello, > > I have the following snippet : > > lines = csv.reader(open("CATEGORY.csv","r")) > lines2 = csv.reader(open("CATEGORYLIST.csv","r")) > > old_cats = [] > for line in lines: > stories = [] > for line2 in lin

Re: [Tutor] Problem with nested for-in (Alan Gauld)

2009-01-29 Thread Kent Johnson
On Thu, Jan 29, 2009 at 8:55 AM, emmanuel.delaborde wrote: >> >> I suspect that you need to reset the reader iterator to the start. >> I'm sure there will be something in the iterator protocol to do >> that No, in general iterators cannot be reset. >> but failing that you would need to change th

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread Kent Johnson
On Thu, Jan 29, 2009 at 5:32 AM, spir wrote: > I'm aware that "not 1" is not the same as "~1" in python. And I agree with > that, while I disagree on how it is different. As I see it, both operators > have a close meaning, so that using the same sign (and the same underlying > method name, e.g

Re: [Tutor] Problem with nested for-in (Alan Gauld)

2009-01-29 Thread emmanuel.delaborde
I suspect that you need to reset the reader iterator to the start. I'm sure there will be something in the iterator protocol to do that but failing that you would need to change the inner loop to: for line2 in csv.reader(open("CATEGORYLIST.csv","r")) which will re-read the file and create a new

[Tutor] Fwd: Problem with nested for-in

2009-01-29 Thread emmanuel . delaborde
Hello I hope this will be clearerhere is the script :# -*- coding: utf-8 -*-import csvlines = csv.reader(open("CATEGORY.csv","r"))lines2 = csv.reader(open("CATEGORYLIST.csv","r"))old_cats = []for line in lines:    print line    stories = []    for line2 in lines2

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread Alan Gauld
"spir" wrote Here is an overal and a trial to introduce my view on this topic. ... * The mix of "extended logic" on non-logical types and treating integers as bit sequences provakes a kind of conceptual collision. * As a solution, bitwise operations may apply only to a type (byte or int

Re: [Tutor] Problem with nested for-in

2009-01-29 Thread Alan Gauld
"emmanuel.delaborde" wrote I have the following snippet : lines = csv.reader(open("CATEGORY.csv","r")) lines2 = csv.reader(open("CATEGORYLIST.csv","r")) old_cats = [] for line in lines: stories = [] for line2 in lines2: if line2[1] == line[0]: stories.append(line2

Re: [Tutor] Problem with nested for-in

2009-01-29 Thread W W
On Thu, Jan 29, 2009 at 5:06 AM, emmanuel.delaborde < emmanuel.delabo...@cimex.com> wrote: > Hello, > > I have the following snippet : > > lines = csv.reader(open("CATEGORY.csv","r")) > lines2 = csv.reader(open("CATEGORYLIST.csv","r")) > > old_cats = [] > for line in lines: print line > >

[Tutor] Problem with nested for-in

2009-01-29 Thread emmanuel.delaborde
Hello, I have the following snippet : lines = csv.reader(open("CATEGORY.csv","r")) lines2 = csv.reader(open("CATEGORYLIST.csv","r")) old_cats = [] for line in lines: stories = [] for line2 in lines2: if line2[1] == line[0]: stories.append(line2[0]) old_cats.appen

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread spir
Le Thu, 29 Jan 2009 09:47:22 -, "Alan Gauld" a écrit : > > "Andre Engels" wrote > > >> Why not '!' for not, instead of '~'? I mean, '!' is used in logic, > > in many languages and even in python (!=). On the other hand, > > I had never encountered '~' meaning not. > > > > Although ! is ind

Re: [Tutor] IDLE vs PythonWin

2009-01-29 Thread Alan Gauld
"Wayne Watson" wrote About three weeks ago I decided to give PythonWin a whirl. I believe I've noticed about as many code "wrecks" as with IDLE. Really? I haven't had many problems. That is, while working repeatedly on a program, the editor got confused about what it had available, usua

Re: [Tutor] Find a Word in *.py (Win XP)

2009-01-29 Thread Alan Gauld
"Justin Ezequiel" wrote How insane that XP doesn't search the text in "non text" files! http://support.microsoft.com/default.aspx?scid=KB;EN-US;q309173 I used Method 2 under Resolution recently when I reinstalled XP on a new harddisk. Yes that looks like it should fix it. I'll try that l

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread Alan Gauld
"Andre Engels" wrote Why not '!' for not, instead of '~'? I mean, '!' is used in logic, in many languages and even in python (!=). On the other hand, I had never encountered '~' meaning not. Although ! is indeed usual in computer languages, I disagree when you say it is used in logic. There

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread A.T.Hofkamp
spir wrote: Le Tue, 27 Jan 2009 11:26:06 -0200, Ricardo Aráoz a écrit : Operation Result Notes |x | y| bitwise /or/ of x and y |x ^ y| bitwise /exclusive or/ of x and y |x & y| bitwise /and/ of x and y |x << n| x shifted left by n bits

Re: [Tutor] building Python 2.6?

2009-01-29 Thread spir
Le Wed, 28 Jan 2009 19:01:24 -0800 (PST), Bernard Rankin a écrit : > Hello, > > I am trying to build python 2.6 on a machine (web server) that I do not have > root access to. (has 2.4 installed) > > Python 2.5 builds fine, but I am getting an error when I run "make" for 2.6.1 > > Here is the

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread Andre Engels
On Thu, Jan 29, 2009 at 10:19 AM, spir wrote: > Why not '!' for not, instead of '~'? I mean, '!' is used in logic, in many > languages and even in python (!=). On the other hand, I had never encountered > '~' meaning not. Although ! is indeed usual in computer languages, I disagree when you sa

Re: [Tutor] Defining "bit" type -- why not '!' ?

2009-01-29 Thread spir
Le Tue, 27 Jan 2009 11:26:06 -0200, Ricardo Aráoz a écrit : > > > "Vicent" wrote > > > >> Anyway, I am working with Python 2.5.4, and I am interested in > >> defining a > >> new type called "bit" (if possible), which represents a number that > >> can only > >> take values 0 or 1 —that's what we