Fw: [ZPT] TAL Exists: type

Guido van Rossum guido@digicool.com
Wed, 21 Mar 2001 10:46:16 -0500


> > From: "Todd Coram" <todd@digicool.com>
> > > Any stories to tell on the undocumented TAL type of "exists:"?  I
> briefly
> > > remember this type, but can't remember concisely where it is applicable.
> > > Any use cases to offer?
> > 
> > Something like:
> >
> > <p tal:condition="exists:here/legal_notice"
> > tal:content="here/legal_notice">Blather</p>
> >
> > This also highlights my reason for suspecting that an Undefined singleton
> > could be very useful;  If the path were longer, and appeared more than
> > twice, this would become painfully verbose and error-prone, or would need
> to
> > be split into two tags:
> >
> > <div tal:condition="exists:here/to/there/via/another/place">
> >   <p tal:define="x here/to/there/via/another/place"
> > tal:condition="x/hasBlarg" tal:content="x">Bother</p>
> > </div>
> >
> > ...as opposed to:
> >
> > <p tal:define="x here/to/there/via/another/place; blargness x/hasBlarg"
> > tal:condition="blargness" tal:content="x">Bother</p>
> >
> > This assumes that any attempt to traverse Undefined returns Undefined.
> >
> > Cheers,
> >
> > Evan @ digicool

Evan, I'm not sure I follow.  Do you propose to make all references to
undefined variables or attributes return Undefined instead of raise an
error?  That sounds like it would easily mask errors -- very Perlish.

--Guido van Rossum (home page: http://www.python.org/~guido/)