Now I understand. It is a problem witg the example. Will fix it.

On Jun 9, 9:24 am, Pawel Jasinski <pawel.jasin...@gmail.com> wrote:
> hi,
> sorry for being to cryptic.
>
> In [1]: def foo(*args,**kwargs):
>    ...:     print vars
>    ...:
>    ...:
>
> In [2]: foo()
> <built-in function vars>
>
> In [3]: def bar(*args,**vars):
>    ...:     print vars
>    ...:
>    ...:
>
> In [4]: bar()
> {}
>
> ref:http://docs.python.org/library/functions.html#vars
> as I said, it is cosmetic. I believe it is a bad idea to give variable
> a name which matches name of the build-in function
>
> cheers,
> pawel
>
> On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro
>
>
>
>
>
>
>
> <massimo.dipie...@gmail.com> wrote:
> > I do not understand. :-(
>
> > On Jun 9, 3:21 am, Pawel Jasinski <pawel.jasin...@gmail.com> wrote:
> >> hi,
> >> it is cosmetic, but can be a pain for someone no so familiar with
> >> python.
> >> In examples for restful api:
>
> >> def index():
> >>     def GET(*args,**vars):
> >>         patterns = [
> >>             "/persons[person]",
> >>             "/{person.name.startswith}",
> >>             "/{person.name}/:field",
> >>             "/{person.name}/pets[pet.person]",
> >>             "/{person.name}/pet[pet.person]/{pet.name}",
> >>             "/{person.name}/pet[pet.person]/{pet.name}/:field"
> >>             ]
> >>         parser = db.parse_as_rest(patterns,args,vars)
> >>         if parser.status == 200:
> >>             return dict(content=parser.response)
> >>         else:
> >>             raise HTTP(parser.status,parser.error)
> >>     def POST(table_name,**vars):
> >>         if table_name == 'person':
> >>             return db.person.validate_and_insert(**vars)
> >>         elif table_name == 'pet':
> >>             return db.pet.validate_and_insert(**vars)
> >>         else:
> >>             raise HTTP(400)
> >>     return locals()
>
> >> after copy paste everything is ok, but the problem is waiting to
> >> happen ...
> >> vars hides built-in vars function.
>
> >> cheers,
> >> pawel

Reply via email to