Re: [web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Jonathan Lundell
On Jan 14, 2011, at 1:06 AM, Bob wrote: > > I see no downsides and seems that Massimo confirmed that. I already > tried using return locals() and it works without issues. > > On 14 Ян, 07:37, pbreit wrote: >> Wait, so are you saying that instead of return dict(items=items, blah=blah, >> etc) we

Re: [web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Bruno Rocha
> response._vars: this variable is accessible only in a view, not in the > action. It contains the value returned by the action to the view. I made a simple test here: <*controller*> def myfunc(): _counter = 0 #I also tried with __counter for i in range(101): _counter += 1 re

Re: [web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread rochacbruno
In this case will be a good pratice to use _ and __ to name that variables which you dont want to be used in views. I see that if you have too many local vars the dict send to the view will be bigger. What is the better aproach in a matter of memory usage. A bigger dict available to the view

Re: [web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Kenneth Lundström
Only thing that comes to my mind is that you can´t rename a variable. With dict() method you can "rename" them. I don´t know if people do that. Traditional way, if you want to rename variable: total_exposure_at_day_light_time = 365 return dict(teadlt = total_exposure_at_day_light_time) new way:

Re: [web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Alexandre Andrade
It's interesting, while I usually don't use so many variables in each controller. 2011/1/14 Bob > I see no downsides and seems that Massimo confirmed that. I already > tried using return locals() and it works without issues. > > On 14 Ян, 07:37, pbreit wrote: > > Wait, so are you saying that

[web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Bob
I see no downsides and seems that Massimo confirmed that. I already tried using return locals() and it works without issues. On 14 Ян, 07:37, pbreit wrote: > Wait, so are you saying that instead of return dict(items=items, blah=blah, > etc) we can just use return locals() on most or all controlle

[web2py] Re: Why the need of return dict() in controller?

2011-01-13 Thread pbreit
Wait, so are you saying that instead of return dict(items=items, blah=blah, etc) we can just use return locals() on most or all controllers? What's the downside, memory? Implicitness?

[web2py] Re: Why the need of return dict() in controller?

2011-01-13 Thread Massimo Di Pierro
Some people do not want to return everything in locals() but there is nothing wrong in returning locals(). Actually I like it a lot. Renaming vars just causes confusion. On Jan 13, 3:27 am, Bob wrote: > Is there anything I am missing? Why would you want to manually create > a dictionary of all