On 4/26/07, tsume <[EMAIL PROTECTED]> wrote:
> I was just using SQLAlchemy as an example. Much of TG seems to lean more
> towards using kwargs than nonkwargs, as in the scheduler examples.
>
> turbogears.scheduler.add_interval_task(action=do_something,
> taskname='do_something', initialdelay=0, interval=10)
>
> Same code from the first post. Nothing to do with function, just style.
> Personally, I can remember names easier than the order of arguments.
>
> By using, I mean use kwargs instead of nonkwargs in methods and not use
> any nonkwargs.

You can already use keyword args with any Python method:

Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
(Intel)] on win32
>>> class Foo:
...     def bar(self, x, y):
...             print x + y
...
>>> f = Foo()
>>> f.bar(x=2, y=40)
42
>>>

If you're not using keyword args in Webware because you think some
args are poorly named, let us know. Or if you think some defaults are
missing, you can report that as well. Or maybe what you're saying is
that you'd like to see them used more in docs and examples.

Certainly as the number of args gets larger, the keyword approach gets
more useful.

-Chuck

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to