It shouldn't. It should throw an error at the print statement because
'a' is not defined.

On Jul 22, 6:33 pm, mdipierro <[email protected]> wrote:
> The following code uses:
> 1) a computed field
> 2) a self reference
> 3) a virtual field
>
> >>> db.define_table('a',Field('x'),Field('y','reference 
> >>> a'),Field('z',compute=lambda row: row['x']*3))
> >>> class A:
> >>>      def t(self): return len(self.a.z)
> >>> db.a.virtualfields.append(A())
> >>> r=db.a.insert(x='hello')
> >>> r.update_record(x=r.x,y=r)
> >>> print a.y.y.y.y.t
>
> 15
>
> Can you explain how it works?

Reply via email to