Martin Drautzburg wrote: > > def SQL(sql, checked=set()): > > if sql in checked: > > return True > > if not valid_sql(sql): raise ValueError > > checked.add(sql) > > return sql > > No this does not do the trick. I will not be able to validate an sql > statement bofore I run over the piece of code that uses it. Or I would > have to define all my sql = SQL stuff on module level, isn't id. I > mean, the problem is: when are those sql = SQL statement really > ececuted?
Let's see: >>> def SQL(sql): ... print sql ... >>> a = SQL("module") module # that one was obvious >>> class A: ... b = SQL("class") ... def method(self, c=SQL("default arg")): ... d = SQL("method") ... class # ha, class statements are executed, too... default arg # ...as are default arguments Peter -- http://mail.python.org/mailman/listinfo/python-list