Re: [sqlalchemy] event interface

2010-12-30 Thread Michael Bayer
The tweetscape is so far 9-2 on this one in the past two hours with one 
additional vote I'd qualify as split, so the change is up and you can see it at:

http://www.sqlalchemy.org/docs/07/core/events.html
http://www.sqlalchemy.org/docs/07/orm/events.html


On Dec 30, 2010, at 2:29 PM, Tamás Bajusz wrote:

> On Thu, Dec 30, 2010 at 6:50 PM, Michael Bayer  
> wrote:
>> the twitterstream is leaning a lot towards not having the "on_", we'll see 
>> what happens as the day goes on.
> 
> PyQt4 uses "on_" too.
> http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#connecting-slots-by-name
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] event interface

2010-12-30 Thread Tamás Bajusz
On Thu, Dec 30, 2010 at 6:50 PM, Michael Bayer  wrote:
> the twitterstream is leaning a lot towards not having the "on_", we'll see 
> what happens as the day goes on.

PyQt4 uses "on_" too.
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/pyqt4ref.html#connecting-slots-by-name

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] event interface

2010-12-30 Thread Kevin Horn
On Thu, Dec 30, 2010 at 11:50 AM, Michael Bayer wrote:

> the twitterstream is leaning a lot towards not having the "on_", we'll see
> what happens as the day goes on.
>
>
For what it's worth, I think it's fine.  It makes the interface seem very
obvious to me.

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] event interface

2010-12-30 Thread Michael Bayer
the twitterstream is leaning a lot towards not having the "on_", we'll see what 
happens as the day goes on.


On Dec 30, 2010, at 11:37 AM, Michael Bayer wrote:

> 
> 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 sqlalch...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sqlalchemy+unsubscr...@googlegroups.com.
>> 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 sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] event interface

2010-12-30 Thread Michael Bayer

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 sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



[sqlalchemy] event interface

2010-12-30 Thread avdd
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?)

Also, "retval" seems a prominent api symbol, it seems a shame to have
such a strained abbreviation.  "returns" ?

a.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.