Another newbie question

Erik Max Francis max at alcyone.com
Sun Dec 11 04:25:27 CET 2005


Paul Rubin wrote:

> Right, you could use properties to make point.x get the real part of
> an internal complex number.  But now you're back to point.x being an
> accessor function; you've just set things up so you can call it
> without parentheses, like in Perl.  E.g.
> 
>     a = point.x
>     b = point.x
>     assert (a is b)    # can fail
> 
> for that matter
> 
>     assert (point.x is point.x) 
> 
> can fail.  These attributes aren't "member variables" any more.

Which is perfectly fine, since testing identity with `is' in this 
context is not useful.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Never use two words when one will do best.
   -- Harry S. Truman



More information about the Python-list mailing list