Interesting. We need to review the source and see where we can use this 
improvement. I think we use the latter almost anywhere already but not sure.
On Friday, 14 September 2012 02:57:11 UTC-5, Dominic wrote:
>
> I have a couple of case discriminations to reduce a parameter to the 
> tablename. I found that in gluon, this is often done by simply str(table).
>
>
> But did you know:
>
>
> >>> x = lambda: str(table)
>
> >>> timeit.Timer(x).timeit()
>
> 5.487793207168579
>
> >>> x = lambda: table._tablename if hasattr(table, "_tablename") else table
>
> >>> timeit.Timer(x).timeit()
>
> 0.5015690326690674
>
> Regards,
>
> Dominic
>
>
>

-- 



Reply via email to