Advice needed on __del__

Sion Arrowsmith siona at chiark.greenend.org.uk
Tue May 10 10:25:05 EDT 2005


=?ISO-8859-1?Q?Andr=E9_Roberge?=  <andre.roberge at gmail.com> wrote:
>If I need to have the user call Evil.destroy() as Evil
>is getting out of scope, it would miss the whole point
>of teaching about the natural way scope and namespace
>work.

The problem, it seems to me, is that in Python "scope" applies
to names, but you're trying to apply it to objects. A name going
out of scope shouldn't be assumed to have much of an impact on
the object it referred to, and by emphasising too close a link
between name and object I think you're more likely to run into
trouble later on.

As was pointed out upthread, Python isn't C++. (Speaking as
someone who's been bitten by a very similar issue due to Java
not being C++ either.)

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list