-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9 May 2006, at 16:18, Jonathan wrote:
gc= <TransientObjectContainer at GarbageCollector>
GarbageCollector exists


I think I am misunderstanding something basic about python/zope here. Why does a TOC object evaluate to false?

I think the basic misunderstanding is about what happens if you say...

if FOO: ...

Python will try to evaluate using steps such as looking for methods like __nonzero__, __len__, etc, and you're not aware what these may evaluate to given your object. A Folder, for example, evaluates to False when it is empty.

You should use a different test to determine if that item exists.

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEYLRlRAx5nvEhZLIRAmSWAKCxP+IjWYHEC/J1E8zDvq0R2OUB1wCePA74
Fm8Oc74d3dn915gDefbR1Yo=
=FOpK
-----END PGP SIGNATURE-----
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to