Anthony, many thanks for your answer, I was thinking in "self" and not
"this", I am working with python and java right now and sometimes I
place ";" or brackets in python code...
My team and I are used to working with object-oriented ORM, and that's
why the "self" feels more natural to me (and my lazy side says that
there are many innecesary characters...), I mean that why not pass only
the row object, "row" is an object of type row, and row.table is a row
object too, I don't understand why is passed "row" if we always are
going to work with "row.table"
Regards.
El 28/10/15 a las 11:53, Anthony escribió:
An extra question:
why I need to do something like:
lambdarow: row.tablename.field
something like this looks more elegant:
lambda this: this.field
just saying...
You can do:
|
lambdathis:this.tablename.field
|
I should note that while you can use "this" (or any arbitrary argument
name), it would be unusual in Python (which by convention uses "self"
within object methods). I would also argue that "row" is more clear in
this context than something like "this" or "self", as with the latter
two, it is not clear whether they refer to the Row object or to the
Field object -- "row" makes it clear that a Row object is being passed
to the function.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to web2py+unsubscr...@googlegroups.com
<mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
Este mensaje le ha llegado mediante el servicio de correo electronico que
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema
Nacional de Salud. La persona que envia este correo asume el compromiso de usar
el servicio a tales fines y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.