Best way to disconnect from ldap?

Tycho Andersen tycho at tycho.ws
Thu Mar 22 17:02:15 EDT 2012


On Thu, Mar 22, 2012 at 05:26:11PM +0000, Steven D'Aprano wrote:
> On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote:
> 
> > I've had similar experiences. In fact, in light of all this - why does
> > __del__ exist at all? Novice python users may (reasonably) assume it
> > behaves similarly to a C++ destructor (even though the docs warn
> > otherwise).
> 
> What makes you think that novice Python users will be familiar with C++ 
> destructors?

I don't, really. It's just natural to assume that __del__ is the
"opposite" of __init__, when it's really not (i.e. every object is
__init__ed, but not every object is destructed and thus __del__'d).
Novice programmers may make this assumption (indeed, many experienced
programmers do as well).

> Be careful about assuming that idioms in <INSERT FAVOURITE LANGUAGE HERE> 
> will be shared by all Python programmers, novice or expert.

Yeah, C++ was the first language which has destructors that came to
mind. It's certainly not my favorite ;-)

\t



More information about the Python-list mailing list