On Dec 30, 2010, at 8:35 AM, avdd wrote:
> Hi there
>
> Just wondering, before 0.7 is released and the API is baked, is it
> necessary to have all event names start with "on_"? It seems
> redundant and hackish. (Use a property?)
What's hackish ? Are you referring to the internals of event.py which look
for "on_" in a few places ? That's not the rationale for the presence of
"on_", though it is convenient.
The rationale for "on_" is so that event names are placed into their own
namespace, disambiguating them from other methods that are present on the
parent Events class which deal with the mechanics of registering and
de-registering events.
Prefixing event names with "on" is a very common practice - Hibernate's event
system, which I consulted before developing sqlalchemy.event, uses the same
scheme:
http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/event/PersistEventListener.html
http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/event/FlushEventListener.html
Javascript as we know uses "on":
http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3
wxpython:
http://wiki.wxpython.org/Getting%20Started#Event_handling
so this decision wasn't made in a vacuum and naming all events on_XYZ feels
very natural to me. I'd welcome anyone else's thoughts on the matter.
>
> Also, "retval" seems a prominent api symbol, it seems a shame to have
> such a strained abbreviation. "returns" ?
"retval" is not fantastic, though it is a known term used by pdb for instance.
"returns" as a boolean sounds like its suggesting the function may or may not
return. A non-abbrevated name would be "has_return_value".
>
> a.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.