what logging really needs is this:

logging.debug(lambda: "%s - %s" % (_get_data(x),_get_other_data(y))

and the lambda: doesnt execute if logging is disabled; which accounts
for a lot more than just doing the % operation or not, such as in my
case where i make calls out to _instance_str() to represent an instance
string.   however, theres still overhead to creating those lambdas.

anyway, if you look at what I did, I just set a boolean flag in the
constructor based on is_debug_enabled() and just check the flag
explicitly before every call to debug()....so no method calls or log
message construction of any kind happen at all if debug logging is
disabled.  speed looks a lot more like 0.2.8 now (pending further test
cases people want to give me).  (the next thing that might help is if i
speed up the calls to mapper_extension).

also, I challenge your assertion that saying "x and y or z" is a
perlish thing (its a C and Java thing if anything); python 2.5 has just
added the "y if x else z" syntax which is essentially an official
version of the same thing.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to