On Wednesday 11 July 2007 21:49:48 Mike Orr wrote: > On 7/11/07, Jose Galvez <[EMAIL PROTECTED]> wrote: > > Dear Mike, > > I've read the doc string in the new sacontext and was just > > wondering why for add_engine_from_config do you have to > > explicitly pass None for the default connection? it would make > > more sense to pass 'default' or better yet nothing all all and > > assume the default engine. I understand that you are moving away > > from the the implicit to the explicit which is great, I just > > thought passing None to mean default is awkward when you could > > just as easily added None as the default in the method def. (the > > same could be said about add_engine) > > It is awkward but Python has no other built-in value for "default". > Using a string means people may spell it differently, and the > .metadata and .engine properties require a fixed value. Making it > optional means the second positional argument would sometimes move > to the first (like Pylons render_response("/template.html") vs > render_response("mako", "/template.html"), and I'm absolutely > opposed to that. Mike doesn't like positional arguments for > SAContext but i think they make sense in these cases. So None was > the best compromise I could find. > > I'm open to changing it to "default" if people like that better. > It does mean people would have to pass the exact string or > sacontext.DEFAULT (which used to exist but currently doesn't).
i would create a dummy class, in your case class DEFAULT: pass under SAcontext, and use that one instead of None: if x is SAcontext.DEFAULT: ... works quite well. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---