> This could be done, but it would be extremely kludgey.  The main
> problem is that there is no way in Python to determine the type of an
> arbitrary object (Python usage of object).  You can determine the
> *class* of an instance, but you can't easily tell the difference
> between a tuple and a string share most of their legal operations.

Well yeah, you can't realistically overload functions in python.

But you can have two methods with different names (or in different
packages, on different classes, etc.) one of which takes a string and one
of which takes a tuple. The one that takes a string converts it to a tuple
and call the one that takes a tuple. You'd want that anyway so that the
code for command line parsing is thin, being as how keys passed on the
command line will be in string format.

Just in general, I don't see why you'd want the interface to the functions
to use tuples instead of strings. You might want to use tuples internally,
but I don't see any advantage to using them on the API level.



_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev

Reply via email to