On Dec 30, 2010, at 10:04 PM, avdd wrote: > > > 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?
I'm not really comfortable with those names, in my own work I've called them @hybrid_property and @hybrid_method, which in this context seems redundant to call them @hybrid.hybrid_property, but at the moment that still seems better to me. When you see me sticking a "_" on the end of an identifier it means TextMate was lighting it up as a reserved word. Of course it doesn't always light it up depending on context....but anyway I really don't like @property_ at all so ill probably change it. > 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. > -- 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.