By "hackish" I refer to the tacking on a prefix to simulate a namespace, and similarly conflating the python identifier namespace with the events. I have the same problem with frameworks that use method names as URL components.
I would prefer the event names to look as you have done with the ORM cascade symbols, e.g. @register('before-frobnoff') def on_before_frobnoff(): pass @listen('before-frobnoff') def my_frobnoff_listener() (Of course I meant s/property/decorator/ in OP) Javascript, DOM level 1 uses "on", but DOM level 2 uses unadorned names: http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent As an aside, hybrid.py defines property_ (mangled) where the docs refer to the unmangled. What's the reason for the mangling of names that shadow builtins? Lint complaints? I find it similarly annoying seeing type_ and such everywhere. (I wish python had a standard top- level namespace!) On Dec 31, 3:37 am, Michael Bayer <mike...@zzzcomputing.com> 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... > > http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/event... > > 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 > > athttp://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.