Re: An interesting python problem

2005-09-14 Thread Steve Holden
Adriaan Renting wrote: > In my mind all Python variables are some kind of "named pointers", I find > that thinking this way helps me a lot in understanding what I'm doing. I know > that this is not completely technically correct as in the first two examples > there is actually a new a.i/a.arr cr

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Adriaan Renting wrote: > In my mind all Python variables are some kind of "named pointers", Technically, they are key/value pairs in a dictionnary, the key being the name and the value a reference to an object. > I > find that thinking this way helps me a lot in understanding what I'm > doing. I

Re: An interesting python problem

2005-09-14 Thread Adriaan Renting
In my mind all Python variables are some kind of "named pointers", I find that thinking this way helps me a lot in understanding what I'm doing. I know that this is not completely technically correct as in the first two examples there is actually a new a.i/a.arr created that shadows A.i, but thi

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Johnny Lee wrote: > bruno modulix wrote: > >>I dont see anything interesting nor problematic here. If you understand >>the difference between class attributes and instance attributes, the >>difference between mutating an object and rebinding a name, and the >>attribute lookup rules in Python, you'

Re: An interesting python problem

2005-09-14 Thread Johnny Lee
bruno modulix wrote: > > I dont see anything interesting nor problematic here. If you understand > the difference between class attributes and instance attributes, the > difference between mutating an object and rebinding a name, and the > attribute lookup rules in Python, you'll find that all thi

Re: An interesting python problem

2005-09-14 Thread bruno modulix
Johnny Lee wrote: > Hi, >Look at the follow command in python command line, See what's > interesting?:) > > class A: > > i = 0 > a = A() b = A() a.i = 1 print a.i, b.i > > 1 0 Quite what I would expect. First you declare i as being a *class* attribute of A, with

Re: An interesting python problem using Zope 2.7.3

2005-02-05 Thread Steve Holden
ranjith g p wrote: Greetings!!! I ran the following simple string commands in Linux + Python and the results are: [EMAIL PROTECTED] root]# python Python 2.2.2 (#1, Feb 24 2003, 19:13:11) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for mor