On Mon, Mar 15, 2010 at 1:38 PM, Karjer Jdfjdf <[email protected]>wrote:

>
> I have 2 questions about this code:
>
> 1. Can I use this in Python 3 ?  I'm not sure if I can use **kwargs in
> Python 3 because it uses the "apply" builtin (if I understand it correctly)
>
> "At this writing, both apply and the special call syntax described in this
> section can be used freely in Python 2.5, but it seems likely that apply
> may go away in Python 3.0. If you wish to future-proof your code, use
> the equivalent special call syntax, not apply."
>
>
what they're saying is that in python 3, the apply function doesn't exist
anymore, so if you want equivalent functionality, you'll have to use special
call syntax. In other words, what you're doing is just fine.



> 2. Are there better ways to achieve what I want to do?
>
>
I'd consider making sure there are no nonsense arguments passed into the
function:

for key in kwargs:
    if key not in options:
       raise ArgumentError("invalid argument: %s" % key)

other than that, looks fine to me

Hugo
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to